dynarmic/externals/zydis/include/Zydis/Formatter.h

1147 lines
42 KiB
C
Raw Normal View History

/***************************************************************************************************
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 for formatting instructions to human-readable text.
*/
#ifndef ZYDIS_FORMATTER_H
#define ZYDIS_FORMATTER_H
#include <Zycore/Defines.h>
#include <Zycore/String.h>
#include <Zycore/Types.h>
#include <Zydis/DecoderTypes.h>
#include <Zydis/FormatterBuffer.h>
#ifdef __cplusplus
extern "C" {
#endif
/* ============================================================================================== */
/* Constants */
/* ============================================================================================== */
/**
* Use this constant as value for `runtime_address` in `ZydisFormatterFormatInstruction(Ex)`
* or `ZydisFormatterFormatOperand(Ex)` to print relative values for all addresses.
*/
#define ZYDIS_RUNTIME_ADDRESS_NONE (ZyanU64)(-1)
/* ============================================================================================== */
/* Enums and types */
/* ============================================================================================== */
/* ---------------------------------------------------------------------------------------------- */
/* Formatter style */
/* ---------------------------------------------------------------------------------------------- */
/**
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* Enum selecting the syntax to format the disassembly in.
*/
typedef enum ZydisFormatterStyle_
{
/**
* Generates `AT&T`-style disassembly.
*/
ZYDIS_FORMATTER_STYLE_ATT,
/**
* Generates `Intel`-style disassembly.
*/
ZYDIS_FORMATTER_STYLE_INTEL,
/**
* Generates `MASM`-style disassembly that is directly accepted as input for
* the `MASM` assembler.
*
* The runtime-address is ignored in this mode.
*/
ZYDIS_FORMATTER_STYLE_INTEL_MASM,
/**
* Maximum value of this enum.
*/
ZYDIS_FORMATTER_STYLE_MAX_VALUE = ZYDIS_FORMATTER_STYLE_INTEL_MASM,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_FORMATTER_STYLE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_FORMATTER_STYLE_MAX_VALUE)
} ZydisFormatterStyle;
/* ---------------------------------------------------------------------------------------------- */
/* Properties */
/* ---------------------------------------------------------------------------------------------- */
/**
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* Enum selecting a property of the formatter.
*/
typedef enum ZydisFormatterProperty_
{
/* ---------------------------------------------------------------------------------------- */
/* General */
/* ---------------------------------------------------------------------------------------- */
/**
* Controls the printing of effective operand-size suffixes (`AT&T`) or operand-sizes
* of memory operands (`INTEL`).
*
* Pass `ZYAN_TRUE` as value to force the formatter to always print the size, or `ZYAN_FALSE`
* to only print it if needed.
*/
ZYDIS_FORMATTER_PROP_FORCE_SIZE,
/**
* Controls the printing of segment prefixes.
*
* Pass `ZYAN_TRUE` as value to force the formatter to always print the segment register of
* memory-operands or `ZYAN_FALSE` to omit implicit `DS`/`SS` segments.
*/
ZYDIS_FORMATTER_PROP_FORCE_SEGMENT,
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
/**
* Controls the printing of the scale-factor component for memory operands.
*
* Pass `ZYAN_TRUE` as value to force the formatter to always print the scale-factor component
* of memory operands or `ZYAN_FALSE` to omit the scale factor for values of `1`.
*/
ZYDIS_FORMATTER_PROP_FORCE_SCALE_ONE,
/**
* Controls the printing of branch addresses.
*
* Pass `ZYAN_TRUE` as value to force the formatter to always print relative branch addresses
* or `ZYAN_FALSE` to use absolute addresses, if a runtime-address different to
* `ZYDIS_RUNTIME_ADDRESS_NONE` was passed.
*/
ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_BRANCHES,
/**
* Controls the printing of `EIP`/`RIP`-relative addresses.
*
* Pass `ZYAN_TRUE` as value to force the formatter to always print relative addresses for
* `EIP`/`RIP`-relative operands or `ZYAN_FALSE` to use absolute addresses, if a runtime-
* address different to `ZYDIS_RUNTIME_ADDRESS_NONE` was passed.
*/
ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_RIPREL,
/**
* Controls the printing of branch-instructions sizes.
*
* Pass `ZYAN_TRUE` as value to print the size (`short`, `near`) of branch
* instructions or `ZYAN_FALSE` to hide it.
*
* Note that the `far`/`l` modifier is always printed.
*/
ZYDIS_FORMATTER_PROP_PRINT_BRANCH_SIZE,
/**
* Controls the printing of instruction prefixes.
*
* Pass `ZYAN_TRUE` as value to print all instruction-prefixes (even ignored or duplicate
* ones) or `ZYAN_FALSE` to only print prefixes that are effectively used by the instruction.
*/
ZYDIS_FORMATTER_PROP_DETAILED_PREFIXES,
/* ---------------------------------------------------------------------------------------- */
/* Numeric values */
/* ---------------------------------------------------------------------------------------- */
/**
* Controls the base of address values.
*/
ZYDIS_FORMATTER_PROP_ADDR_BASE,
/**
* Controls the signedness of relative addresses. Absolute addresses are
* always unsigned.
*/
ZYDIS_FORMATTER_PROP_ADDR_SIGNEDNESS,
/**
* 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
* 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
* custom padding.
*/
ZYDIS_FORMATTER_PROP_ADDR_PADDING_RELATIVE,
/* ---------------------------------------------------------------------------------------- */
/**
* Controls the base of displacement values.
*/
ZYDIS_FORMATTER_PROP_DISP_BASE,
/**
* Controls the signedness of displacement values.
*/
ZYDIS_FORMATTER_PROP_DISP_SIGNEDNESS,
/**
* Controls the padding of displacement values.
*
* Pass `ZYDIS_PADDING_DISABLED` to disable padding, or any other integer value for custom
* padding.
*/
ZYDIS_FORMATTER_PROP_DISP_PADDING,
/* ---------------------------------------------------------------------------------------- */
/**
* Controls the base of immediate values.
*/
ZYDIS_FORMATTER_PROP_IMM_BASE,
/**
* Controls the signedness of immediate values.
*
* Pass `ZYDIS_SIGNEDNESS_AUTO` to automatically choose the most suitable mode based on the
* operands `ZydisDecodedOperand.imm.is_signed` attribute.
*/
ZYDIS_FORMATTER_PROP_IMM_SIGNEDNESS,
/**
* Controls the padding of immediate values.
*
* Pass `ZYDIS_PADDING_DISABLED` to disable padding, `ZYDIS_PADDING_AUTO` to padd all
* immediates to the operand-width (hexadecimal only), or any other integer value for custom
* padding.
*/
ZYDIS_FORMATTER_PROP_IMM_PADDING,
/* ---------------------------------------------------------------------------------------- */
/* Text formatting */
/* ---------------------------------------------------------------------------------------- */
/**
* Controls the letter-case for prefixes.
*
* Pass `ZYAN_TRUE` as value to format in uppercase or `ZYAN_FALSE` to format in lowercase.
*/
ZYDIS_FORMATTER_PROP_UPPERCASE_PREFIXES,
/**
* Controls the letter-case for the mnemonic.
*
* Pass `ZYAN_TRUE` as value to format in uppercase or `ZYAN_FALSE` to format in lowercase.
*/
ZYDIS_FORMATTER_PROP_UPPERCASE_MNEMONIC,
/**
* Controls the letter-case for registers.
*
* Pass `ZYAN_TRUE` as value to format in uppercase or `ZYAN_FALSE` to format in lowercase.
*/
ZYDIS_FORMATTER_PROP_UPPERCASE_REGISTERS,
/**
* Controls the letter-case for typecasts.
*
* Pass `ZYAN_TRUE` as value to format in uppercase or `ZYAN_FALSE` to format in lowercase.
*/
ZYDIS_FORMATTER_PROP_UPPERCASE_TYPECASTS,
/**
* Controls the letter-case for decorators.
*
* Pass `ZYAN_TRUE` as value to format in uppercase or `ZYAN_FALSE` to format in lowercase.
*/
ZYDIS_FORMATTER_PROP_UPPERCASE_DECORATORS,
/* ---------------------------------------------------------------------------------------- */
/* Number formatting */
/* ---------------------------------------------------------------------------------------- */
/**
* Controls the prefix for decimal values.
*
* Pass a pointer to a null-terminated C-style string with a maximum length of 10 characters
* to set a custom prefix, or `ZYAN_NULL` to disable it.
*
* The string is deep-copied into an internal buffer.
*/
ZYDIS_FORMATTER_PROP_DEC_PREFIX,
/**
* Controls the suffix for decimal values.
*
* Pass a pointer to a null-terminated C-style string with a maximum length of 10 characters
* to set a custom suffix, or `ZYAN_NULL` to disable it.
*
* The string is deep-copied into an internal buffer.
*/
ZYDIS_FORMATTER_PROP_DEC_SUFFIX,
/* ---------------------------------------------------------------------------------------- */
/**
* Controls the letter-case of hexadecimal values.
*
* Pass `ZYAN_TRUE` as value to format in uppercase and `ZYAN_FALSE` to format in lowercase.
*
* The default value is `ZYAN_TRUE`.
*/
ZYDIS_FORMATTER_PROP_HEX_UPPERCASE,
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
/**
* 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.
*
* Pass a pointer to a null-terminated C-style string with a maximum length of 10 characters
* to set a custom prefix, or `ZYAN_NULL` to disable it.
*
* The string is deep-copied into an internal buffer.
*/
ZYDIS_FORMATTER_PROP_HEX_PREFIX,
/**
* Controls the suffix for hexadecimal values.
*
* Pass a pointer to a null-terminated C-style string with a maximum length of 10 characters
* to set a custom suffix, or `ZYAN_NULL` to disable it.
*
* The string is deep-copied into an internal buffer.
*/
ZYDIS_FORMATTER_PROP_HEX_SUFFIX,
/* ---------------------------------------------------------------------------------------- */
/**
* Maximum value of this enum.
*/
ZYDIS_FORMATTER_PROP_MAX_VALUE = ZYDIS_FORMATTER_PROP_HEX_SUFFIX,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_FORMATTER_PROP_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_FORMATTER_PROP_MAX_VALUE)
} ZydisFormatterProperty;
/* ---------------------------------------------------------------------------------------------- */
/**
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* Enum defining different mantissae to be used during formatting.
*/
typedef enum ZydisNumericBase_
{
/**
* Decimal system.
*/
ZYDIS_NUMERIC_BASE_DEC,
/**
* Hexadecimal system.
*/
ZYDIS_NUMERIC_BASE_HEX,
/**
* Maximum value of this enum.
*/
ZYDIS_NUMERIC_BASE_MAX_VALUE = ZYDIS_NUMERIC_BASE_HEX,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_NUMERIC_BASE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_NUMERIC_BASE_MAX_VALUE)
} ZydisNumericBase;
/* ---------------------------------------------------------------------------------------------- */
/**
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* Enum defining the signeness of integers to be used during formatting.
*/
typedef enum ZydisSignedness_
{
/**
* Automatically choose the most suitable mode based on the operands
* ZydisDecodedOperand.imm.is_signed` attribute.
*/
ZYDIS_SIGNEDNESS_AUTO,
/**
* Force signed values.
*/
ZYDIS_SIGNEDNESS_SIGNED,
/**
* Force unsigned values.
*/
ZYDIS_SIGNEDNESS_UNSIGNED,
/**
* Maximum value of this enum.
*/
ZYDIS_SIGNEDNESS_MAX_VALUE = ZYDIS_SIGNEDNESS_UNSIGNED,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_SIGNEDNESS_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_SIGNEDNESS_MAX_VALUE)
} ZydisSignedness;
/* ---------------------------------------------------------------------------------------------- */
/**
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* Enum definining magic values that receive special treatment when used as padding properties
* of the formatter.
*/
typedef enum ZydisPadding_
{
/**
* Disables padding.
*/
ZYDIS_PADDING_DISABLED = 0,
/**
* Padds the value to the current stack-width for addresses, or to the
* operand-width for immediate values (hexadecimal only).
*/
ZYDIS_PADDING_AUTO = (-1),
/**
* Maximum value of this enum.
*/
ZYDIS_PADDING_MAX_VALUE = ZYDIS_PADDING_AUTO,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_PADDING_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_PADDING_MAX_VALUE)
} ZydisPadding;
/* ---------------------------------------------------------------------------------------------- */
/* Function types */
/* ---------------------------------------------------------------------------------------------- */
/**
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* 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.
*/
typedef enum ZydisFormatterFunction_
{
/* ---------------------------------------------------------------------------------------- */
/* Instruction */
/* ---------------------------------------------------------------------------------------- */
/**
* This function is invoked before the formatter formats an instruction.
*/
ZYDIS_FORMATTER_FUNC_PRE_INSTRUCTION,
/**
* This function is invoked after the formatter formatted an instruction.
*/
ZYDIS_FORMATTER_FUNC_POST_INSTRUCTION,
/* ---------------------------------------------------------------------------------------- */
/**
* This function refers to the main formatting function.
*
* Replacing this function allows for complete custom formatting, but indirectly disables all
* other hooks except for `ZYDIS_FORMATTER_FUNC_PRE_INSTRUCTION` and
* `ZYDIS_FORMATTER_FUNC_POST_INSTRUCTION`.
*/
ZYDIS_FORMATTER_FUNC_FORMAT_INSTRUCTION,
/* ---------------------------------------------------------------------------------------- */
/* Operands */
/* ---------------------------------------------------------------------------------------- */
/**
* This function is invoked before the formatter formats an operand.
*/
ZYDIS_FORMATTER_FUNC_PRE_OPERAND,
/**
* This function is invoked after the formatter formatted an operand.
*/
ZYDIS_FORMATTER_FUNC_POST_OPERAND,
/* ---------------------------------------------------------------------------------------- */
/**
* This function is invoked to format a register operand.
*/
ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REG,
/**
* This function is invoked to format a memory operand.
*
* Replacing this function might indirectly disable some specific calls to the
* `ZYDIS_FORMATTER_FUNC_PRINT_TYPECAST`, `ZYDIS_FORMATTER_FUNC_PRINT_SEGMENT`,
* `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS` and `ZYDIS_FORMATTER_FUNC_PRINT_DISP` functions.
*/
ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEM,
/**
* This function is invoked to format a pointer operand.
*/
ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTR,
/**
* This function is invoked to format an immediate operand.
*
* Replacing this function might indirectly disable some specific calls to the
* `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS`, `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_REL` and
* `ZYDIS_FORMATTER_FUNC_PRINT_IMM` functions.
*/
ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM,
/* ---------------------------------------------------------------------------------------- */
/* Elemental tokens */
/* ---------------------------------------------------------------------------------------- */
/**
* This function is invoked to print the instruction mnemonic.
*/
ZYDIS_FORMATTER_FUNC_PRINT_MNEMONIC,
/* ---------------------------------------------------------------------------------------- */
/**
* This function is invoked to print a register.
*/
ZYDIS_FORMATTER_FUNC_PRINT_REGISTER,
/**
* This function is invoked to print absolute addresses.
*
* Conditionally invoked, if a runtime-address different to `ZYDIS_RUNTIME_ADDRESS_NONE` was
* passed:
* - `IMM` operands with relative address (e.g. `JMP`, `CALL`, ...)
* - `MEM` operands with `EIP`/`RIP`-relative address (e.g. `MOV RAX, [RIP+0x12345678]`)
*
* Always invoked for:
* - `MEM` operands with absolute address (e.g. `MOV RAX, [0x12345678]`)
*/
ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS,
/**
* This function is invoked to print relative addresses.
*
* Conditionally invoked, if `ZYDIS_RUNTIME_ADDRESS_NONE` was passed as runtime-address:
* - `IMM` operands with relative address (e.g. `JMP`, `CALL`, ...)
*/
ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_REL,
/**
* This function is invoked to print a memory displacement value.
*
* If the memory displacement contains an address and a runtime-address different to
* `ZYDIS_RUNTIME_ADDRESS_NONE` was passed, `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS` is called
* instead.
*/
ZYDIS_FORMATTER_FUNC_PRINT_DISP,
/**
* This function is invoked to print an immediate value.
*
* If the immediate contains an address and a runtime-address different to
* `ZYDIS_RUNTIME_ADDRESS_NONE` was passed, `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS` is called
* instead.
*
* If the immediate contains an address and `ZYDIS_RUNTIME_ADDRESS_NONE` was passed as
* runtime-address, `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_REL` is called instead.
*/
ZYDIS_FORMATTER_FUNC_PRINT_IMM,
/* ---------------------------------------------------------------------------------------- */
/* Optional tokens */
/* ---------------------------------------------------------------------------------------- */
/**
* This function is invoked to print the size of a memory operand (`INTEL` only).
*/
ZYDIS_FORMATTER_FUNC_PRINT_TYPECAST,
/**
* This function is invoked to print the segment-register of a memory operand.
*/
ZYDIS_FORMATTER_FUNC_PRINT_SEGMENT,
/**
* This function is invoked to print the instruction prefixes.
*/
ZYDIS_FORMATTER_FUNC_PRINT_PREFIXES,
/**
* This function is invoked after formatting an operand to print a `EVEX`/`MVEX`
* decorator.
*/
ZYDIS_FORMATTER_FUNC_PRINT_DECORATOR,
/* ---------------------------------------------------------------------------------------- */
/**
* Maximum value of this enum.
*/
ZYDIS_FORMATTER_FUNC_MAX_VALUE = ZYDIS_FORMATTER_FUNC_PRINT_DECORATOR,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_FORMATTER_FUNC_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_FORMATTER_FUNC_MAX_VALUE)
} ZydisFormatterFunction;
/* ---------------------------------------------------------------------------------------------- */
/* Decorator types */
/* ---------------------------------------------------------------------------------------------- */
/**
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* Enum of all decorator types.
*/
typedef enum ZydisDecorator_
{
ZYDIS_DECORATOR_INVALID,
/**
* The embedded-mask decorator.
*/
ZYDIS_DECORATOR_MASK,
/**
* The broadcast decorator.
*/
ZYDIS_DECORATOR_BC,
/**
* The rounding-control decorator.
*/
ZYDIS_DECORATOR_RC,
/**
* The suppress-all-exceptions decorator.
*/
ZYDIS_DECORATOR_SAE,
/**
* The register-swizzle decorator.
*/
ZYDIS_DECORATOR_SWIZZLE,
/**
* The conversion decorator.
*/
ZYDIS_DECORATOR_CONVERSION,
/**
* The eviction-hint decorator.
*/
ZYDIS_DECORATOR_EH,
/**
* Maximum value of this enum.
*/
ZYDIS_DECORATOR_MAX_VALUE = ZYDIS_DECORATOR_EH,
/**
* The minimum number of bits required to represent all values of this enum.
*/
ZYDIS_DECORATOR_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_DECORATOR_MAX_VALUE)
} ZydisDecorator;
/* ---------------------------------------------------------------------------------------------- */
/* Formatter context */
/* ---------------------------------------------------------------------------------------------- */
typedef struct ZydisFormatter_ ZydisFormatter;
/**
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* Context structure that that is passed to all formatter.
*/
typedef struct ZydisFormatterContext_
{
/**
* A pointer to the `ZydisDecodedInstruction` struct.
*/
const ZydisDecodedInstruction* instruction;
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
/**
* A pointer to the first `ZydisDecodedOperand` struct of the instruction.
*/
const ZydisDecodedOperand* operands;
/**
* A pointer to the `ZydisDecodedOperand` struct.
*/
const ZydisDecodedOperand* operand;
/**
* The runtime address of the instruction.
*/
ZyanU64 runtime_address;
/**
* A pointer to user-defined data.
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
*
* This is the value that was previously passed as the `user_data` argument to
* @ref ZydisFormatterFormatInstruction or @ref ZydisFormatterTokenizeOperand.
*/
void* user_data;
} ZydisFormatterContext;
/* ---------------------------------------------------------------------------------------------- */
/* Function prototypes */
/* ---------------------------------------------------------------------------------------------- */
/**
* Defines the `ZydisFormatterFunc` function prototype.
*
* @param formatter A pointer to the `ZydisFormatter` instance.
* @param buffer A pointer to the `ZydisFormatterBuffer` struct.
* @param context A pointer to the `ZydisFormatterContext` struct.
*
* @return A zyan status code.
*
* Returning a status code other than `ZYAN_STATUS_SUCCESS` will immediately cause the formatting
* process to fail (see exceptions below).
*
* Returning `ZYDIS_STATUS_SKIP_TOKEN` is valid for functions of the following types and will
* instruct the formatter to omit the whole operand:
* - `ZYDIS_FORMATTER_FUNC_PRE_OPERAND`
* - `ZYDIS_FORMATTER_FUNC_POST_OPERAND`
* - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REG`
* - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEM`
* - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTR`
* - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM`
*
* This function prototype is used by functions of the following types:
* - `ZYDIS_FORMATTER_FUNC_PRE_INSTRUCTION`
* - `ZYDIS_FORMATTER_FUNC_POST_INSTRUCTION`
* - `ZYDIS_FORMATTER_FUNC_PRE_OPERAND`
* - `ZYDIS_FORMATTER_FUNC_POST_OPERAND`
* - `ZYDIS_FORMATTER_FUNC_FORMAT_INSTRUCTION`
* - `ZYDIS_FORMATTER_FUNC_PRINT_MNEMONIC`
* - `ZYDIS_FORMATTER_FUNC_PRINT_PREFIXES`
* - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REG`
* - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEM`
* - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTR`
* - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM`
* - `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS`
* - `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_REL`
* - `ZYDIS_FORMATTER_FUNC_PRINT_DISP`
* - `ZYDIS_FORMATTER_FUNC_PRINT_IMM`
* - `ZYDIS_FORMATTER_FUNC_PRINT_TYPECAST`
* - `ZYDIS_FORMATTER_FUNC_PRINT_SEGMENT`
*/
typedef ZyanStatus (*ZydisFormatterFunc)(const ZydisFormatter* formatter,
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
/**
* Defines the `ZydisFormatterRegisterFunc` function prototype.
*
* @param formatter A pointer to the `ZydisFormatter` instance.
* @param buffer A pointer to the `ZydisFormatterBuffer` struct.
* @param context A pointer to the `ZydisFormatterContext` struct.
* @param reg The register.
*
* @return Returning a status code other than `ZYAN_STATUS_SUCCESS` will immediately cause the
* formatting process to fail.
*
* This function prototype is used by functions of the following types:
* - `ZYDIS_FORMATTER_FUNC_PRINT_REGISTER`.
*/
typedef ZyanStatus (*ZydisFormatterRegisterFunc)(const ZydisFormatter* formatter,
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context, ZydisRegister reg);
/**
* Defines the `ZydisFormatterDecoratorFunc` function prototype.
*
* @param formatter A pointer to the `ZydisFormatter` instance.
* @param buffer A pointer to the `ZydisFormatterBuffer` struct.
* @param context A pointer to the `ZydisFormatterContext` struct.
* @param decorator The decorator type.
*
* @return Returning a status code other than `ZYAN_STATUS_SUCCESS` will immediately cause the
* formatting process to fail.
*
* This function type is used for:
* - `ZYDIS_FORMATTER_FUNC_PRINT_DECORATOR`
*/
typedef ZyanStatus (*ZydisFormatterDecoratorFunc)(const ZydisFormatter* formatter,
ZydisFormatterBuffer* buffer, ZydisFormatterContext* context, ZydisDecorator decorator);
/* ---------------------------------------------------------------------------------------------- */
/* Formatter struct */
/* ---------------------------------------------------------------------------------------------- */
/**
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* 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.
*
* Do NOT change the order of the function fields or the values of the `ZydisFormatterFunction`
* enum.
*/
struct ZydisFormatter_
{
/**
* The formatter style.
*/
ZydisFormatterStyle style;
/**
* The `ZYDIS_FORMATTER_PROP_FORCE_SIZE` property.
*/
ZyanBool force_memory_size;
/**
* The `ZYDIS_FORMATTER_PROP_FORCE_SEGMENT` property.
*/
ZyanBool force_memory_segment;
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
/**
* The `ZYDIS_FORMATTER_PROP_FORCE_SCALE_ONE` property.
*/
ZyanBool force_memory_scale;
/**
* The `ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_BRANCHES` property.
*/
ZyanBool force_relative_branches;
/**
* The `ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_RIPREL` property.
*/
ZyanBool force_relative_riprel;
/**
* The `ZYDIS_FORMATTER_PROP_PRINT_BRANCH_SIZE` property.
*/
ZyanBool print_branch_size;
/**
* The `ZYDIS_FORMATTER_DETAILED_PREFIXES` property.
*/
ZyanBool detailed_prefixes;
/**
* The `ZYDIS_FORMATTER_ADDR_BASE` property.
*/
ZydisNumericBase addr_base;
/**
* The `ZYDIS_FORMATTER_ADDR_SIGNEDNESS` property.
*/
ZydisSignedness addr_signedness;
/**
* The `ZYDIS_FORMATTER_ADDR_PADDING_ABSOLUTE` property.
*/
ZydisPadding addr_padding_absolute;
/**
* The `ZYDIS_FORMATTER_ADDR_PADDING_RELATIVE` property.
*/
ZydisPadding addr_padding_relative;
/**
* The `ZYDIS_FORMATTER_DISP_BASE` property.
*/
ZydisNumericBase disp_base;
/**
* The `ZYDIS_FORMATTER_DISP_SIGNEDNESS` property.
*/
ZydisSignedness disp_signedness;
/**
* The `ZYDIS_FORMATTER_DISP_PADDING` property.
*/
ZydisPadding disp_padding;
/**
* The `ZYDIS_FORMATTER_IMM_BASE` property.
*/
ZydisNumericBase imm_base;
/**
* The `ZYDIS_FORMATTER_IMM_SIGNEDNESS` property.
*/
ZydisSignedness imm_signedness;
/**
* The `ZYDIS_FORMATTER_IMM_PADDING` property.
*/
ZydisPadding imm_padding;
/**
* The `ZYDIS_FORMATTER_UPPERCASE_PREFIXES` property.
*/
ZyanI32 case_prefixes;
/**
* The `ZYDIS_FORMATTER_UPPERCASE_MNEMONIC` property.
*/
ZyanI32 case_mnemonic;
/**
* The `ZYDIS_FORMATTER_UPPERCASE_REGISTERS` property.
*/
ZyanI32 case_registers;
/**
* The `ZYDIS_FORMATTER_UPPERCASE_TYPECASTS` property.
*/
ZyanI32 case_typecasts;
/**
* The `ZYDIS_FORMATTER_UPPERCASE_DECORATORS` property.
*/
ZyanI32 case_decorators;
/**
* The `ZYDIS_FORMATTER_HEX_UPPERCASE` property.
*/
ZyanBool hex_uppercase;
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
/**
* The `ZYDIS_FORMATTER_HEX_FORCE_LEADING_NUMBER` property.
*/
ZyanBool hex_force_leading_number;
/**
* The number formats for all numeric bases.
*
* Index 0 = prefix
* Index 1 = suffix
*/
struct
{
/**
* A pointer to the `ZyanStringView` to use as prefix/suffix.
*/
const ZyanStringView* string;
/**
* The `ZyanStringView` to use as prefix/suffix
*/
ZyanStringView string_data;
/**
* The actual string data.
*/
char buffer[11];
} number_format[ZYDIS_NUMERIC_BASE_MAX_VALUE + 1][2];
/**
* The `ZYDIS_FORMATTER_FUNC_PRE_INSTRUCTION` function.
*/
ZydisFormatterFunc func_pre_instruction;
/**
* The `ZYDIS_FORMATTER_FUNC_POST_INSTRUCTION` function.
*/
ZydisFormatterFunc func_post_instruction;
/**
* The `ZYDIS_FORMATTER_FUNC_FORMAT_INSTRUCTION` function.
*/
ZydisFormatterFunc func_format_instruction;
/**
* The `ZYDIS_FORMATTER_FUNC_PRE_OPERAND` function.
*/
ZydisFormatterFunc func_pre_operand;
/**
* The `ZYDIS_FORMATTER_FUNC_POST_OPERAND` function.
*/
ZydisFormatterFunc func_post_operand;
/**
* The `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REG` function.
*/
ZydisFormatterFunc func_format_operand_reg;
/**
* The `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEM` function.
*/
ZydisFormatterFunc func_format_operand_mem;
/**
* The `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTR` function.
*/
ZydisFormatterFunc func_format_operand_ptr;
/**
* The `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM` function.
*/
ZydisFormatterFunc func_format_operand_imm;
/**
* The `ZYDIS_FORMATTER_FUNC_PRINT_MNEMONIC function.
*/
ZydisFormatterFunc func_print_mnemonic;
/**
* The `ZYDIS_FORMATTER_FUNC_PRINT_REGISTER` function.
*/
ZydisFormatterRegisterFunc func_print_register;
/**
* The `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS` function.
*/
ZydisFormatterFunc func_print_address_abs;
/**
* The `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_REL` function.
*/
ZydisFormatterFunc func_print_address_rel;
/**
* The `ZYDIS_FORMATTER_FUNC_PRINT_DISP` function.
*/
ZydisFormatterFunc func_print_disp;
/**
* The `ZYDIS_FORMATTER_FUNC_PRINT_IMM` function.
*/
ZydisFormatterFunc func_print_imm;
/**
* The `ZYDIS_FORMATTER_FUNC_PRINT_TYPECAST` function.
*/
ZydisFormatterFunc func_print_typecast;
/**
* The `ZYDIS_FORMATTER_FUNC_PRINT_SEGMENT` function.
*/
ZydisFormatterFunc func_print_segment;
/**
* The `ZYDIS_FORMATTER_FUNC_PRINT_PREFIXES` function.
*/
ZydisFormatterFunc func_print_prefixes;
/**
* The `ZYDIS_FORMATTER_FUNC_PRINT_DECORATOR` function.
*/
ZydisFormatterDecoratorFunc func_print_decorator;
};
/* ---------------------------------------------------------------------------------------------- */
/* ============================================================================================== */
/* Exported functions */
/* ============================================================================================== */
/**
* @addtogroup formatter Formatter
* Functions allowing formatting of previously decoded instructions to human readable text.
* @{
*/
/* ---------------------------------------------------------------------------------------------- */
/* Initialization */
/* ---------------------------------------------------------------------------------------------- */
/**
* Initializes the given `ZydisFormatter` instance.
*
* @param formatter A pointer to the `ZydisFormatter` instance.
* @param style The base formatter style (either `AT&T` or `Intel` style).
*
* @return A zyan status code.
*/
ZYDIS_EXPORT ZyanStatus ZydisFormatterInit(ZydisFormatter* formatter, ZydisFormatterStyle style);
/* ---------------------------------------------------------------------------------------------- */
/* Setter */
/* ---------------------------------------------------------------------------------------------- */
/**
* Changes the value of the specified formatter `property`.
*
* @param formatter A pointer to the `ZydisFormatter` instance.
* @param property The id of the formatter-property.
* @param value The new value.
*
* @return A zyan status code.
*
* This function returns `ZYAN_STATUS_INVALID_OPERATION` if a property can't be changed for the
* current formatter-style.
*/
ZYDIS_EXPORT ZyanStatus ZydisFormatterSetProperty(ZydisFormatter* formatter,
ZydisFormatterProperty property, ZyanUPointer value);
/**
* Replaces a formatter function with a custom callback and/or retrieves the currently
* used function.
*
* @param formatter A pointer to the `ZydisFormatter` instance.
* @param type The formatter function-type.
* @param callback A pointer to a variable that contains the pointer of the callback function
* and receives the pointer of the currently used function.
*
* @return A zyan status code.
*
* Call this function with `callback` pointing to a `ZYAN_NULL` value to retrieve the currently
* used function without replacing it.
*
* This function returns `ZYAN_STATUS_INVALID_OPERATION` if a function can't be replaced for the
* current formatter-style.
*/
ZYDIS_EXPORT ZyanStatus ZydisFormatterSetHook(ZydisFormatter* formatter,
ZydisFormatterFunction type, const void** callback);
/* ---------------------------------------------------------------------------------------------- */
/* Formatting */
/* ---------------------------------------------------------------------------------------------- */
/**
* 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.
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* @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
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* callbacks. Can be `ZYAN_NULL`.
*
* @return A zyan status code.
*/
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
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.
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* @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
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* callbacks. Can be `ZYAN_NULL`.
*
* @return A zyan status code.
*
* Use `ZydisFormatterFormatInstruction` or `ZydisFormatterFormatInstructionEx` to format a
* complete instruction.
*/
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatOperand(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand,
char* buffer, ZyanUSize length, ZyanU64 runtime_address, void* user_data);
/* ---------------------------------------------------------------------------------------------- */
/* Tokenizing */
/* ---------------------------------------------------------------------------------------------- */
/**
* 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.
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* @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
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* callbacks. Can be `ZYAN_NULL`.
*
* @return A zyan status code.
*/
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeInstruction(const ZydisFormatter* formatter,
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.
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* @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
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* callbacks. Can be `ZYAN_NULL`.
*
* @return A zyan status code.
*
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
* Use `ZydisFormatterTokenizeInstruction` to tokenize a complete instruction.
*/
Squashed 'externals/zydis/' changes from 25193db0..1ba75aee 1ba75aee Disassembler: fix argument type `usize` -> `u64` de4cbcdb MSVC project updates (#400) e32757cd CMake: Enable `CMAKE_MSVC_RUNTIME_LIBRARY` (MSVC) 325e5e00 CI: fix Doxyfile being used 3ad3d7fc CI: inject Doxygen CSS theme a1dd0652 Doc: remove CSS theme from Zydis repository cc4f22cb Makefile: fix doc target name 83d2afa9 Update zycore to v1.4.0 53dd0880 Match parameter name for documentation 64028db9 Allow doxygen generation to be disabled 4bb3c83f Fixed ISA sets (Fixes #389) 2a9f9c66 Decoder: change error code for `NULL` `buffer` arguments 807af687 Examples: adjust to `ZydisDecoderDecodeFull` changes 71fe85a7 Tools: adjust to `ZydisDecoderDecodeFull` changes 59135031 Decoder: simplify `ZydisDecoderDecodeFull` API e5e52676 Makefile: fix `test` recipe bcb0a361 CMake: rename target `doc` -> `ZydisDoc` 3208f041 Add support for ppc(64) and riscv64 (#383) 0002161e Deps: update zycore to v1.3.0 e0fc2a92 CMake: simplify example build rules 2221bce3 README: switch decoder example to simplified version 392aa410 Examples: add `@file` comment to `Disassemble` example cff56e42 Examples: add `DisassembleSimple` 246d471b Disassemble: add function for decoding and formatting in one step 109d08ba build(make): use new doc target ebf95079 build: add doc target df277052 Fixed kernel build (WDK detection) daf7c62d Decoder: unnest all structs in `ZydisDecodedInstruction` 89cba0c2 Formatter: provide more meaningful documentation for types f8344423 Doc: remove misspelled `@brief` 6cbdb04a Doc: update `Doxyfile` config to latest version 67e15cf0 Doc: fix group references f6dfdbd2 Added `ZydisEncoderNopFill` 404e50b5 Doc: group important macros and refer to them c6141110 CI: clone doxygen theme prior to building doc 9d6c82a3 CI: add automated documentation builds f8866275 Formatter: add missing newline at end of file 2a06d5e5 Decoder: add missing `ZYAN_FALLTHROUGH` b83a3923 CI: enable development mode for all CI builds eca25034 CI: switch to an include-only way of defining the build matrix dd271e90 README: update CI badge URL 90d54ee8 Fix sign compare warnings on clang-cl e66c7010 CI: shorten name prefix 91f9d4ea CI: improved build name generation 14800b6f CI: add ClangCL build on Windows 55b23387 CI: consistently use default-init for empty vars 6c39010e CI: generalize `dev_mode` variable to `cmake_flags` 3160753d Formatter: make `operand_count` check less strict 9b9b72c9 README: include examples via permalinks adb1a85b Examples: add README encoder example to build 0897c271 Doc: switch Doxygen theme 9cb54996 Examples: add README examples to build a762cd6a README: fix example code 503e064c Fixed compiler warnings 091016bd Update workflow f29de7d8 Added tests for encoding in absolute address mode 355ce7e3 Added function to calculate and encode relative operands 73a44921 Updating ZyCore 9413c809 Doc: clarify that `user_data` can be `NULL` f0f44096 Simplify porting guide `Formatter` section 9ba7e55a Combine `ZydisFormatterTokenizeOperand` with `Ex` variant 35ea249d Combine `ZydisFormatterTokenizeInstruction` with `Ex` variant 01dddb93 Combine `ZydisFormatterFormatOperand` and `Ex` variant abcacbcb Combine `ZydisFormatterFormatInstruction` and `Ex` variant 871c40c5 Clean up `.gitignore` file a941e961 Doc: update porting guide e973b3ec MSVC: add `Segment.{h,c}` to projects dbaec910 Build: make segment API an optional feature cd508f3b Utils: split segment API into separate files 2677d5a2 Add Makefile for quick access to various operations 83eddf40 Decoder: fix name confusion (context vs state) e46660c7 Decoder: make placement of parentheses consistent cc9ff174 Fix build without `ZYDIS_FEATURE_ENCODER` 9b882913 Revert default operand-size to 32-bit for `MOVMSKPS/D` 73d7dbb3 Improved signedness data accuracy and consistency (Fixes #327) f46e3e9d Update zasm URL 2ed04d0c Decoder: add `raw.rex` to union dd6235c5 Duplicate encoding to aid Rust bindings c8b5b75d Always initialize `instruction->cpu_flags/fpu_flags` 9392f010 Extend porting guide (#338) 14453b30 Encoder: consistent constant naming (#339) 95329939 Avoid passing variable size to memcpy to prevent external call (#337) f0f0664a Encoder: improve `ZydisArePrefixesCompatible` perf (#334) 7f83c416 Improve LTO support (#333) 70085c71 Encoder: make all internal functions `static` 1581029c Change `st0` operand visibility as specified by SDM 81fae568 Update regression tests for `st0` visibility changes 6d83a277 Declare structs as anonymous within anonymous unions (#329) f146fd18 Apply consistent encodings to existing files cdbf379a Enforce consistent encoding and line endings 0cf3c960 Disable C11 feature warnings in Windows kernel example 6afe1d80 Update Zycore submodule 580cbfe6 Add unions in decoded instruction and operands e14a0789 Fix `vcpkg` install instructions 3f5a3ad8 Cleanup zydis include c0e80e79 Fixed error codes inside `ZydisDecoderDecodeFull` 770c3203 Fix incorrect register definition 0a45c474 Change default operand size for `MOVMSKPS/D` to 64-bit 91742f41 Fixed hidden operand scaling regression (Fixes #309) b44ec347 Remove LuaJIT bindings link 4f232ebf Fixed edge case for hidden operand scaling (Fixes #296) 562a7c1e Fixed newlines on Windows (amalgamation) 79c759ed Fixed signedness compilation warning (MSVC x86) 3092818a Fixed defines in MSVC projects 124571c5 Improve CMake file 69636284 Add amalgamated CI build d866d2e4 Rename STR_REGISTER -> STR_REGISTERS bd392018 Add script for creating amalgamated distributions 311fb0b4 Prevent duplicate CI builds 9770c41d Get rid of ZydisExportConfig.h cbc23017 Update zycore submodule e34e6b97 Remove register lookup special cases a5fb0d09 Fix `MASM` style disassembly (#298) 9fc98de2 Point to zasm for an assembler front-end 4756724a Ignore `.b` for `modrm.rm` encoded mask registers 198fee5d Improved prefix handling a8e43f84 Fixed `MVEX.EH` special cases ecb7e060 Reworked encoding of branching instructions (Fixes #268, Fixes #266) 38aba0fc Improve `ZydisInfo` 0d650daf Fixed decoder example 49005dd8 Add lookup tables for `ZydisRegister` and `ZydisRegisterClass` (#283) c804b8f6 Refactored operand count checks 979f0bea Update porting guide 875c8a75 Decouple operand decoding 5df1b68e Minor refactoring 66e81ebe Add WebAssembly support (#277) 33c5bccf Refactor operand constraints handling b5a92f4e Fixed constraint enforcement for AMX instructions db2c1633 Add regression tests for recent bugs (#275) 17896d72 Add a minimal mode build to CI (#274) 84dfb487 Fix register constraints of certain `AMX` instructions 4581fe30 Fixed build in minimal mode (#273) 70d6bda3 Make test scripts executable 93b503da Add encoder tests to CI (#272) 4f38dd50 Auto-generated `zydis_encoder_types.py` 69884f0e Fix constraints of certain `AMX` instructions 92dffbf2 Correctly set `is_gather` for MVEX instructions 23b499a7 Enforce MVEX constraints 7b981a6f Enforce constraints for gather instructions (Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=41044) 4f4dade2 Move fuzzing corpus out of the repository d835ac30 docs: add man pages (#267) f2429819 Update version-bump-checklist.txt 7d6ee06e Remove legacy code and general cleanup (#262) 162ef4ef Fix various warnings ocurring in pedantic mode 4189d830 Move static asserts to global scope 9fab1a82 `ZydisEncodablePrefix`/`ZydisEncoderInstructionAttribute` -> `ZYDIS_ATTRIB_*` 9f569b7c Size-optimal outputs, bug fixes, FuzzEncoder improvements, misc tooling improvements 1e8e1702 Added regression test suite for encoder 4634cc22 Update `examples/README.md` 043b2cc3 Added separate projects for fuzz targets 0faa2346 Add porting guide 248bc1fc Move instruction attributes into `SharedTypes.h` 4e0cb756 Fix attribute definitions ecb1286f Add example for rewriting instructions 606e361c Fix unaligned pointer write 3707e70f Rebase attribute flags and add `ZYDIS_ATTRIB_HAS_EVEX_B` 8a452a32 Prefer stdlib functions in example 46cd3e02 Documentation improvements fbcfc5d9 Improve encoder example and cleanup README edcac7b3 Extend example to execute the generated code 2a8eb8e2 Add simple encoding example d3b5e241 Fixed compiler warning 76fdffac Added operand masks for enhanced performance cd6a49e9 Implemented instruction encoder (Closes #129) 29bb0163 Don't pack ZydisShortString on Darwin (#259) 55dd08c2 Fix struct initialization in formatter 554efeb7 Update example code in README.md 869dfb42 Remove ZydisPE 6ae9f61b Create SECURITY.md 077b1851 Fix merge conflict 99a22d85 Fix general address-width handling ab535b1a build(cmake): add option to use system installed Zycore 746faa45 Bump version to v3.2 c3720691 Merged some definitions (TBM instructions) 12b4c46f chore: update zycore submodule 6423f083 build(cmake): add version and soversion to the library 2666f80c Update zycore submodule 4a3f25be build(cmake): fix PUBLIC include dir of installed lib c5f5bcf3 Set `ZYDIS_ATTRIB_ACCEPTS_SEGMENT` for non legacy instructions 795f555b Fix `ECX` scaling for `pcmpestri`/`vpcmpestri`/`pcmpistri`/`vpcmpistri` 3737fcbd Fixed segment override handling (Fixes #231) db796058 Fixed FP16 HV broadcasts (Fixes #243) e5764446 Fixed no_source_dest_match check (Fixes #241) 683bf85c Change branch-type from `short` -> `near` for `jkzd`/`jknzd` c462f63a Scale base register of implicit `SP`/`BP` memory operands by stack- instead of address-size e4931747 Do not sign ZydisWinKernel sample 5c193ca3 Ignore segment override for `BNDC{L|N|U}` f30efaf0 Add mission exception class strings to `ZydisInfo` 82a42657 Rebase tests e38110a4 Add missing `notrack` strings to `ZydisInfo` c95307b3 Do not drop `const` modifier 8ac69395 Fixed {sae}/{rc} formatting (Fixes #232) 80d8d523 Fixed issues with enum signedness 5503f8b0 Fuzzing: validate enum ranges 49a087f9 Fixed MVEX rounding mode decoding (Fixes #226) (#227) 60bc090a Rebase tests 4c7ec7fb Replace wrong eviction hint formatter-string 45ad14c6 Add missing register string 2613f262 Fixed Load-op SwizzUpConv(F32) (Fixes #224) 412a3c8e Add support for `no_compat_mode` flag 255513a6 Fix `T1F` handling for 16-bit elements e57da244 Fix element-size for new `QUARTER` tuple-type d36c77f2 Improve malformed `EVEX` conditions 5ec77520 Update MSVC project files 80a99de0 Fix `EVEX` map for certain `AVX-512 FP16` instructions ac3d45b4 Add `MSBuild` build to CI 1588ad23 Update and clean up CI config b622e814 Update zycore submodule 7fc3a946 Fix decoding/formatting of certain `AVX-512 FP16` instructions e6a72bbf Update copyright year 841bd7ca Update zycore submodule 61731ae2 Fix formatting of offset for `PTR` operands (should be unsigned) ad7ddc2c Add `AVX-512 FP16` isa-set (#214) 861187e2 Use lowercase `windows.h` in examples e5758caa Add multiple new ISA extensions 984e0c1d `XOP`/`VEX`/`EVEX` is invalid in 16-bit real mode 58662bf5 Fixed CET/VMX decoding in real mode (Fixes #211) 4c846ec9 Add formatter option to control printing of scale `*1` e994083e Print asterisk in front of absolute `jmp`/`call` address (AT&T) (#207) 2ab6a5cc Improve multiple instruction definitions 179441f3 Add support for `CET` `no-track` prefix (#204) e3fc6790 Ignore segment override for certain operands (#203) 68ad2460 Document xbegin special case 805a88f8 Improved handling of 16-bit relative operands (Fixes #198) cbf808a7 Removed impossible jcxz/jrcxz encodings (Fixes #196) 8080ae55 Fix cmake config files (#191) fe8f1bfd Enhanced formatting for MIB operands efd9c446 Fixes #192 (#193) 6a17c485 Update `Zycore` submodule git-subtree-dir: externals/zydis git-subtree-split: 1ba75aeefae37094c7be8eba07ff81d4fe0f1f20
2022-11-20 21:52:09 +01:00
ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeOperand(const ZydisFormatter* formatter,
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operand,
void* buffer, ZyanUSize length, ZyanU64 runtime_address, ZydisFormatterTokenConst** token,
void* user_data);
/* ---------------------------------------------------------------------------------------------- */
/**
* @}
*/
/* ============================================================================================== */
#ifdef __cplusplus
}
#endif
#endif /* ZYDIS_FORMATTER_H */