mirror of
https://github.com/open-goal/jak-project
synced 2026-09-04 10:41:44 -04:00
deps: update zydis and json.hpp to silence various warnings (#4136)
Zydis has been complaining about cmake deprecation, and json.hpp has been causing tons of warnings to be spewed in the builds. Update both.
This commit is contained in:
+6
-7
@@ -181,16 +181,15 @@ endif()
|
||||
|
||||
function(build_third_party_lib dir_name target_name)
|
||||
add_subdirectory(third-party/${dir_name} EXCLUDE_FROM_ALL)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
# For Microsoft Visual C++ Compiler (MSVC)
|
||||
target_compile_options(${target_name} PRIVATE /w)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
# For GNU Compiler Collection (GCC) or Clang
|
||||
target_compile_options(${target_name} PRIVATE -w)
|
||||
# Convert all public include dirs to SYSTEM
|
||||
get_target_property(INCLUDES ${target_name} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
if(INCLUDES)
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${INCLUDES}"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
# Dependencies and Libraries
|
||||
# includes relative to top level jak-project folder
|
||||
include_directories(./)
|
||||
|
||||
+3098
-1864
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -1,6 +1,6 @@
|
||||
*.inc eol=lf encoding=utf-8 linguist-language=C
|
||||
*.inc eol=lf encoding=utf-8 linguist-language=C linguist-generated=true
|
||||
*.h eof=lf encoding=utf-8
|
||||
*.c eof=lf encoding=utf-8
|
||||
*.py eof=lf encoding=utf-8
|
||||
*.md eof=lf encoding=utf-8
|
||||
|
||||
*.json eof=lf encoding=utf-8
|
||||
|
||||
+63
-10
@@ -11,14 +11,13 @@ jobs:
|
||||
name: >-
|
||||
CMake build + tests (${{ matrix.image_name }} ${{ matrix.cmake_flags }})
|
||||
runs-on: ${{ matrix.image_name }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# Do a regular and a no-libc build for each platform.
|
||||
- image_name: macOS-latest
|
||||
- image_name: macOS-latest
|
||||
- image_name: macos-latest
|
||||
- image_name: macos-latest
|
||||
cmake_flags: -DZYAN_NO_LIBC=ON
|
||||
skip_tests: yes
|
||||
- image_name: windows-2022
|
||||
@@ -39,7 +38,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with: { submodules: recursive }
|
||||
- name: Configuring
|
||||
run: |
|
||||
@@ -53,31 +52,85 @@ jobs:
|
||||
cd build
|
||||
ctest -C Release --output-on-failure
|
||||
|
||||
meson-build-and-tests:
|
||||
name: >-
|
||||
Meson build + tests (${{ matrix.platform }}, ${{ matrix.flavor }} ${{ matrix.mode.name }})
|
||||
runs-on: ${{ matrix.platform }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor:
|
||||
- debug
|
||||
- release
|
||||
mode:
|
||||
- { name: default, args: -Dtests=enabled }
|
||||
- { name: NO_LIBC, args: -Dnolibc=true }
|
||||
platform:
|
||||
- macos-latest
|
||||
- windows-2022
|
||||
- ubuntu-22.04
|
||||
extra_envs:
|
||||
- {}
|
||||
include:
|
||||
# Do a few more specialized configurations.
|
||||
- platform: ubuntu-22.04
|
||||
mode:
|
||||
name: minimal
|
||||
args: -Dminimal=enabled -Ddecoder=enabled -Davx512=enabled -Dknc=enabled -Dsegment=enabled -Dtests=enabled
|
||||
extra_envs: {}
|
||||
flavor: minsize
|
||||
exclude:
|
||||
- platform: macos-latest
|
||||
mode: { name: NO_LIBC, args: -Dnolibc=true }
|
||||
|
||||
steps:
|
||||
- name: Setup meson
|
||||
run: |
|
||||
pipx install meson ninja
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with: { submodules: recursive }
|
||||
- name: Activate MSVC and Configure
|
||||
if: ${{ matrix.platform == 'windows-2022' }}
|
||||
env: ${{ matrix.extra_envs }}
|
||||
run: |
|
||||
meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }} --vsenv
|
||||
- name: Configuring
|
||||
if: ${{ matrix.platform != 'windows-2022' }}
|
||||
run: |
|
||||
meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }}
|
||||
- name: Building
|
||||
run: |
|
||||
meson compile -C build-${{ matrix.flavor }}
|
||||
- name: Running tests
|
||||
run: |
|
||||
meson test -C build-${{ matrix.flavor }}
|
||||
|
||||
msbuild-build:
|
||||
name: MSBuild build (windows-2022)
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with: { submodules: recursive }
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1.1.3
|
||||
with: { vs-version: '[17,]' }
|
||||
with: { vs-version: "[17,]" }
|
||||
- name: Build user-mode
|
||||
run: |
|
||||
cd msvc
|
||||
msbuild.exe Zydis.sln /m /t:Rebuild '/p:Configuration="Release MD";Platform=X64'
|
||||
msbuild.exe Zydis.sln /m /t:Rebuild /p:Configuration="Release MD" /p:Platform=X64
|
||||
- name: Build kernel-mode
|
||||
run: |
|
||||
cd msvc
|
||||
msbuild.exe Zydis.sln /m /t:Rebuild '/p:Configuration="Release Kernel";Platform=X64'
|
||||
msbuild.exe Zydis.sln /m /t:Rebuild /p:Configuration="Release Kernel" /p:Platform=X64
|
||||
|
||||
amalgamated:
|
||||
name: Amalgamated build (Ubuntu 22.04)
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with: { submodules: recursive }
|
||||
- name: Amalgamating sources
|
||||
run: |
|
||||
@@ -109,7 +162,7 @@ jobs:
|
||||
dry-run: false
|
||||
sanitizer: ${{ matrix.sanitizer }}
|
||||
- name: Upload Crash
|
||||
uses: actions/upload-artifact@v1
|
||||
uses: actions/upload-artifact@v4
|
||||
if: failure() && steps.build.outcome == 'success'
|
||||
with:
|
||||
name: ${{ matrix.sanitizer }}-artifacts
|
||||
|
||||
+3
@@ -11,3 +11,6 @@ __pycache__
|
||||
/doc
|
||||
/cmake-build-debug
|
||||
/amalgamated-dist
|
||||
|
||||
.cache
|
||||
compile_commands.json
|
||||
|
||||
+30
-32
@@ -1,11 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
|
||||
# Enable runtime library selection via CMAKE_MSVC_RUNTIME_LIBRARY
|
||||
cmake_policy(SET CMP0091 NEW)
|
||||
endif ()
|
||||
|
||||
project(Zydis VERSION 4.0.0.0 LANGUAGES C)
|
||||
project(Zydis VERSION 5.0.0.0 LANGUAGES C)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(CMakePackageConfigHelpers)
|
||||
@@ -134,7 +134,7 @@ function (locate_zycore)
|
||||
" git submodule update --init\n"
|
||||
"or by cloning using\n"
|
||||
" git clone --recursive <url>\n"
|
||||
"Alternatively, you can manually clone zycore to some path and set ZYDIS_ZYCORE_PATH."
|
||||
"Alternatively, you can manually clone zycore to some path and set ZYAN_ZYCORE_PATH."
|
||||
)
|
||||
endfunction ()
|
||||
|
||||
@@ -144,14 +144,28 @@ locate_zycore()
|
||||
# Library configuration #
|
||||
# =============================================================================================== #
|
||||
|
||||
function (_maybe_set_fuzzer_cfg target)
|
||||
if (ZYDIS_FUZZ_AFL_FAST)
|
||||
target_compile_definitions("${target}" PRIVATE "ZYDIS_FUZZ_AFL_FAST")
|
||||
endif ()
|
||||
if (ZYDIS_LIBFUZZER)
|
||||
target_compile_definitions("${target}" PRIVATE "ZYDIS_LIBFUZZER")
|
||||
if (MSVC)
|
||||
target_compile_options("${target}" PRIVATE "-fsanitize=fuzzer")
|
||||
target_link_libraries("${target}" PRIVATE "clang_rt.fuzzer-x86_64.lib")
|
||||
endif ()
|
||||
endif ()
|
||||
endfunction ()
|
||||
|
||||
if (ZYDIS_BUILD_SHARED_LIB)
|
||||
add_library("Zydis" SHARED)
|
||||
else ()
|
||||
add_library("Zydis" STATIC)
|
||||
target_compile_definitions("Zydis" PUBLIC "ZYDIS_STATIC_BUILD")
|
||||
endif ()
|
||||
add_library("Zydis::Zydis" ALIAS "Zydis")
|
||||
|
||||
target_link_libraries("Zydis" PUBLIC "Zycore")
|
||||
target_link_libraries("Zydis" PUBLIC "Zycore::Zycore")
|
||||
target_include_directories("Zydis"
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
@@ -165,6 +179,7 @@ set_target_properties("Zydis" PROPERTIES
|
||||
DEFINE_SYMBOL "ZYDIS_SHOULD_EXPORT")
|
||||
zyan_set_common_flags("Zydis")
|
||||
zyan_maybe_enable_wpo("Zydis")
|
||||
_maybe_set_fuzzer_cfg("Zydis")
|
||||
|
||||
if (ZYDIS_FEATURE_FORMATTER AND NOT ZYDIS_FEATURE_DECODER)
|
||||
message(
|
||||
@@ -212,7 +227,6 @@ target_sources("Zydis"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/MetaInfo.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Mnemonic.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Register.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Segment.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/SharedTypes.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/ShortString.h"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Status.h"
|
||||
@@ -223,7 +237,6 @@ target_sources("Zydis"
|
||||
"src/MetaInfo.c"
|
||||
"src/Mnemonic.c"
|
||||
"src/Register.c"
|
||||
"src/Segment.c"
|
||||
"src/SharedData.c"
|
||||
"src/String.c"
|
||||
"src/Utils.c"
|
||||
@@ -313,7 +326,7 @@ endfunction ()
|
||||
|
||||
function(_add_example target source_file sub_folder)
|
||||
add_executable("${target}" "examples/${source_file}")
|
||||
target_link_libraries("${target}" "Zydis")
|
||||
target_link_libraries("${target}" PUBLIC "Zydis")
|
||||
set_target_properties("${target}" PROPERTIES FOLDER "Examples/${sub_folder}")
|
||||
target_compile_definitions("${target}" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
||||
zyan_set_common_flags("${target}")
|
||||
@@ -337,7 +350,7 @@ if (ZYDIS_BUILD_EXAMPLES AND NOT ZYAN_NO_LIBC)
|
||||
OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
target_compile_definitions("ZydisPerfTest" PRIVATE "_GNU_SOURCE")
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries("ZydisPerfTest" Threads::Threads)
|
||||
target_link_libraries("ZydisPerfTest" PUBLIC Threads::Threads)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
@@ -358,7 +371,7 @@ if (ZYDIS_BUILD_TOOLS AND NOT ZYAN_NO_LIBC)
|
||||
"tools/ZydisDisasm.c"
|
||||
"tools/ZydisToolsShared.c"
|
||||
"tools/ZydisToolsShared.h")
|
||||
target_link_libraries("ZydisDisasm" "Zydis")
|
||||
target_link_libraries("ZydisDisasm" PUBLIC "Zydis")
|
||||
set_target_properties ("ZydisDisasm" PROPERTIES FOLDER "Tools")
|
||||
target_compile_definitions("ZydisDisasm" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
||||
zyan_set_common_flags("ZydisDisasm")
|
||||
@@ -370,7 +383,7 @@ if (ZYDIS_BUILD_TOOLS AND NOT ZYAN_NO_LIBC)
|
||||
"tools/ZydisFuzzDecoder.c"
|
||||
"tools/ZydisFuzzShared.c"
|
||||
"tools/ZydisFuzzShared.h")
|
||||
target_link_libraries("ZydisFuzzDecoder" "Zydis")
|
||||
target_link_libraries("ZydisFuzzDecoder" PUBLIC "Zydis")
|
||||
set_target_properties("ZydisFuzzDecoder" PROPERTIES FOLDER "Tools")
|
||||
target_compile_definitions("ZydisFuzzDecoder" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
||||
if (NOT ZYDIS_FEATURE_ENCODER)
|
||||
@@ -380,52 +393,37 @@ if (ZYDIS_BUILD_TOOLS AND NOT ZYAN_NO_LIBC)
|
||||
zyan_set_common_flags("ZydisFuzzDecoder")
|
||||
zyan_maybe_enable_wpo("ZydisFuzzDecoder")
|
||||
_maybe_set_emscripten_cfg("ZydisFuzzDecoder")
|
||||
if (ZYDIS_FUZZ_AFL_FAST)
|
||||
target_compile_definitions("ZydisFuzzDecoder" PRIVATE "ZYDIS_FUZZ_AFL_FAST")
|
||||
endif ()
|
||||
if (ZYDIS_LIBFUZZER)
|
||||
target_compile_definitions("ZydisFuzzDecoder" PRIVATE "ZYDIS_LIBFUZZER")
|
||||
endif ()
|
||||
_maybe_set_fuzzer_cfg("ZydisFuzzDecoder")
|
||||
|
||||
if (ZYDIS_FEATURE_ENCODER)
|
||||
add_executable("ZydisFuzzEncoder"
|
||||
"tools/ZydisFuzzEncoder.c"
|
||||
"tools/ZydisFuzzShared.c"
|
||||
"tools/ZydisFuzzShared.h")
|
||||
target_link_libraries("ZydisFuzzEncoder" "Zydis")
|
||||
target_link_libraries("ZydisFuzzEncoder" PUBLIC "Zydis")
|
||||
set_target_properties("ZydisFuzzEncoder" PROPERTIES FOLDER "Tools")
|
||||
target_compile_definitions("ZydisFuzzEncoder" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
||||
zyan_set_common_flags("ZydisFuzzEncoder")
|
||||
zyan_maybe_enable_wpo("ZydisFuzzEncoder")
|
||||
_maybe_set_emscripten_cfg("ZydisFuzzEncoder")
|
||||
if (ZYDIS_FUZZ_AFL_FAST)
|
||||
target_compile_definitions("ZydisFuzzEncoder" PRIVATE "ZYDIS_FUZZ_AFL_FAST")
|
||||
endif ()
|
||||
if (ZYDIS_LIBFUZZER)
|
||||
target_compile_definitions("ZydisFuzzEncoder" PRIVATE "ZYDIS_LIBFUZZER")
|
||||
endif ()
|
||||
_maybe_set_fuzzer_cfg("ZydisFuzzEncoder")
|
||||
|
||||
add_executable("ZydisFuzzReEncoding"
|
||||
"tools/ZydisFuzzReEncoding.c"
|
||||
"tools/ZydisFuzzShared.c"
|
||||
"tools/ZydisFuzzShared.h")
|
||||
target_link_libraries("ZydisFuzzReEncoding" "Zydis")
|
||||
target_link_libraries("ZydisFuzzReEncoding" PUBLIC "Zydis")
|
||||
set_target_properties("ZydisFuzzReEncoding" PROPERTIES FOLDER "Tools")
|
||||
target_compile_definitions("ZydisFuzzReEncoding" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
||||
zyan_set_common_flags("ZydisFuzzReEncoding")
|
||||
zyan_maybe_enable_wpo("ZydisFuzzReEncoding")
|
||||
_maybe_set_emscripten_cfg("ZydisFuzzReEncoding")
|
||||
if (ZYDIS_FUZZ_AFL_FAST)
|
||||
target_compile_definitions("ZydisFuzzReEncoding" PRIVATE "ZYDIS_FUZZ_AFL_FAST")
|
||||
endif ()
|
||||
if (ZYDIS_LIBFUZZER)
|
||||
target_compile_definitions("ZydisFuzzReEncoding" PRIVATE "ZYDIS_LIBFUZZER")
|
||||
endif ()
|
||||
_maybe_set_fuzzer_cfg("ZydisFuzzReEncoding")
|
||||
|
||||
if (NOT ZYDIS_BUILD_SHARED_LIB)
|
||||
add_executable("ZydisTestEncoderAbsolute"
|
||||
"tools/ZydisTestEncoderAbsolute.c")
|
||||
target_link_libraries("ZydisTestEncoderAbsolute" "Zydis")
|
||||
target_link_libraries("ZydisTestEncoderAbsolute" PUBLIC "Zydis")
|
||||
set_target_properties("ZydisTestEncoderAbsolute" PROPERTIES FOLDER "Tools")
|
||||
target_compile_definitions("ZydisTestEncoderAbsolute" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
||||
zyan_set_common_flags("ZydisTestEncoderAbsolute")
|
||||
@@ -438,7 +436,7 @@ if (ZYDIS_BUILD_TOOLS AND NOT ZYAN_NO_LIBC)
|
||||
"tools/ZydisInfo.c"
|
||||
"tools/ZydisToolsShared.c"
|
||||
"tools/ZydisToolsShared.h")
|
||||
target_link_libraries("ZydisInfo" "Zydis")
|
||||
target_link_libraries("ZydisInfo" PUBLIC "Zydis")
|
||||
set_target_properties ("ZydisInfo" PROPERTIES FOLDER "Tools")
|
||||
target_compile_definitions("ZydisInfo" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
||||
if (NOT ZYDIS_FEATURE_ENCODER)
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
# per line (i.e. do not split long lines with '\'), and only use '=' to set values
|
||||
|
||||
PROJECT_NAME = Zydis
|
||||
PROJECT_NUMBER = v4.0.0
|
||||
PROJECT_NUMBER = v5.0.0
|
||||
OUTPUT_DIRECTORY = ./doc
|
||||
INPUT = ./include ./README.md ./files.dox
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
@INCLUDE = "@TOP_SRCDIR@/Doxyfile"
|
||||
PROJECT_NUMBER = @VERSION@
|
||||
PROJECT_BRIEF = "Zyan Disassembler Library"
|
||||
OUTPUT_DIRECTORY = "@TOP_BUILDDIR@/doc"
|
||||
STRIP_FROM_PATH = "@TOP_SRCDIR@"
|
||||
STRIP_FROM_INC_PATH = "@ZYCORE_INCLUDE_PATH@"
|
||||
INPUT = "@TOP_SRCDIR@/include" \
|
||||
"@TOP_SRCDIR@/README.md" \
|
||||
"@TOP_SRCDIR@/files.dox"
|
||||
EXAMPLE_PATH = "@TOP_SRCDIR@/examples"
|
||||
USE_MDFILE_AS_MAINPAGE = "@TOP_SRCDIR@/README.md"
|
||||
MACRO_EXPANSION = YES
|
||||
EXPAND_ONLY_PREDEF = YES
|
||||
INCLUDE_PATH = "@ZYCORE_INCLUDE_PATH@"
|
||||
PREDEFINED = @PREDEFINED@
|
||||
EXPAND_AS_DEFINED = ZYAN_BITFIELD
|
||||
DOT_COMMON_ATTR = "fontname=\"sans-serif\",fontsize=10"
|
||||
DOT_EDGE_ATTR = "labelfontname=\"sans-serif\",labelfontsize=10"
|
||||
DOT_IMAGE_FORMAT = svg
|
||||
INTERACTIVE_SVG = YES
|
||||
HAVE_DOT = @HAVE_DOT@
|
||||
DOT_MULTI_TARGETS = @HAVE_DOT_1_8_10@
|
||||
DOT_PATH = "@DOT_PATH@"
|
||||
HTML_FORMULA_FORMAT = @HTML_FORMULA_FORMAT@
|
||||
|
||||
+6
-1
@@ -1,4 +1,4 @@
|
||||
.PHONY: build configure install amalgamate clean test doc doc-plain doc-themed
|
||||
.PHONY: build configure install amalgamate clean test doc doc-plain doc-themed clangd
|
||||
|
||||
BUILD_DIR ?= build
|
||||
CSS_DIR ?= ../doxygen-awesome-css
|
||||
@@ -29,6 +29,11 @@ test: build
|
||||
doc: configure
|
||||
cmake --build $(BUILD_DIR) --target ZydisDoc
|
||||
|
||||
clangd:
|
||||
CC=clang cmake -B $(BUILD_DIR)-clangd -DCMAKE_EXPORT_COMPILE_COMMANDS=1; \
|
||||
cmake --build $(BUILD_DIR)-clangd -j && \
|
||||
mv $(BUILD_DIR)-clangd/compile_commands.json .
|
||||
|
||||
dependencies/zycore/CMakeLists.txt:
|
||||
@if ! command -v git > /dev/null; then \
|
||||
echo >&2 -n "ERROR: git is not installed. Please either manually place all"; \
|
||||
|
||||
+3
-1
@@ -164,9 +164,11 @@ Versions follow the [semantic versioning scheme](https://semver.org/). All stabi
|
||||
|
||||
### Branches & Tags
|
||||
|
||||
- `master` holds the bleeding edge code of the next, unreleased Zydis version. Elevated amounts of bugs and issues must be expected, API stability is not guaranteed outside of tagged commits.
|
||||
- `master` holds the bleeding edge code of the next, unreleased Zydis version. Increased amounts of bugs and issues must be expected and API stability is not guaranteed outside of tagged commits.
|
||||
- Stable and preview versions are annotated with git tags
|
||||
- beta and other preview versions have `-beta`, `-rc`, etc. suffixes
|
||||
- `maintenance/v4` points to the code of the latest release of v4
|
||||
- v4 is the latest stable major version and receives feature updates
|
||||
- `maintenance/v3` points to the code of the latest release of v3
|
||||
- v3 won't get any feature updates but will receive security updates until 2025
|
||||
- `maintenance/v2` points to the code of the last legacy release of v2
|
||||
|
||||
+8
-13
@@ -2,7 +2,6 @@
|
||||
|
||||
from pathlib import Path
|
||||
from typing import List, Set
|
||||
from glob import glob
|
||||
from shutil import rmtree
|
||||
|
||||
import os
|
||||
@@ -19,20 +18,16 @@ OUTPUT_DIR = ZYDIS_ROOT / 'amalgamated-dist'
|
||||
FILE_HEADER = ['// DO NOT EDIT. This file is auto-generated by `amalgamate.py`.', '']
|
||||
|
||||
|
||||
# Python versions before 3.10 don't have the root_dir argument for glob, so we
|
||||
# crudely emulate it here.
|
||||
def glob_in_dir(
|
||||
pattern: str,
|
||||
def find_files(
|
||||
pattern: re.Pattern,
|
||||
root_dir: Path,
|
||||
):
|
||||
cwd = os.getcwd()
|
||||
root_dir = root_dir.resolve()
|
||||
os.chdir(root_dir)
|
||||
try:
|
||||
for path in glob(pattern, recursive=True):
|
||||
yield Path(root_dir) / path
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
paths = []
|
||||
for root, dirs, files in os.walk(root_dir):
|
||||
paths.extend([Path(root) / name for name in files if pattern.match(name)])
|
||||
|
||||
return sorted(paths)
|
||||
|
||||
|
||||
def find_include_path(
|
||||
@@ -107,7 +102,7 @@ def merge_sources(*, source_dir: Path, covered_headers: Set[Path]):
|
||||
'',
|
||||
]
|
||||
|
||||
for source_file in glob_in_dir('**/*.c', source_dir):
|
||||
for source_file in find_files(re.compile('[\w-]+\.c'), source_dir):
|
||||
print(f'Processing source file "{source_file}"')
|
||||
|
||||
# Print some comments to show where the code is from.
|
||||
|
||||
+19
-2
@@ -1,7 +1,24 @@
|
||||
# Porting Guide v4 -> v5
|
||||
|
||||
# Encoder
|
||||
### Encoder
|
||||
|
||||
- `ZydisRegisterGetLargestEnclosing` will now return the given register itself for registers that don't have
|
||||
an enclosing register. Previously it would return `ZYDIS_REGISTER_NONE` in these cases.
|
||||
- `ZydisEncoderDecodedInstructionToEncoderRequest` now expects exactly `instruction->operand_count_visible` to be
|
||||
passed, not `operand_count_visible` at maximum. Passing a lower value was previously allowed but didn't really
|
||||
make much sense at all.
|
||||
make much sense at all.
|
||||
|
||||
### Decoder
|
||||
|
||||
- `ZydisDecodedOperandImm` struct was changed
|
||||
- Added field `offset`
|
||||
- Contains the offset of the immediate data, relative to the beginning of the instruction, in bytes.
|
||||
- Added field `size`
|
||||
- Contains the physical immediate size, in bits.
|
||||
- `ZydisDecodedOperandMemDisp_` struct was changed
|
||||
- Added field `offset`
|
||||
- Contains the offset of the immediate data, relative to the beginning of the instruction, in bytes.
|
||||
- Added field `size`
|
||||
- Contains the physical displacement size, in bits.
|
||||
- Removed field `has_displacement`
|
||||
- A `size` of 0 indicates that there is no displacement, effectively replacing the need for `has_displacement`.
|
||||
+1
@@ -3,4 +3,5 @@
|
||||
- resources/VersionInfo.rc (4 locations)
|
||||
- include/Zydis/Zydis.h (ZYDIS_VERSION macro)
|
||||
- create a tagged release of zycore
|
||||
- sync revision in dependencies/zycore.wrap
|
||||
- create a tagged release of zydis
|
||||
|
||||
+113
-20
@@ -8,29 +8,29 @@ on:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
build-linux:
|
||||
name: Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
|
||||
runs-on: ubuntu-latest
|
||||
build-linux-cmake:
|
||||
name: CMake Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
platform:
|
||||
- { name: x86, flags: "-m32" }
|
||||
- { name: x64, flags: "-m64" }
|
||||
compiler:
|
||||
- { name: GNU, CC: gcc }
|
||||
- { name: LLVM, CC: clang }
|
||||
flavor:
|
||||
- { name: GNU, CC: gcc, CXX: g++ }
|
||||
- { name: LLVM, CC: clang, CXX: clang++ }
|
||||
flavor:
|
||||
- Debug
|
||||
- Release
|
||||
mode:
|
||||
- { name: default, args: "" }
|
||||
mode:
|
||||
- { name: default, args: "" }
|
||||
- { name: NO_LIBC, args: -DZYAN_NO_LIBC=ON }
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3.1.0
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- if: matrix.platform.name == 'x86'
|
||||
name: Bootstrap
|
||||
@@ -47,40 +47,133 @@ jobs:
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_C_FLAGS=${{ matrix.platform.flags }} -DCMAKE_CXX_FLAGS=${{ matrix.platform.flags }} -DZYAN_DEV_MODE=ON ${{ matrix.mode.args }} ..
|
||||
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build build --config ${{ matrix.flavor }}
|
||||
|
||||
build-windows:
|
||||
name: Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
|
||||
build-linux-meson:
|
||||
name: Meson Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- { name: x86, flags: "-m32" }
|
||||
- { name: x64, flags: "-m64" }
|
||||
compiler:
|
||||
- { name: GNU, CC: gcc, CXX: g++ }
|
||||
- { name: LLVM, CC: clang, CXX: clang++ }
|
||||
flavor:
|
||||
- debug
|
||||
- release
|
||||
mode:
|
||||
- { name: default, args: -Dtests=enabled }
|
||||
- { name: NO_LIBC, args: -Dnolibc=true }
|
||||
|
||||
steps:
|
||||
- name: Setup meson
|
||||
run: |
|
||||
pipx install meson
|
||||
sudo apt-get install -y ninja-build
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- if: matrix.platform.name == 'x86'
|
||||
name: Bootstrap
|
||||
run: |
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
sudo apt-get install -y g++-multilib g++
|
||||
|
||||
- name: Configure
|
||||
env:
|
||||
CC: ${{ matrix.compiler.CC }}
|
||||
CXX: ${{ matrix.compiler.CXX }}
|
||||
run: |
|
||||
meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }} -Dc_extra_args="${{ matrix.platform.flags }}" -Dcpp_extra_args="${{ matrix.platform.flags }}"
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
meson compile -C build-${{ matrix.flavor }}
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
meson test -C build-${{ matrix.flavor }}
|
||||
|
||||
build-windows-cmake:
|
||||
name: CMake Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
|
||||
runs-on: windows-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
platform:
|
||||
- { name: x86, flags: "Win32" }
|
||||
- { name: x64, flags: "x64" }
|
||||
- { name: x64, flags: "x64" }
|
||||
compiler:
|
||||
- { name: MSVC }
|
||||
flavor:
|
||||
flavor:
|
||||
- Debug
|
||||
- Release
|
||||
mode:
|
||||
- { name: default, args: "" }
|
||||
mode:
|
||||
- { name: default, args: "" }
|
||||
- { name: NO_LIBC, args: -DZYAN_NO_LIBC=ON }
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3.1.0
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_GENERATOR_PLATFORM=${{ matrix.platform.flags }} -DZYAN_DEV_MODE=ON ${{ matrix.mode.args }} ..
|
||||
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build build --config ${{ matrix.flavor }}
|
||||
|
||||
build-windows-meson:
|
||||
name: Meson Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
|
||||
runs-on: windows-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform:
|
||||
- { name: x86, flags: "amd64_x86" }
|
||||
- { name: x64, flags: "amd64" }
|
||||
compiler:
|
||||
- { name: MSVC }
|
||||
flavor:
|
||||
- debug
|
||||
- release
|
||||
mode:
|
||||
- { name: default, args: -Dtests=enabled }
|
||||
- { name: NO_LIBC, args: -Dnolibc=true }
|
||||
|
||||
steps:
|
||||
- name: Setup meson
|
||||
run: |
|
||||
pipx install meson
|
||||
choco install ninja
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
$VCPATH = vswhere -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -latest
|
||||
& $VCPATH\VC\Auxiliary\Build\vcvarsall.bat ${{ matrix.platform.flags }}
|
||||
meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }}
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
meson compile -C build-${{ matrix.flavor }}
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
meson test -C build-${{ matrix.flavor }}
|
||||
|
||||
+5
-3
@@ -2,14 +2,14 @@ if (TARGET Zycore)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
|
||||
# Enable runtime library selection via CMAKE_MSVC_RUNTIME_LIBRARY
|
||||
cmake_policy(SET CMP0091 NEW)
|
||||
endif ()
|
||||
|
||||
project(Zycore VERSION 1.4.0.0 LANGUAGES C)
|
||||
project(Zycore VERSION 1.5.2.0 LANGUAGES C)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(CMakePackageConfigHelpers)
|
||||
@@ -118,12 +118,14 @@ else ()
|
||||
add_library("Zycore" STATIC)
|
||||
target_compile_definitions("Zycore" PUBLIC "ZYCORE_STATIC_BUILD")
|
||||
endif ()
|
||||
add_library("Zycore::Zycore" ALIAS "Zycore")
|
||||
|
||||
set_target_properties("Zycore" PROPERTIES
|
||||
LINKER_LANGUAGE C
|
||||
VERSION "${Zycore_VERSION}"
|
||||
SOVERSION "${Zycore_VERSION_MAJOR}.${Zycore_VERSION_MINOR}"
|
||||
DEFINE_SYMBOL "ZYCORE_SHOULD_EXPORT")
|
||||
DEFINE_SYMBOL "ZYCORE_SHOULD_EXPORT"
|
||||
C_VISIBILITY_PRESET hidden)
|
||||
target_include_directories("Zycore"
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
cmake_minimum_required(VERSION 2.8.2)
|
||||
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
|
||||
|
||||
project(googletest-download NONE)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(googletest
|
||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||
GIT_TAG ee3aa831172090fd5442820f215cb04ab6062756
|
||||
GIT_TAG v1.17.0
|
||||
SOURCE_DIR "${CMAKE_BINARY_DIR}/gtest/src"
|
||||
BINARY_DIR "${CMAKE_BINARY_DIR}/gtest/build"
|
||||
CONFIGURE_COMMAND ""
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
PROJECT_NAME = Zycore
|
||||
PROJECT_NUMBER = @VERSION@
|
||||
PROJECT_BRIEF = "Zyan Core Library for C"
|
||||
OUTPUT_DIRECTORY = "@TOP_BUILDDIR@/doc"
|
||||
STRIP_FROM_PATH = "@TOP_SRCDIR@"
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
QT_AUTOBRIEF = YES
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
TOC_INCLUDE_HEADINGS = 0
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_LOCAL_CLASSES = NO
|
||||
HIDE_SCOPE_NAMES = YES
|
||||
INPUT = "@TOP_SRCDIR@/include" \
|
||||
"@TOP_SRCDIR@/README.md"
|
||||
RECURSIVE = YES
|
||||
EXAMPLE_PATH = "@TOP_SRCDIR@/examples"
|
||||
USE_MDFILE_AS_MAINPAGE = "@TOP_SRCDIR@/README.md"
|
||||
GENERATE_TREEVIEW = YES
|
||||
USE_MATHJAX = YES
|
||||
MATHJAX_VERSION = MathJax_3
|
||||
GENERATE_LATEX = NO
|
||||
MACRO_EXPANSION = YES
|
||||
PREDEFINED = @PREDEFINED@
|
||||
DOT_COMMON_ATTR = "fontname=\"sans-serif\",fontsize=10"
|
||||
DOT_EDGE_ATTR = "labelfontname=\"sans-serif\",labelfontsize=10"
|
||||
DOT_IMAGE_FORMAT = svg
|
||||
INTERACTIVE_SVG = YES
|
||||
HAVE_DOT = @HAVE_DOT@
|
||||
DOT_MULTI_TARGETS = @HAVE_DOT_1_8_10@
|
||||
DOT_PATH = "@DOT_PATH@"
|
||||
HTML_FORMULA_FORMAT = @HTML_FORMULA_FORMAT@
|
||||
+105
-77
@@ -45,6 +45,15 @@
|
||||
/* Helper functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
static ZyanStatus PrintString(ZyanString* string) {
|
||||
const char* cstring;
|
||||
ZYAN_CHECK(ZyanStringGetData(string, &cstring));
|
||||
|
||||
printf("(*ZyanString)%p = %s\n", (void*)string, cstring);
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Tests */
|
||||
/* ============================================================================================== */
|
||||
@@ -60,12 +69,23 @@
|
||||
*
|
||||
* @return A zyan status code.
|
||||
*/
|
||||
static ZyanStatus PerformBasicTests(ZyanString* string)
|
||||
{
|
||||
static ZyanStatus PerformBasicTests(ZyanString* string) {
|
||||
ZYAN_ASSERT(string);
|
||||
ZYAN_UNUSED(string);
|
||||
|
||||
ZyanUSize size;
|
||||
ZYAN_CHECK(ZyanStringGetSize(string, &size));
|
||||
|
||||
ZyanStringView view1 = ZYAN_DEFINE_STRING_VIEW("The quick brown fox jumps over the lazy dog");
|
||||
ZyanStringView view2 = ZYAN_DEFINE_STRING_VIEW("big ");
|
||||
|
||||
ZYAN_CHECK(ZyanStringAppend(string, &view1));
|
||||
PrintString(string);
|
||||
|
||||
ZYAN_CHECK(ZyanStringInsert(string, 4, &view2));
|
||||
PrintString(string);
|
||||
|
||||
ZYAN_CHECK(ZyanStringSetChar(string, 7, ','));
|
||||
PrintString(string);
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -75,10 +95,14 @@ static ZyanStatus PerformBasicTests(ZyanString* string)
|
||||
*
|
||||
* @return A zyan status code.
|
||||
*/
|
||||
static ZyanStatus TestDynamic(void)
|
||||
{
|
||||
PerformBasicTests(ZYAN_NULL);
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
static ZyanStatus TestDynamic(void) {
|
||||
ZyanString string;
|
||||
|
||||
ZYAN_CHECK(ZyanStringInit(&string, 10));
|
||||
|
||||
ZYAN_CHECK(PerformBasicTests(&string));
|
||||
|
||||
return ZyanStringDestroy(&string);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,71 +110,71 @@ static ZyanStatus TestDynamic(void)
|
||||
*
|
||||
* @return A zyan status code.
|
||||
*/
|
||||
static ZyanStatus TestStatic(void)
|
||||
{
|
||||
PerformBasicTests(ZYAN_NULL);
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
static ZyanStatus TestStatic(void) {
|
||||
static char buffer[50];
|
||||
ZyanString string;
|
||||
|
||||
ZYAN_CHECK(ZyanStringInitCustomBuffer(&string, buffer, sizeof(buffer)));
|
||||
|
||||
ZYAN_CHECK(PerformBasicTests(&string));
|
||||
|
||||
return ZyanStringDestroy(&string);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Custom allocator */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
//static ZyanStatus AllocatorAllocate(ZyanAllocator* allocator, void** p, ZyanUSize element_size,
|
||||
// ZyanUSize n)
|
||||
//{
|
||||
// ZYAN_ASSERT(allocator);
|
||||
// ZYAN_ASSERT(p);
|
||||
// ZYAN_ASSERT(element_size);
|
||||
// ZYAN_ASSERT(n);
|
||||
//
|
||||
// ZYAN_UNUSED(allocator);
|
||||
//
|
||||
// *p = ZYAN_MALLOC(element_size * n);
|
||||
// if (!*p)
|
||||
// {
|
||||
// return ZYAN_STATUS_NOT_ENOUGH_MEMORY;
|
||||
// }
|
||||
//
|
||||
// return ZYAN_STATUS_SUCCESS;
|
||||
//}
|
||||
//
|
||||
//static ZyanStatus AllocatorReallocate(ZyanAllocator* allocator, void** p, ZyanUSize element_size,
|
||||
// ZyanUSize n)
|
||||
//{
|
||||
// ZYAN_ASSERT(allocator);
|
||||
// ZYAN_ASSERT(p);
|
||||
// ZYAN_ASSERT(element_size);
|
||||
// ZYAN_ASSERT(n);
|
||||
//
|
||||
// ZYAN_UNUSED(allocator);
|
||||
//
|
||||
// void* const x = ZYAN_REALLOC(*p, element_size * n);
|
||||
// if (!x)
|
||||
// {
|
||||
// return ZYAN_STATUS_NOT_ENOUGH_MEMORY;
|
||||
// }
|
||||
// *p = x;
|
||||
//
|
||||
// return ZYAN_STATUS_SUCCESS;
|
||||
//}
|
||||
//
|
||||
//static ZyanStatus AllocatorDeallocate(ZyanAllocator* allocator, void* p, ZyanUSize element_size,
|
||||
// ZyanUSize n)
|
||||
//{
|
||||
// ZYAN_ASSERT(allocator);
|
||||
// ZYAN_ASSERT(p);
|
||||
// ZYAN_ASSERT(element_size);
|
||||
// ZYAN_ASSERT(n);
|
||||
//
|
||||
// ZYAN_UNUSED(allocator);
|
||||
// ZYAN_UNUSED(element_size);
|
||||
// ZYAN_UNUSED(n);
|
||||
//
|
||||
// ZYAN_FREE(p);
|
||||
//
|
||||
// return ZYAN_STATUS_SUCCESS;
|
||||
//}
|
||||
static ZyanStatus AllocatorAllocate(
|
||||
ZyanAllocator* allocator, void** p, ZyanUSize element_size, ZyanUSize n) {
|
||||
ZYAN_ASSERT(allocator);
|
||||
ZYAN_ASSERT(p);
|
||||
ZYAN_ASSERT(element_size);
|
||||
ZYAN_ASSERT(n);
|
||||
|
||||
ZYAN_UNUSED(allocator);
|
||||
|
||||
*p = ZYAN_MALLOC(element_size * n);
|
||||
if (!*p) {
|
||||
return ZYAN_STATUS_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static ZyanStatus AllocatorReallocate(
|
||||
ZyanAllocator* allocator, void** p, ZyanUSize element_size, ZyanUSize n) {
|
||||
ZYAN_ASSERT(allocator);
|
||||
ZYAN_ASSERT(p);
|
||||
ZYAN_ASSERT(element_size);
|
||||
ZYAN_ASSERT(n);
|
||||
|
||||
ZYAN_UNUSED(allocator);
|
||||
|
||||
void* const x = ZYAN_REALLOC(*p, element_size * n);
|
||||
if (!x) {
|
||||
return ZYAN_STATUS_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
*p = x;
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static ZyanStatus AllocatorDeallocate(
|
||||
ZyanAllocator* allocator, void* p, ZyanUSize element_size, ZyanUSize n) {
|
||||
ZYAN_ASSERT(allocator);
|
||||
ZYAN_ASSERT(p);
|
||||
ZYAN_ASSERT(element_size);
|
||||
ZYAN_ASSERT(n);
|
||||
|
||||
ZYAN_UNUSED(allocator);
|
||||
ZYAN_UNUSED(element_size);
|
||||
ZYAN_UNUSED(n);
|
||||
|
||||
ZYAN_FREE(p);
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
@@ -160,9 +184,17 @@ static ZyanStatus TestStatic(void)
|
||||
*
|
||||
* @return A zyan status code.
|
||||
*/
|
||||
static ZyanStatus TestAllocator(void)
|
||||
{
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
static ZyanStatus TestAllocator(void) {
|
||||
ZyanAllocator allocator;
|
||||
ZYAN_CHECK(
|
||||
ZyanAllocatorInit(&allocator, AllocatorAllocate, AllocatorReallocate, AllocatorDeallocate));
|
||||
|
||||
ZyanString string;
|
||||
ZYAN_CHECK(ZyanStringInitEx(&string, 20, &allocator, 10, 0));
|
||||
|
||||
ZYAN_CHECK(PerformBasicTests(&string));
|
||||
|
||||
return ZyanStringDestroy(&string);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
@@ -171,18 +203,14 @@ static ZyanStatus TestAllocator(void)
|
||||
/* Entry point */
|
||||
/* ============================================================================================== */
|
||||
|
||||
int main()
|
||||
{
|
||||
if (!ZYAN_SUCCESS(TestDynamic()))
|
||||
{
|
||||
int main(void) {
|
||||
if (!ZYAN_SUCCESS(TestDynamic())) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (!ZYAN_SUCCESS(TestStatic()))
|
||||
{
|
||||
if (!ZYAN_SUCCESS(TestStatic())) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (!ZYAN_SUCCESS(TestAllocator()))
|
||||
{
|
||||
if (!ZYAN_SUCCESS(TestAllocator())) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
examples_req = examples.allowed()
|
||||
|
||||
if examples_req
|
||||
executable('String', 'String.c', dependencies: [zycore_dep])
|
||||
executable('Vector', 'Vector.c', dependencies: [zycore_dep])
|
||||
endif
|
||||
|
||||
summary(
|
||||
{'examples': examples_req},
|
||||
section: 'Features',
|
||||
)
|
||||
+119
-11
@@ -57,6 +57,32 @@
|
||||
*/
|
||||
#define ZYAN_MACRO_CONCAT_EXPAND(x, y) ZYAN_MACRO_CONCAT(x, y)
|
||||
|
||||
/**
|
||||
* Checks if a header can be included.
|
||||
*
|
||||
* @param name Header file name.
|
||||
*
|
||||
* @return True if header exists, false if it doesn't or it's not possible to check.
|
||||
*/
|
||||
#if defined(__has_include)
|
||||
# define ZYAN_HAS_INCLUDE(name) __has_include(name)
|
||||
#else
|
||||
# define ZYAN_HAS_INCLUDE(name) 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Checks if a symbol is a recognized built-in function.
|
||||
*
|
||||
* @param symbol Function name.
|
||||
*
|
||||
* @return True if symbol is known, false otherwise.
|
||||
*/
|
||||
#if defined(__has_builtin)
|
||||
# define ZYAN_HAS_BUILTIN(symbol) __has_builtin(symbol)
|
||||
#else
|
||||
# define ZYAN_HAS_BUILTIN(symbol) 0
|
||||
#endif
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Compiler detection */
|
||||
/* ============================================================================================== */
|
||||
@@ -64,6 +90,10 @@
|
||||
#if defined(__clang__)
|
||||
# define ZYAN_CLANG
|
||||
# define ZYAN_GNUC
|
||||
# if defined(_MSC_VER)
|
||||
# define ZYAN_CLANG_CL
|
||||
# define ZYAN_MSVC
|
||||
# endif
|
||||
#elif defined(__ICC) || defined(__INTEL_COMPILER)
|
||||
# define ZYAN_ICC
|
||||
#elif defined(__GNUC__) || defined(__GNUG__)
|
||||
@@ -97,10 +127,16 @@
|
||||
#elif defined(__FreeBSD__)
|
||||
# define ZYAN_FREEBSD
|
||||
# define ZYAN_POSIX
|
||||
#elif defined(__NetBSD__)
|
||||
# define ZYAN_NETBSD
|
||||
# define ZYAN_POSIX
|
||||
#elif defined(sun) || defined(__sun)
|
||||
# define ZYAN_SOLARIS
|
||||
# define ZYAN_POSIX
|
||||
#elif defined(__unix)
|
||||
#elif defined(__HAIKU__)
|
||||
# define ZYAN_HAIKU
|
||||
# define ZYAN_POSIX
|
||||
#elif defined(__unix) || defined(__unix__)
|
||||
# define ZYAN_UNIX
|
||||
# define ZYAN_POSIX
|
||||
#elif defined(__posix)
|
||||
@@ -128,26 +164,86 @@
|
||||
|
||||
#if defined(_M_AMD64) || defined(__x86_64__)
|
||||
# define ZYAN_X64
|
||||
# define ZYAN_ARCHITECTURE_WIDTH 64
|
||||
#elif defined(_M_IX86) || defined(__i386__)
|
||||
# define ZYAN_X86
|
||||
# define ZYAN_ARCHITECTURE_WIDTH 32
|
||||
#elif defined(_M_ARM64) || defined(__aarch64__)
|
||||
# define ZYAN_AARCH64
|
||||
# define ZYAN_ARCHITECTURE_WIDTH 64
|
||||
#elif defined(_M_ARM) || defined(_M_ARMT) || defined(__arm__) || defined(__thumb__)
|
||||
# define ZYAN_ARM
|
||||
# define ZYAN_ARCHITECTURE_WIDTH 32
|
||||
#elif defined(__EMSCRIPTEN__) || defined(__wasm__) || defined(__WASM__)
|
||||
# define ZYAN_WASM
|
||||
# define ZYAN_ARCHITECTURE_WIDTH 32
|
||||
#elif defined(__loongarch__)
|
||||
# define ZYAN_LOONGARCH
|
||||
# define ZYAN_ARCHITECTURE_WIDTH 64
|
||||
#elif defined(__powerpc64__)
|
||||
# define ZYAN_PPC64
|
||||
# define ZYAN_ARCHITECTURE_WIDTH 64
|
||||
#elif defined(__powerpc__)
|
||||
# define ZYAN_PPC
|
||||
#elif defined(__riscv) && __riscv_xlen == 64
|
||||
# define ZYAN_RISCV64
|
||||
# define ZYAN_ARCHITECTURE_WIDTH 32
|
||||
#elif defined(__riscv) || defined(__riscv__)
|
||||
# if __riscv_xlen == 64
|
||||
# define ZYAN_RISCV64
|
||||
# define ZYAN_ARCHITECTURE_WIDTH 64
|
||||
# else
|
||||
# define ZYAN_RISCV32
|
||||
# define ZYAN_ARCHITECTURE_WIDTH 32
|
||||
# endif
|
||||
#elif defined(__arc__)
|
||||
# define ZYAN_ARC
|
||||
#elif defined(__s390x__)
|
||||
# define ZYAN_S390
|
||||
#elif defined(__sparc__)
|
||||
# define ZYAN_SPARC
|
||||
#elif defined(__mips__)
|
||||
# define ZYAN_MIPS
|
||||
#else
|
||||
# error "Unsupported architecture detected"
|
||||
#endif
|
||||
|
||||
#if !defined(ZYAN_ARCHITECTURE_WIDTH)
|
||||
# if defined(__LP64__)
|
||||
# define ZYAN_ARCHITECTURE_WIDTH 64
|
||||
# else
|
||||
# define ZYAN_ARCHITECTURE_WIDTH 32
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Endianness detection */
|
||||
/* ============================================================================================== */
|
||||
|
||||
#define ZYAN_LITTLE_ENDIAN 0
|
||||
#define ZYAN_BIG_ENDIAN 1
|
||||
|
||||
#if !defined(ZYAN_NO_LIBC) && ZYAN_HAS_INCLUDE(<stdbit.h>)
|
||||
# include <stdbit.h>
|
||||
# if __STDC_ENDIAN_NATIVE__ == __STDC_ENDIAN_LITTLE__
|
||||
# define ZYAN_ENDIAN ZYAN_LITTLE_ENDIAN
|
||||
# elif __STDC_ENDIAN_NATIVE__ == __STDC_ENDIAN_BIG__
|
||||
# define ZYAN_ENDIAN ZYAN_BIG_ENDIAN
|
||||
# else
|
||||
# error "Unsupported endianness"
|
||||
# endif
|
||||
#elif defined(__BYTE_ORDER__)
|
||||
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define ZYAN_ENDIAN ZYAN_LITTLE_ENDIAN
|
||||
# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define ZYAN_ENDIAN ZYAN_BIG_ENDIAN
|
||||
# else
|
||||
# error "Unsupported endianness"
|
||||
# endif
|
||||
#elif defined(ZYAN_S390) || defined(ZYAN_SPARC) || defined(ZYAN_MIPS)
|
||||
# define ZYAN_ENDIAN ZYAN_BIG_ENDIAN
|
||||
#else
|
||||
# define ZYAN_ENDIAN ZYAN_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Debug/Release detection */
|
||||
/* ============================================================================================== */
|
||||
@@ -184,12 +280,17 @@
|
||||
/* Generic DLL import/export helpers */
|
||||
/* ============================================================================================== */
|
||||
|
||||
#if defined(ZYAN_MSVC)
|
||||
#if defined(ZYAN_MSVC) || (defined(ZYAN_WINDOWS) && defined(ZYAN_GNUC))
|
||||
# define ZYAN_DLLEXPORT __declspec(dllexport)
|
||||
# define ZYAN_DLLIMPORT __declspec(dllimport)
|
||||
#else
|
||||
# define ZYAN_DLLEXPORT
|
||||
# define ZYAN_DLLIMPORT
|
||||
# if defined(ZYAN_GNUC)
|
||||
# define ZYAN_DLLEXPORT __attribute__((__visibility__("default")))
|
||||
# define ZYAN_DLLIMPORT extern
|
||||
# else
|
||||
# define ZYAN_DLLEXPORT
|
||||
# define ZYAN_DLLIMPORT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* ============================================================================================== */
|
||||
@@ -233,7 +334,11 @@
|
||||
/**
|
||||
* Symbol is not exported and for internal use only.
|
||||
*/
|
||||
#define ZYCORE_NO_EXPORT
|
||||
#if defined(ZYAN_GNUC)
|
||||
# define ZYCORE_NO_EXPORT __attribute__((__visibility__("hidden")))
|
||||
#else
|
||||
# define ZYCORE_NO_EXPORT
|
||||
#endif
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Misc compatibility macros */
|
||||
@@ -245,8 +350,8 @@
|
||||
# define ZYAN_NO_SANITIZE(what)
|
||||
#endif
|
||||
|
||||
#if defined(ZYAN_MSVC) || defined(ZYAN_BORLAND)
|
||||
# define ZYAN_INLINE __inline
|
||||
#if defined(ZYAN_BORLAND)
|
||||
# define ZYAN_INLINE static __inline
|
||||
#else
|
||||
# define ZYAN_INLINE static inline
|
||||
#endif
|
||||
@@ -285,6 +390,9 @@
|
||||
(defined(__cplusplus) && defined (_MSC_VER) && (_MSC_VER >= 1600)) || \
|
||||
(defined (_MSC_VER) && (_MSC_VER >= 1800))
|
||||
# define ZYAN_STATIC_ASSERT(x) static_assert(x, #x)
|
||||
#elif defined(ZYAN_GNUC)
|
||||
# define ZYAN_STATIC_ASSERT(x) \
|
||||
__attribute__((unused)) typedef int ZYAN_MACRO_CONCAT_EXPAND(ZYAN_SASSERT_, __COUNTER__) [(x) ? 1 : -1]
|
||||
#else
|
||||
# define ZYAN_STATIC_ASSERT(x) \
|
||||
typedef int ZYAN_MACRO_CONCAT_EXPAND(ZYAN_SASSERT_, __COUNTER__) [(x) ? 1 : -1]
|
||||
@@ -485,9 +593,9 @@
|
||||
*/
|
||||
#if defined(ZYAN_LINUX) && defined(ZYAN_KERNEL)
|
||||
# include <asm/div64.h> /* do_div */
|
||||
# define ZYAN_DIV64(n, divisor) do_div(n, divisor)
|
||||
# define ZYAN_DIV64(n, divisor) do_div((n), (divisor))
|
||||
#else
|
||||
# define ZYAN_DIV64(n, divisor) (n /= divisor)
|
||||
# define ZYAN_DIV64(n, divisor) ((n) /= (divisor))
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
+12
-12
@@ -48,36 +48,36 @@ extern "C" {
|
||||
|
||||
#if defined(ZYAN_X86)
|
||||
|
||||
static ZYAN_INLINE ZyanUPointer ZyanAtomicCompareExchange(ZyanAtomicPointer* destination,
|
||||
ZYAN_INLINE ZyanUPointer ZyanAtomicCompareExchange(ZyanAtomicPointer* destination,
|
||||
ZyanUPointer comparand, ZyanUPointer value)
|
||||
{
|
||||
return (ZyanUPointer)ZyanAtomicCompareExchange32((ZyanAtomic32*)destination, comparand, value);
|
||||
}
|
||||
|
||||
static ZYAN_INLINE ZyanUPointer ZyanAtomicIncrement(ZyanAtomicPointer* destination)
|
||||
ZYAN_INLINE ZyanUPointer ZyanAtomicIncrement(ZyanAtomicPointer* destination)
|
||||
{
|
||||
return (ZyanUPointer)ZyanAtomicIncrement32((ZyanAtomic32*)destination);
|
||||
}
|
||||
|
||||
static ZYAN_INLINE ZyanUPointer ZyanAtomicDecrement(ZyanAtomicPointer* destination)
|
||||
ZYAN_INLINE ZyanUPointer ZyanAtomicDecrement(ZyanAtomicPointer* destination)
|
||||
{
|
||||
return (ZyanUPointer)ZyanAtomicDecrement32((ZyanAtomic32*)destination);
|
||||
}
|
||||
|
||||
#elif defined(ZYAN_X64)
|
||||
|
||||
static ZYAN_INLINE ZyanUPointer ZyanAtomicCompareExchange(ZyanAtomicPointer* destination,
|
||||
ZYAN_INLINE ZyanUPointer ZyanAtomicCompareExchange(ZyanAtomicPointer* destination,
|
||||
ZyanUPointer comparand, ZyanUPointer value)
|
||||
{
|
||||
return (ZyanUPointer)ZyanAtomicCompareExchange64((ZyanAtomic64*)destination, comparand, value);
|
||||
}
|
||||
|
||||
static ZYAN_INLINE ZyanUPointer ZyanAtomicIncrement(ZyanAtomicPointer* destination)
|
||||
ZYAN_INLINE ZyanUPointer ZyanAtomicIncrement(ZyanAtomicPointer* destination)
|
||||
{
|
||||
return (ZyanUPointer)ZyanAtomicIncrement64((ZyanAtomic64*)destination);
|
||||
}
|
||||
|
||||
static ZYAN_INLINE ZyanUPointer ZyanAtomicDecrement(ZyanAtomicPointer* destination)
|
||||
ZYAN_INLINE ZyanUPointer ZyanAtomicDecrement(ZyanAtomicPointer* destination)
|
||||
{
|
||||
return (ZyanUPointer)ZyanAtomicDecrement64((ZyanAtomic64*)destination);
|
||||
}
|
||||
@@ -90,19 +90,19 @@ static ZYAN_INLINE ZyanUPointer ZyanAtomicDecrement(ZyanAtomicPointer* destinati
|
||||
/* 32-bit */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
static ZYAN_INLINE ZyanU32 ZyanAtomicCompareExchange32(ZyanAtomic32* destination,
|
||||
ZYAN_INLINE ZyanU32 ZyanAtomicCompareExchange32(ZyanAtomic32* destination,
|
||||
ZyanU32 comparand, ZyanU32 value)
|
||||
{
|
||||
return (ZyanU32)(_InterlockedCompareExchange((volatile LONG*)&(destination->value),
|
||||
(LONG)value, (LONG)comparand));
|
||||
}
|
||||
|
||||
static ZYAN_INLINE ZyanU32 ZyanAtomicIncrement32(ZyanAtomic32* destination)
|
||||
ZYAN_INLINE ZyanU32 ZyanAtomicIncrement32(ZyanAtomic32* destination)
|
||||
{
|
||||
return (ZyanU32)(_InterlockedIncrement((volatile LONG*)&(destination->value)));
|
||||
}
|
||||
|
||||
static ZYAN_INLINE ZyanU32 ZyanAtomicDecrement32(ZyanAtomic32* destination)
|
||||
ZYAN_INLINE ZyanU32 ZyanAtomicDecrement32(ZyanAtomic32* destination)
|
||||
{
|
||||
return (ZyanU32)(_InterlockedDecrement((volatile LONG*)&(destination->value)));
|
||||
}
|
||||
@@ -111,19 +111,19 @@ static ZYAN_INLINE ZyanU32 ZyanAtomicDecrement32(ZyanAtomic32* destination)
|
||||
/* 64-bit */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
static ZYAN_INLINE ZyanU64 ZyanAtomicCompareExchange64(ZyanAtomic64* destination,
|
||||
ZYAN_INLINE ZyanU64 ZyanAtomicCompareExchange64(ZyanAtomic64* destination,
|
||||
ZyanU64 comparand, ZyanU64 value)
|
||||
{
|
||||
return (ZyanU64)(_InterlockedCompareExchange64((volatile LONG64*)&(destination->value),
|
||||
(LONG64)value, (LONG64)comparand));
|
||||
}
|
||||
|
||||
static ZYAN_INLINE ZyanU64 ZyanAtomicIncrement64(ZyanAtomic64* destination)
|
||||
ZYAN_INLINE ZyanU64 ZyanAtomicIncrement64(ZyanAtomic64* destination)
|
||||
{
|
||||
return (ZyanU64)(_InterlockedIncrement64((volatile LONG64*)&(destination->value)));
|
||||
}
|
||||
|
||||
static ZYAN_INLINE ZyanU64 ZyanAtomicDecrement64(ZyanAtomic64* destination)
|
||||
ZYAN_INLINE ZyanU64 ZyanAtomicDecrement64(ZyanAtomic64* destination)
|
||||
{
|
||||
return (ZyanU64)(_InterlockedDecrement64((volatile LONG64*)&(destination->value)));
|
||||
}
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ typedef ZyanU32 ZyanStatus;
|
||||
* @return `ZYAN_TRUE`, if the operation failed or `ZYAN_FALSE`, if not.
|
||||
*/
|
||||
#define ZYAN_FAILED(status) \
|
||||
((status) & 0x80000000u)
|
||||
(!!((status) & 0x80000000u))
|
||||
|
||||
/**
|
||||
* Checks if a zyan operation was successful and returns with the status-code, if not.
|
||||
|
||||
+2
-2
@@ -471,7 +471,7 @@ ZYCORE_EXPORT ZyanStatus ZyanStringConcatCustomBuffer(ZyanString* destination,
|
||||
*
|
||||
* @return A zyan status code.
|
||||
*
|
||||
* The `ZYAN_STRING_TO_VEW` macro can be used to pass any `ZyanString` instance as value for the
|
||||
* The `ZYAN_STRING_TO_VIEW` macro can be used to pass any `ZyanString` instance as value for the
|
||||
* `source` string.
|
||||
*/
|
||||
ZYCORE_EXPORT ZyanStatus ZyanStringViewInsideView(ZyanStringView* view,
|
||||
@@ -487,7 +487,7 @@ ZYCORE_EXPORT ZyanStatus ZyanStringViewInsideView(ZyanStringView* view,
|
||||
*
|
||||
* @return A zyan status code.
|
||||
*
|
||||
* The `ZYAN_STRING_TO_VEW` macro can be used to pass any `ZyanString` instance as value for the
|
||||
* The `ZYAN_STRING_TO_VIEW` macro can be used to pass any `ZyanString` instance as value for the
|
||||
* `source` string.
|
||||
*/
|
||||
ZYCORE_EXPORT ZyanStatus ZyanStringViewInsideViewEx(ZyanStringView* view,
|
||||
|
||||
+80
@@ -333,6 +333,86 @@ typedef char* ZyanCharPointer;
|
||||
*/
|
||||
typedef const char* ZyanConstCharPointer;
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Type conversion utils */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/**
|
||||
* Collection of functions for swapping byte order in 16/32/64-bit values respectively.
|
||||
*
|
||||
* @param x 16/32/64-bit value.
|
||||
*
|
||||
* @return 16/32/64-bit value with byte order swapped.
|
||||
*/
|
||||
#if defined(ZYAN_MSVC)
|
||||
# if defined(ZYAN_NO_LIBC)
|
||||
# if defined(__cplusplus)
|
||||
extern "C" {
|
||||
# endif
|
||||
unsigned short __cdecl _byteswap_ushort(unsigned short);
|
||||
unsigned long __cdecl _byteswap_ulong(unsigned long);
|
||||
unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
|
||||
# if defined(__cplusplus)
|
||||
}
|
||||
# endif
|
||||
# elif defined(ZYAN_KERNEL)
|
||||
# include <wdm.h>
|
||||
# else
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
|
||||
# define ZYAN_BYTESWAP16(x) _byteswap_ushort((x))
|
||||
# define ZYAN_BYTESWAP32(x) _byteswap_ulong((x))
|
||||
# define ZYAN_BYTESWAP64(x) _byteswap_uint64((x))
|
||||
#elif ZYAN_HAS_BUILTIN(__builtin_bswap16) && \
|
||||
ZYAN_HAS_BUILTIN(__builtin_bswap32) && \
|
||||
ZYAN_HAS_BUILTIN(__builtin_bswap64)
|
||||
# define ZYAN_BYTESWAP16(x) __builtin_bswap16((x))
|
||||
# define ZYAN_BYTESWAP32(x) __builtin_bswap32((x))
|
||||
# define ZYAN_BYTESWAP64(x) __builtin_bswap64((x))
|
||||
#else
|
||||
ZYAN_INLINE ZyanU16 ZYAN_BYTESWAP16(ZyanU16 x)
|
||||
{
|
||||
return (((x >> 8) & 0xFFU) | ((x & 0xFFU) << 8));
|
||||
}
|
||||
|
||||
ZYAN_INLINE ZyanU32 ZYAN_BYTESWAP32(ZyanU32 x)
|
||||
{
|
||||
return (((x & 0xFF000000U) >> 24) |
|
||||
((x & 0x00FF0000U) >> 8 ) |
|
||||
((x & 0x0000FF00U) << 8 ) |
|
||||
((x & 0x000000FFU) << 24));
|
||||
}
|
||||
|
||||
ZYAN_INLINE ZyanU64 ZYAN_BYTESWAP64(ZyanU64 x)
|
||||
{
|
||||
return (((x & 0xFF00000000000000ULL) >> 56) |
|
||||
((x & 0x00FF000000000000ULL) >> 40) |
|
||||
((x & 0x0000FF0000000000ULL) >> 24) |
|
||||
((x & 0x000000FF00000000ULL) >> 8 ) |
|
||||
((x & 0x00000000FF000000ULL) << 8 ) |
|
||||
((x & 0x0000000000FF0000ULL) << 24) |
|
||||
((x & 0x000000000000FF00ULL) << 40) |
|
||||
((x & 0x00000000000000FFULL) << 56));
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Collection of functions for converting 16/32/64-bit variables from little endian to native endian
|
||||
* of the current platform.
|
||||
*
|
||||
* @param x 16/32/64-bit variable.
|
||||
*/
|
||||
#if ZYAN_ENDIAN == ZYAN_LITTLE_ENDIAN
|
||||
# define ZYAN_LE16_TO_NATIVE(x)
|
||||
# define ZYAN_LE32_TO_NATIVE(x)
|
||||
# define ZYAN_LE64_TO_NATIVE(x)
|
||||
#else
|
||||
# define ZYAN_LE16_TO_NATIVE(x) (x) = ZYAN_BYTESWAP16((x))
|
||||
# define ZYAN_LE32_TO_NATIVE(x) (x) = ZYAN_BYTESWAP32((x))
|
||||
# define ZYAN_LE64_TO_NATIVE(x) (x) = ZYAN_BYTESWAP64((x))
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* ============================================================================================== */
|
||||
|
||||
+5
-5
@@ -51,7 +51,7 @@ extern "C" {
|
||||
/**
|
||||
* A macro that defines the zycore version.
|
||||
*/
|
||||
#define ZYCORE_VERSION (ZyanU64)0x0001000400010000
|
||||
#define ZYCORE_VERSION 0x0001000500020000ULL
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Helper macros */
|
||||
@@ -62,28 +62,28 @@ extern "C" {
|
||||
*
|
||||
* @param version The zycore version value
|
||||
*/
|
||||
#define ZYCORE_VERSION_MAJOR(version) (ZyanU16)((version & 0xFFFF000000000000) >> 48)
|
||||
#define ZYCORE_VERSION_MAJOR(version) ((version & 0xFFFF000000000000) >> 48)
|
||||
|
||||
/**
|
||||
* Extracts the minor-part of the zycore version.
|
||||
*
|
||||
* @param version The zycore version value
|
||||
*/
|
||||
#define ZYCORE_VERSION_MINOR(version) (ZyanU16)((version & 0x0000FFFF00000000) >> 32)
|
||||
#define ZYCORE_VERSION_MINOR(version) ((version & 0x0000FFFF00000000) >> 32)
|
||||
|
||||
/**
|
||||
* Extracts the patch-part of the zycore version.
|
||||
*
|
||||
* @param version The zycore version value
|
||||
*/
|
||||
#define ZYCORE_VERSION_PATCH(version) (ZyanU16)((version & 0x00000000FFFF0000) >> 16)
|
||||
#define ZYCORE_VERSION_PATCH(version) ((version & 0x00000000FFFF0000) >> 16)
|
||||
|
||||
/**
|
||||
* Extracts the build-part of the zycore version.
|
||||
*
|
||||
* @param version The zycore version value
|
||||
*/
|
||||
#define ZYCORE_VERSION_BUILD(version) (ZyanU16)(version & 0x000000000000FFFF)
|
||||
#define ZYCORE_VERSION_BUILD(version) (version & 0x000000000000FFFF)
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
+219
@@ -0,0 +1,219 @@
|
||||
project(
|
||||
'Zycore',
|
||||
'c',
|
||||
version: '1.5.2',
|
||||
license: 'MIT',
|
||||
license_files: 'LICENSE',
|
||||
meson_version: '>=1.3',
|
||||
default_options: [
|
||||
'c_std=c11',
|
||||
'cpp_std=c++17,vc++17',
|
||||
'warning_level=3',
|
||||
],
|
||||
)
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
if cc.get_argument_syntax() == 'msvc'
|
||||
if get_option('b_lto')
|
||||
add_project_arguments(
|
||||
'/GL', # -flto
|
||||
language: ['c', 'cpp'],
|
||||
)
|
||||
add_project_link_arguments(
|
||||
'/LTCG',
|
||||
language: ['c', 'cpp'],
|
||||
)
|
||||
endif
|
||||
endif
|
||||
|
||||
inc = include_directories('include')
|
||||
|
||||
dep = []
|
||||
|
||||
hdrs_api = files(
|
||||
# API
|
||||
'include/Zycore/API/Memory.h',
|
||||
'include/Zycore/API/Process.h',
|
||||
'include/Zycore/API/Synchronization.h',
|
||||
'include/Zycore/API/Terminal.h',
|
||||
'include/Zycore/API/Thread.h',
|
||||
)
|
||||
|
||||
hdrs_common = files(
|
||||
# Common
|
||||
'include/Zycore/Allocator.h',
|
||||
'include/Zycore/ArgParse.h',
|
||||
'include/Zycore/Atomic.h',
|
||||
'include/Zycore/Bitset.h',
|
||||
'include/Zycore/Comparison.h',
|
||||
'include/Zycore/Defines.h',
|
||||
'include/Zycore/Format.h',
|
||||
'include/Zycore/LibC.h',
|
||||
'include/Zycore/List.h',
|
||||
'include/Zycore/Object.h',
|
||||
'include/Zycore/Status.h',
|
||||
'include/Zycore/String.h',
|
||||
'include/Zycore/Types.h',
|
||||
'include/Zycore/Vector.h',
|
||||
'include/Zycore/Zycore.h',
|
||||
)
|
||||
|
||||
hdrs_internal = files(
|
||||
'include/Zycore/Internal/AtomicGNU.h',
|
||||
'include/Zycore/Internal/AtomicMSVC.h',
|
||||
)
|
||||
|
||||
hdrs = hdrs_api + hdrs_common + hdrs_internal
|
||||
|
||||
src = files(
|
||||
# API
|
||||
'src/API/Memory.c',
|
||||
'src/API/Process.c',
|
||||
'src/API/Synchronization.c',
|
||||
'src/API/Terminal.c',
|
||||
'src/API/Thread.c',
|
||||
# Common
|
||||
'src/Allocator.c',
|
||||
'src/ArgParse.c',
|
||||
'src/Bitset.c',
|
||||
'src/Format.c',
|
||||
'src/List.c',
|
||||
'src/String.c',
|
||||
'src/Vector.c',
|
||||
'src/Zycore.c',
|
||||
)
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
windows = import('windows')
|
||||
src += windows.compile_resources('resources/VersionInfo.rc')
|
||||
endif
|
||||
|
||||
nolibc = get_option('nolibc')
|
||||
|
||||
examples = get_option('examples')
|
||||
doc = get_option('doc')
|
||||
tests = get_option('tests')
|
||||
|
||||
# Extra targets
|
||||
examples = examples.require(not nolibc)
|
||||
tests = tests.require(not nolibc)
|
||||
|
||||
doc = doc.disable_auto_if(meson.is_subproject())
|
||||
examples = examples.disable_auto_if(meson.is_subproject())
|
||||
tests = tests.disable_auto_if(meson.is_subproject())
|
||||
|
||||
if nolibc
|
||||
add_project_arguments(
|
||||
'-DZYAN_NO_LIBC',
|
||||
'-fno-stack-protector',
|
||||
language: 'c',
|
||||
)
|
||||
elif host_machine.system() == 'linux'
|
||||
add_project_arguments(
|
||||
'-D_GNU_SOURCE',
|
||||
language: 'c',
|
||||
)
|
||||
dep += dependency('threads')
|
||||
endif
|
||||
|
||||
zycore_lib = library(
|
||||
'Zycore',
|
||||
src + hdrs,
|
||||
c_static_args: ['-DZYCORE_STATIC_BUILD'],
|
||||
c_shared_args: ['-DZYCORE_SHOULD_EXPORT'],
|
||||
link_args: (nolibc and cc.get_linker_id().startswith('ld.')) ? ['-nostdlib', '-nodefaultlibs'] : [],
|
||||
gnu_symbol_visibility: 'hidden',
|
||||
include_directories: inc,
|
||||
implicit_include_directories: false,
|
||||
dependencies: dep,
|
||||
version: meson.project_version(),
|
||||
install: true,
|
||||
)
|
||||
|
||||
install_headers(hdrs_common, subdir: 'Zycore')
|
||||
install_headers(hdrs_api, subdir: 'Zycore/API')
|
||||
install_headers(hdrs_internal, subdir: 'Zycore/Internal')
|
||||
|
||||
extra_cflags = nolibc ? ['-DZYAN_NO_LIBC'] : []
|
||||
|
||||
# Note: on MSVC, define ZYCORE_STATIC_BUILD accordingly in the user project.
|
||||
zycore_dep = declare_dependency(
|
||||
include_directories: inc,
|
||||
link_with: zycore_lib,
|
||||
compile_args: extra_cflags,
|
||||
)
|
||||
|
||||
subdir('examples')
|
||||
subdir('tests')
|
||||
|
||||
pkg = import('pkgconfig')
|
||||
pkg.generate(
|
||||
zycore_lib,
|
||||
name: 'zycore',
|
||||
description: 'Zyan Core Library for C',
|
||||
url: 'https://github.com/zyantific/zycore-c',
|
||||
extra_cflags: extra_cflags,
|
||||
)
|
||||
|
||||
meson.override_dependency('zycore', zycore_dep)
|
||||
|
||||
doxygen_exe = find_program('doxygen', required: doc)
|
||||
doc_req = doxygen_exe.found()
|
||||
if doc_req
|
||||
cdata = configuration_data()
|
||||
cdata.set('VERSION', meson.project_version())
|
||||
cdata.set('TOP_SRCDIR', meson.project_source_root())
|
||||
cdata.set('TOP_BUILDDIR', meson.project_build_root())
|
||||
|
||||
dot_exe = find_program('dot', required: false)
|
||||
if dot_exe.found()
|
||||
cdata.set('HAVE_DOT', 'YES')
|
||||
cdata.set('DOT_PATH', dot_exe.full_path())
|
||||
cdata.set(
|
||||
'HAVE_DOT_1_8_10',
|
||||
dot_exe.version().version_compare('>=1.8.10') ? 'YES' : 'NO',
|
||||
)
|
||||
else
|
||||
cdata.set('HAVE_DOT', 'NO')
|
||||
endif
|
||||
|
||||
if find_program('pdf2svg', required: false).found() or find_program('inkscape', required: false).found()
|
||||
cdata.set('HTML_FORMULA_FORMAT', 'svg')
|
||||
else
|
||||
cdata.set('HTML_FORMULA_FORMAT', 'png')
|
||||
endif
|
||||
|
||||
cdata.set('PREDEFINED', nolibc ? 'ZYAN_NO_LIBC' : '')
|
||||
|
||||
doxyfile = configure_file(
|
||||
input: 'Doxyfile.in',
|
||||
output: 'Doxyfile',
|
||||
configuration: cdata,
|
||||
install: false,
|
||||
)
|
||||
|
||||
datadir = join_paths(get_option('datadir'), 'doc', 'Zycore')
|
||||
custom_target(
|
||||
'ZycoreDoc',
|
||||
input: doxyfile,
|
||||
output: 'doc',
|
||||
command: [doxygen_exe, doxyfile],
|
||||
depend_files: [hdrs],
|
||||
install: true,
|
||||
install_dir: datadir,
|
||||
)
|
||||
|
||||
summary(
|
||||
{
|
||||
'dot': cdata.get('HAVE_DOT') == 'YES',
|
||||
'formula format': cdata.get('HTML_FORMULA_FORMAT'),
|
||||
},
|
||||
section: 'Doxygen',
|
||||
)
|
||||
endif
|
||||
|
||||
summary(
|
||||
{'doc': doc_req, 'nolibc': nolibc},
|
||||
section: 'Features',
|
||||
)
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
option(
|
||||
'nolibc',
|
||||
type: 'boolean',
|
||||
value: false,
|
||||
description: 'Do not use any C standard library functions (for exotic build-envs like kernel drivers)',
|
||||
yield: true,
|
||||
)
|
||||
option(
|
||||
'doc',
|
||||
type: 'feature',
|
||||
description: 'Build doxygen documentation (requires Doxygen)',
|
||||
)
|
||||
option(
|
||||
'examples',
|
||||
type: 'feature',
|
||||
description: 'Build examples',
|
||||
)
|
||||
option(
|
||||
'tests',
|
||||
type: 'feature',
|
||||
description: 'Build tests',
|
||||
)
|
||||
+5
-5
@@ -27,8 +27,8 @@
|
||||
#include "winres.h"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,4,1,0
|
||||
PRODUCTVERSION 1,4,1,0
|
||||
FILEVERSION 1,5,2,0
|
||||
PRODUCTVERSION 1,5,2,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -45,12 +45,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "zyantific"
|
||||
VALUE "FileDescription", "Zyan Core Library for C"
|
||||
VALUE "FileVersion", "1.4.1.0"
|
||||
VALUE "FileVersion", "1.5.2.0"
|
||||
VALUE "InternalName", "Zycore"
|
||||
VALUE "LegalCopyright", "Copyright © 2018-2022 by zyantific.com"
|
||||
VALUE "LegalCopyright", "Copyright \xA9 2018-2025 by zyantific.com"
|
||||
VALUE "OriginalFilename", "Zycore.dll"
|
||||
VALUE "ProductName", "Zyan Core Library for C"
|
||||
VALUE "ProductVersion", "1.4.1.0"
|
||||
VALUE "ProductVersion", "1.5.2.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
+4
-4
@@ -83,7 +83,7 @@ static const ZyanStringView STR_SUB = ZYAN_DEFINE_STRING_VIEW("-");
|
||||
/* Decimal */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#if defined(ZYAN_X86) || defined(ZYAN_ARM) || defined(ZYAN_EMSCRIPTEN) || defined(ZYAN_WASM) || defined(ZYAN_PPC)
|
||||
#if ZYAN_ARCHITECTURE_WIDTH != 64
|
||||
ZyanStatus ZyanStringAppendDecU32(ZyanString* string, ZyanU32 value, ZyanU8 padding_length)
|
||||
{
|
||||
if (!string)
|
||||
@@ -179,7 +179,7 @@ ZyanStatus ZyanStringAppendDecU64(ZyanString* string, ZyanU64 value, ZyanU8 padd
|
||||
/* Hexadecimal */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#if defined(ZYAN_X86) || defined(ZYAN_ARM) || defined(ZYAN_EMSCRIPTEN) || defined(ZYAN_WASM) || defined(ZYAN_PPC)
|
||||
#if ZYAN_ARCHITECTURE_WIDTH != 64
|
||||
ZyanStatus ZyanStringAppendHexU32(ZyanString* string, ZyanU32 value, ZyanU8 padding_length,
|
||||
ZyanBool uppercase)
|
||||
{
|
||||
@@ -423,7 +423,7 @@ ZyanStatus ZyanStringAppendFormat(ZyanString* string, const char* format, ...)
|
||||
|
||||
ZyanStatus ZyanStringAppendDecU(ZyanString* string, ZyanU64 value, ZyanU8 padding_length)
|
||||
{
|
||||
#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64) || defined(ZYAN_RISCV64) || defined(ZYAN_LOONGARCH)
|
||||
#if ZYAN_ARCHITECTURE_WIDTH == 64
|
||||
return ZyanStringAppendDecU64(string, value, padding_length);
|
||||
#else
|
||||
// Working with 64-bit values is slow on non 64-bit systems
|
||||
@@ -464,7 +464,7 @@ ZyanStatus ZyanStringAppendDecS(ZyanString* string, ZyanI64 value, ZyanU8 paddin
|
||||
ZyanStatus ZyanStringAppendHexU(ZyanString* string, ZyanU64 value, ZyanU8 padding_length,
|
||||
ZyanBool uppercase)
|
||||
{
|
||||
#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64) || defined(ZYAN_RISCV64) || defined(ZYAN_LOONGARCH)
|
||||
#if ZYAN_ARCHITECTURE_WIDTH == 64
|
||||
return ZyanStringAppendHexU64(string, value, padding_length, uppercase);
|
||||
#else
|
||||
// Working with 64-bit values is slow on non 64-bit systems
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
[wrap-file]
|
||||
directory = googletest-1.15.0
|
||||
source_url = https://github.com/google/googletest/archive/refs/tags/v1.15.0.tar.gz
|
||||
source_filename = gtest-1.15.0.tar.gz
|
||||
source_hash = 7315acb6bf10e99f332c8a43f00d5fbb1ee6ca48c52f6b936991b216c586aaad
|
||||
patch_filename = gtest_1.15.0-1_patch.zip
|
||||
patch_url = https://wrapdb.mesonbuild.com/v2/gtest_1.15.0-1/get_patch
|
||||
patch_hash = 5f8e484c48fdc1029c7fd08807bd2615f8c9d16f90df6d81984f4f292752c925
|
||||
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/gtest_1.15.0-1/gtest-1.15.0.tar.gz
|
||||
wrapdb_version = 1.15.0-1
|
||||
|
||||
[provide]
|
||||
gtest = gtest_dep
|
||||
gtest_main = gtest_main_dep
|
||||
gmock = gmock_dep
|
||||
gmock_main = gmock_main_dep
|
||||
+1
-1
@@ -57,7 +57,7 @@ auto cvt_string_view(const ZyanStringView *sv)
|
||||
/* Unnamed args */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
static auto UnnamedArgTest(ZyanU64 min, ZyanU64 max)
|
||||
static auto UnnamedArgTest(ZyanUSize min, ZyanUSize max)
|
||||
{
|
||||
const char* argv[]
|
||||
{
|
||||
|
||||
+106
-3
@@ -30,7 +30,11 @@
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <Zycore/Allocator.h>
|
||||
#include <Zycore/Defines.h>
|
||||
#include <Zycore/LibC.h>
|
||||
#include <Zycore/String.h>
|
||||
#include <Zycore/Types.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Enums and types */
|
||||
@@ -42,17 +46,116 @@
|
||||
/* Helper functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Custom allocator */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
static ZyanStatus AllocatorAllocate(
|
||||
ZyanAllocator* allocator, void** p, ZyanUSize element_size, ZyanUSize n) {
|
||||
ZYAN_ASSERT(allocator);
|
||||
ZYAN_ASSERT(p);
|
||||
ZYAN_ASSERT(element_size);
|
||||
ZYAN_ASSERT(n);
|
||||
|
||||
ZYAN_UNUSED(allocator);
|
||||
|
||||
*p = ZYAN_MALLOC(element_size * n);
|
||||
if (!*p) {
|
||||
return ZYAN_STATUS_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static ZyanStatus AllocatorReallocate(
|
||||
ZyanAllocator* allocator, void** p, ZyanUSize element_size, ZyanUSize n) {
|
||||
ZYAN_ASSERT(allocator);
|
||||
ZYAN_ASSERT(p);
|
||||
ZYAN_ASSERT(element_size);
|
||||
ZYAN_ASSERT(n);
|
||||
|
||||
ZYAN_UNUSED(allocator);
|
||||
|
||||
void* const x = ZYAN_REALLOC(*p, element_size * n);
|
||||
if (!x) {
|
||||
return ZYAN_STATUS_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
*p = x;
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static ZyanStatus AllocatorDeallocate(
|
||||
ZyanAllocator* allocator, void* p, ZyanUSize element_size, ZyanUSize n) {
|
||||
ZYAN_ASSERT(allocator);
|
||||
ZYAN_ASSERT(p);
|
||||
ZYAN_ASSERT(element_size);
|
||||
ZYAN_ASSERT(n);
|
||||
|
||||
ZYAN_UNUSED(allocator);
|
||||
ZYAN_UNUSED(element_size);
|
||||
ZYAN_UNUSED(n);
|
||||
|
||||
ZYAN_FREE(p);
|
||||
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Tests */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
TEST(StringTest, InitDynamic)
|
||||
{
|
||||
ZyanString string;
|
||||
|
||||
ASSERT_EQ(ZyanStringInit(&string, 0), ZYAN_STATUS_SUCCESS);
|
||||
EXPECT_EQ(string.vector.allocator, ZyanAllocatorDefault());
|
||||
EXPECT_EQ(string.vector.growth_factor, ZYAN_STRING_DEFAULT_GROWTH_FACTOR);
|
||||
EXPECT_EQ(string.vector.shrink_threshold, ZYAN_STRING_DEFAULT_SHRINK_THRESHOLD);
|
||||
EXPECT_EQ(string.vector.size, static_cast<ZyanUSize>(1));
|
||||
EXPECT_EQ(string.vector.capacity, static_cast<ZyanUSize>(ZYAN_STRING_MIN_CAPACITY + 1));
|
||||
EXPECT_EQ(string.vector.element_size, sizeof(char));
|
||||
EXPECT_NE(string.vector.data, ZYAN_NULL);
|
||||
EXPECT_EQ(ZyanStringDestroy(&string), ZYAN_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
TEST(StringTest, InitStatic)
|
||||
{
|
||||
ZyanString string;
|
||||
|
||||
static char buffer[32];
|
||||
EXPECT_EQ(ZyanStringInitCustomBuffer(&string, buffer, 0), ZYAN_STATUS_INVALID_ARGUMENT);
|
||||
ASSERT_EQ(ZyanStringInitCustomBuffer(&string, buffer, ZYAN_ARRAY_LENGTH(buffer)),
|
||||
ZYAN_STATUS_SUCCESS);
|
||||
EXPECT_EQ(string.vector.allocator, ZYAN_NULL);
|
||||
EXPECT_EQ(string.vector.growth_factor, 1);
|
||||
EXPECT_EQ(string.vector.shrink_threshold, 0);
|
||||
EXPECT_EQ(string.vector.size, static_cast<ZyanUSize>(1));
|
||||
EXPECT_EQ(string.vector.capacity, ZYAN_ARRAY_LENGTH(buffer));
|
||||
EXPECT_EQ(string.vector.element_size, sizeof(char));
|
||||
EXPECT_EQ(string.vector.data, &buffer);
|
||||
EXPECT_EQ(ZyanStringDestroy(&string), ZYAN_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
TEST(StringTest, InitAdvanced)
|
||||
{
|
||||
ZyanString string;
|
||||
ZyanAllocator allocator;
|
||||
|
||||
ASSERT_EQ(
|
||||
ZyanAllocatorInit(&allocator, AllocatorAllocate, AllocatorReallocate, AllocatorDeallocate),
|
||||
ZYAN_STATUS_SUCCESS);
|
||||
ASSERT_EQ(ZyanStringInitEx(&string, 0, &allocator, 1, 0), ZYAN_STATUS_SUCCESS);
|
||||
EXPECT_EQ(string.vector.allocator, &allocator);
|
||||
EXPECT_EQ(string.vector.growth_factor, 1);
|
||||
EXPECT_EQ(string.vector.shrink_threshold, 0);
|
||||
EXPECT_EQ(string.vector.size, static_cast<ZyanUSize>(1));
|
||||
EXPECT_EQ(string.vector.capacity, static_cast<ZyanUSize>(ZYAN_STRING_MIN_CAPACITY + 1));
|
||||
EXPECT_EQ(string.vector.element_size, sizeof(char));
|
||||
EXPECT_NE(string.vector.data, ZYAN_NULL);
|
||||
EXPECT_EQ(ZyanStringDestroy(&string), ZYAN_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
+1
-2
@@ -129,10 +129,9 @@ static ZyanStatus InitZyanU64(ZyanU64* object)
|
||||
*
|
||||
* @return A zyan status code.
|
||||
*/
|
||||
static ZyanStatus FreeZyanU16(ZyanU16* object)
|
||||
static void FreeZyanU16(ZyanU16* object)
|
||||
{
|
||||
*object = 0;
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* ============================================================================================== */
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
gtest_dep = dependency('gtest', required: tests)
|
||||
|
||||
tests_req = gtest_dep.found() and add_languages('cpp', native: false, required: tests)
|
||||
|
||||
if tests_req
|
||||
test(
|
||||
'string',
|
||||
executable(
|
||||
'test_string',
|
||||
'String.cpp',
|
||||
dependencies: [gtest_dep, zycore_dep],
|
||||
),
|
||||
protocol: 'gtest',
|
||||
)
|
||||
test(
|
||||
'vector',
|
||||
executable(
|
||||
'test_vector',
|
||||
'Vector.cpp',
|
||||
dependencies: [gtest_dep, zycore_dep],
|
||||
),
|
||||
protocol: 'gtest',
|
||||
)
|
||||
test(
|
||||
'argparse',
|
||||
executable(
|
||||
'test_argparse',
|
||||
'ArgParse.cpp',
|
||||
dependencies: [gtest_dep, zycore_dep],
|
||||
),
|
||||
protocol: 'gtest',
|
||||
)
|
||||
endif
|
||||
|
||||
summary(
|
||||
{'tests': tests_req},
|
||||
section: 'Features',
|
||||
)
|
||||
+54
-31
@@ -37,7 +37,7 @@
|
||||
# include <windows.h>
|
||||
#elif defined(ZYAN_APPLE)
|
||||
# include <mach/mach_time.h>
|
||||
#elif defined(ZYAN_LINUX) || defined(ZYAN_SOLARIS)
|
||||
#elif defined(ZYAN_LINUX) || defined(ZYAN_SOLARIS) || defined(ZYAN_HAIKU)
|
||||
# include <sys/time.h>
|
||||
# include <pthread.h>
|
||||
#elif defined(ZYAN_FREEBSD)
|
||||
@@ -147,7 +147,7 @@ static double GetCounter(void)
|
||||
return (double)elapsed * timebase_info.numer / timebase_info.denom / 1000000;
|
||||
}
|
||||
|
||||
#elif defined(ZYAN_LINUX) || defined(ZYAN_FREEBSD) || defined(ZYAN_SOLARIS)
|
||||
#elif defined(ZYAN_LINUX) || defined(ZYAN_FREEBSD) || defined(ZYAN_SOLARIS) || defined(ZYAN_HAIKU)
|
||||
|
||||
struct timeval t1;
|
||||
|
||||
@@ -223,6 +223,17 @@ static void AdjustProcessAndThreadPriority(void)
|
||||
/* Internal functions */
|
||||
/* ============================================================================================== */
|
||||
|
||||
typedef enum TestEncoding_
|
||||
{
|
||||
TEST_ENCODING_DEFAULT,
|
||||
TEST_ENCODING_3DNOW,
|
||||
TEST_ENCODING_XOP,
|
||||
TEST_ENCODING_VEX_C4,
|
||||
TEST_ENCODING_VEX_C5,
|
||||
TEST_ENCODING_EVEX,
|
||||
TEST_ENCODING_MVEX
|
||||
} TestEncoding;
|
||||
|
||||
typedef struct TestContext_
|
||||
{
|
||||
ZydisDecoderContext context;
|
||||
@@ -364,7 +375,7 @@ static void TestPerformance(const ZyanU8* buffer, ZyanUSize length, ZyanBool min
|
||||
CVT100_OUT(COLOR_VALUE_G), GetCounter(), CVT100_OUT(COLOR_DEFAULT));
|
||||
}
|
||||
|
||||
static void GenerateTestData(FILE* file, ZyanU8 encoding)
|
||||
static void GenerateTestData(FILE* file, TestEncoding encoding)
|
||||
{
|
||||
ZydisDecoder decoder;
|
||||
if (!ZYAN_SUCCESS(
|
||||
@@ -375,6 +386,16 @@ static void GenerateTestData(FILE* file, ZyanU8 encoding)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (encoding == TEST_ENCODING_MVEX)
|
||||
{
|
||||
if (!ZYAN_SUCCESS(ZydisDecoderEnableMode(&decoder, ZYDIS_DECODER_MODE_KNC, ZYAN_TRUE)))
|
||||
{
|
||||
ZYAN_FPRINTF(ZYAN_STDERR, "%sFailed to enable KNC mode%s\n", CVT100_ERR(COLOR_ERROR),
|
||||
CVT100_ERR(ZYAN_VT100SGR_RESET));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
ZyanU8 last = 0;
|
||||
ZyanU32 count = 0;
|
||||
ZydisDecodedInstruction instruction;
|
||||
@@ -388,23 +409,23 @@ static void GenerateTestData(FILE* file, ZyanU8 encoding)
|
||||
const ZyanU8 offset = rand() % (ZYDIS_MAX_INSTRUCTION_LENGTH - 2);
|
||||
switch (encoding)
|
||||
{
|
||||
case 0:
|
||||
case TEST_ENCODING_DEFAULT:
|
||||
break;
|
||||
case 1:
|
||||
case TEST_ENCODING_3DNOW:
|
||||
data[offset ] = 0x0F;
|
||||
data[offset + 1] = 0x0F;
|
||||
break;
|
||||
case 2:
|
||||
case TEST_ENCODING_XOP:
|
||||
data[offset ] = 0x8F;
|
||||
break;
|
||||
case 3:
|
||||
case TEST_ENCODING_VEX_C4:
|
||||
data[offset ] = 0xC4;
|
||||
break;
|
||||
case 4:
|
||||
case TEST_ENCODING_VEX_C5:
|
||||
data[offset ] = 0xC5;
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
case TEST_ENCODING_EVEX:
|
||||
case TEST_ENCODING_MVEX:
|
||||
data[offset ] = 0x62;
|
||||
break;
|
||||
default:
|
||||
@@ -416,23 +437,24 @@ static void GenerateTestData(FILE* file, ZyanU8 encoding)
|
||||
ZyanBool b = ZYAN_FALSE;
|
||||
switch (encoding)
|
||||
{
|
||||
case 0:
|
||||
b = (instruction.encoding == ZYDIS_INSTRUCTION_ENCODING_LEGACY);
|
||||
case TEST_ENCODING_DEFAULT:
|
||||
b = (instruction.encoding == ZYDIS_INSTRUCTION_ENCODING_LEGACY) ||
|
||||
(instruction.encoding == ZYDIS_INSTRUCTION_ENCODING_REX2);
|
||||
break;
|
||||
case 1:
|
||||
case TEST_ENCODING_3DNOW:
|
||||
b = (instruction.encoding == ZYDIS_INSTRUCTION_ENCODING_3DNOW);
|
||||
break;
|
||||
case 2:
|
||||
case TEST_ENCODING_XOP:
|
||||
b = (instruction.encoding == ZYDIS_INSTRUCTION_ENCODING_XOP);
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
case TEST_ENCODING_VEX_C4:
|
||||
case TEST_ENCODING_VEX_C5:
|
||||
b = (instruction.encoding == ZYDIS_INSTRUCTION_ENCODING_VEX);
|
||||
break;
|
||||
case 5:
|
||||
case TEST_ENCODING_EVEX:
|
||||
b = (instruction.encoding == ZYDIS_INSTRUCTION_ENCODING_EVEX);
|
||||
break;
|
||||
case 6:
|
||||
case TEST_ENCODING_MVEX:
|
||||
b = (instruction.encoding == ZYDIS_INSTRUCTION_ENCODING_MVEX);
|
||||
break;
|
||||
default:
|
||||
@@ -490,17 +512,18 @@ int main(int argc, char** argv)
|
||||
|
||||
static const struct
|
||||
{
|
||||
const char* encoding;
|
||||
TestEncoding encoding;
|
||||
const char* encoding_name;
|
||||
const char* filename;
|
||||
} tests[7] =
|
||||
} tests[] =
|
||||
{
|
||||
{ "DEFAULT", "enc_default.dat" },
|
||||
{ "3DNOW" , "enc_3dnow.dat" },
|
||||
{ "XOP" , "enc_xop.dat" },
|
||||
{ "VEX_C4" , "enc_vex_c4.dat" },
|
||||
{ "VEX_C5" , "enc_vex_c5.dat" },
|
||||
{ "EVEX" , "enc_evex.dat" },
|
||||
{ "MVEX" , "enc_mvex.dat" }
|
||||
{ TEST_ENCODING_DEFAULT, "DEFAULT", "enc_default.dat" },
|
||||
{ TEST_ENCODING_3DNOW , "3DNOW" , "enc_3dnow.dat" },
|
||||
{ TEST_ENCODING_XOP , "XOP" , "enc_xop.dat" },
|
||||
{ TEST_ENCODING_VEX_C4 , "VEX_C4" , "enc_vex_c4.dat" },
|
||||
{ TEST_ENCODING_VEX_C5 , "VEX_C5" , "enc_vex_c5.dat" },
|
||||
{ TEST_ENCODING_EVEX , "EVEX" , "enc_evex.dat" },
|
||||
{ TEST_ENCODING_MVEX , "MVEX" , "enc_mvex.dat" }
|
||||
};
|
||||
|
||||
if (generate)
|
||||
@@ -536,9 +559,9 @@ int main(int argc, char** argv)
|
||||
|
||||
if (generate)
|
||||
{
|
||||
ZYAN_PRINTF("Generating %s%s%s ...\n", CVT100_OUT(COLOR_VALUE_B), tests[i].encoding,
|
||||
CVT100_OUT(ZYAN_VT100SGR_RESET));
|
||||
GenerateTestData(file, i);
|
||||
ZYAN_PRINTF("Generating %s%s%s ...\n", CVT100_OUT(COLOR_VALUE_B),
|
||||
tests[i].encoding_name, CVT100_OUT(ZYAN_VT100SGR_RESET));
|
||||
GenerateTestData(file, tests[i].encoding);
|
||||
} else
|
||||
{
|
||||
fseek(file, 0L, SEEK_END);
|
||||
@@ -563,7 +586,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
ZYAN_PRINTF("%sTesting %s%s%s ...\n", CVT100_OUT(ZYAN_VT100SGR_FG_MAGENTA),
|
||||
CVT100_OUT(ZYAN_VT100SGR_FG_BRIGHT_MAGENTA), tests[i].encoding,
|
||||
CVT100_OUT(ZYAN_VT100SGR_FG_BRIGHT_MAGENTA), tests[i].encoding_name,
|
||||
CVT100_OUT(COLOR_DEFAULT));
|
||||
TestPerformance(buffer, length, ZYAN_TRUE , ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE);
|
||||
TestPerformance(buffer, length, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE);
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
examples_req = examples.enabled()
|
||||
|
||||
if examples_req
|
||||
if decoder.enabled() and formatter.enabled()
|
||||
executable('DisassembleSimple', 'DisassembleSimple.c', dependencies: [zydis_dep])
|
||||
executable('Disassemble', 'Disassemble.c', dependencies: [zydis_dep])
|
||||
executable('Formatter01', 'Formatter01.c', dependencies: [zydis_dep])
|
||||
executable('Formatter02', 'Formatter02.c', dependencies: [zydis_dep])
|
||||
executable('Formatter03', 'Formatter03.c', dependencies: [zydis_dep])
|
||||
executable(
|
||||
'ZydisPerfTest',
|
||||
'ZydisPerfTest.c',
|
||||
c_args: host_machine.system() in ['linux', 'freebsd'] ? ['-D_GNU_SOURCE'] : [],
|
||||
dependencies: [zydis_dep],
|
||||
)
|
||||
endif
|
||||
|
||||
if encoder.enabled()
|
||||
executable('EncodeMov', 'EncodeMov.c', dependencies: [zydis_dep])
|
||||
executable('EncodeFromScratch', 'EncodeFromScratch.c', dependencies: [zydis_dep])
|
||||
executable('RewriteCode', 'RewriteCode.c', dependencies: [zydis_dep])
|
||||
endif
|
||||
endif
|
||||
|
||||
summary(
|
||||
{'examples': examples_req},
|
||||
section: 'Features',
|
||||
)
|
||||
+24
-2
@@ -82,7 +82,12 @@ typedef enum ZydisDecoderMode_
|
||||
* Enables `KNC` compatibility-mode.
|
||||
*
|
||||
* `KNC` and `KNL+` chips are sharing opcodes and encodings for some mask-related instructions.
|
||||
* Enable this mode to use the old `KNC` specifications (different mnemonics, operands, ..).
|
||||
* With the EVEX extensions introduced with APX, it's impossible to distinguish between EVEX
|
||||
* and MVEX at runtime.
|
||||
*
|
||||
* Enable this mode to enable KNC support.
|
||||
*
|
||||
* WARNING: This will disable decoding of all AVX-512 (EVEX) instructions.
|
||||
*
|
||||
* This mode is NOT enabled by default.
|
||||
*/
|
||||
@@ -144,11 +149,28 @@ typedef enum ZydisDecoderMode_
|
||||
* This mode is enabled by default.
|
||||
*/
|
||||
ZYDIS_DECODER_MODE_IPREFETCH,
|
||||
/**
|
||||
* Enables the `UD0` compatibility mode.
|
||||
*
|
||||
* Some processors decode the `UD0` instruction without a ModR/M byte. Enable this decoder mode
|
||||
* to mimic this behavior.
|
||||
*
|
||||
* This mode is disabled by default.
|
||||
*/
|
||||
ZYDIS_DECODER_MODE_UD0_COMPAT,
|
||||
/**
|
||||
* Enables the `APX` mode.
|
||||
*
|
||||
* APX introduces the `REX2` prefix, new EVEX spaces and access to additional GPRs.
|
||||
*
|
||||
* This mode is enabled by default.
|
||||
*/
|
||||
ZYDIS_DECODER_MODE_APX,
|
||||
|
||||
/**
|
||||
* Maximum value of this enum.
|
||||
*/
|
||||
ZYDIS_DECODER_MODE_MAX_VALUE = ZYDIS_DECODER_MODE_IPREFETCH,
|
||||
ZYDIS_DECODER_MODE_MAX_VALUE = ZYDIS_DECODER_MODE_APX,
|
||||
/**
|
||||
* The minimum number of bits required to represent all values of this enum.
|
||||
*/
|
||||
|
||||
+272
-26
@@ -63,7 +63,7 @@ typedef ZyanU8 ZydisOperandAttributes;
|
||||
*
|
||||
* Example: ZMM3 -> [ZMM3..ZMM6]
|
||||
*/
|
||||
#define ZYDIS_OATTRIB_IS_MULTISOURCE4 0x01 // (1 << 0)
|
||||
#define ZYDIS_OATTRIB_IS_MULTISOURCE4 (1 << 0)
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Memory type */
|
||||
@@ -149,14 +149,19 @@ typedef struct ZydisDecodedOperandMem_
|
||||
*/
|
||||
struct ZydisDecodedOperandMemDisp_
|
||||
{
|
||||
/**
|
||||
* Signals, if the displacement value is used.
|
||||
*/
|
||||
ZyanBool has_displacement;
|
||||
/**
|
||||
* The displacement value
|
||||
*/
|
||||
ZyanI64 value;
|
||||
/**
|
||||
* The offset of the displacement data, relative to the beginning of the
|
||||
* instruction, in bytes.
|
||||
*/
|
||||
ZyanU8 offset;
|
||||
/**
|
||||
* The physical displacement size, in bits.
|
||||
*/
|
||||
ZyanU8 size;
|
||||
} disp;
|
||||
} ZydisDecodedOperandMem;
|
||||
|
||||
@@ -178,6 +183,10 @@ typedef struct ZydisDecodedOperandImm_
|
||||
* Signals, if the immediate value is signed.
|
||||
*/
|
||||
ZyanBool is_signed;
|
||||
/**
|
||||
* Signals, if the immediate value contains an address.
|
||||
*/
|
||||
ZyanBool is_address;
|
||||
/**
|
||||
* Signals, if the immediate value contains a relative offset. You can use
|
||||
* `ZydisCalcAbsoluteAddress` to determine the absolute address value.
|
||||
@@ -191,6 +200,15 @@ typedef struct ZydisDecodedOperandImm_
|
||||
ZyanU64 u;
|
||||
ZyanI64 s;
|
||||
} value;
|
||||
/**
|
||||
* The offset of the immediate data, relative to the beginning of the
|
||||
* instruction, in bytes.
|
||||
*/
|
||||
ZyanU8 offset;
|
||||
/**
|
||||
* The physical immediate size, in bits.
|
||||
*/
|
||||
ZyanU8 size;
|
||||
} ZydisDecodedOperandImm;
|
||||
|
||||
/**
|
||||
@@ -431,11 +449,15 @@ typedef enum ZydisBranchType_
|
||||
* The instruction is a far (inter-segment) branch instruction.
|
||||
*/
|
||||
ZYDIS_BRANCH_TYPE_FAR,
|
||||
/**
|
||||
* The instruction is an absolute 64-bit branch instruction.
|
||||
*/
|
||||
ZYDIS_BRANCH_TYPE_ABSOLUTE,
|
||||
|
||||
/**
|
||||
* Maximum value of this enum.
|
||||
*/
|
||||
ZYDIS_BRANCH_TYPE_MAX_VALUE = ZYDIS_BRANCH_TYPE_FAR,
|
||||
ZYDIS_BRANCH_TYPE_MAX_VALUE = ZYDIS_BRANCH_TYPE_ABSOLUTE,
|
||||
/**
|
||||
* The minimum number of bits required to represent all values of this enum.
|
||||
*/
|
||||
@@ -469,6 +491,7 @@ typedef enum ZydisExceptionClass_
|
||||
ZYDIS_EXCEPTION_CLASS_AVX8,
|
||||
ZYDIS_EXCEPTION_CLASS_AVX11,
|
||||
ZYDIS_EXCEPTION_CLASS_AVX12,
|
||||
ZYDIS_EXCEPTION_CLASS_AVX14,
|
||||
ZYDIS_EXCEPTION_CLASS_E1,
|
||||
ZYDIS_EXCEPTION_CLASS_E1NF,
|
||||
ZYDIS_EXCEPTION_CLASS_E2,
|
||||
@@ -498,11 +521,36 @@ typedef enum ZydisExceptionClass_
|
||||
ZYDIS_EXCEPTION_CLASS_AMXE4,
|
||||
ZYDIS_EXCEPTION_CLASS_AMXE5,
|
||||
ZYDIS_EXCEPTION_CLASS_AMXE6,
|
||||
ZYDIS_EXCEPTION_CLASS_AMXE1_EVEX,
|
||||
ZYDIS_EXCEPTION_CLASS_AMXE2_EVEX,
|
||||
ZYDIS_EXCEPTION_CLASS_AMXE3_EVEX,
|
||||
ZYDIS_EXCEPTION_CLASS_AMXE4_EVEX,
|
||||
ZYDIS_EXCEPTION_CLASS_AMXE5_EVEX,
|
||||
ZYDIS_EXCEPTION_CLASS_AMXE6_EVEX,
|
||||
ZYDIS_EXCEPTION_CLASS_APX_EVEX_INT,
|
||||
ZYDIS_EXCEPTION_CLASS_APX_EVEX_KEYLOCKER,
|
||||
ZYDIS_EXCEPTION_CLASS_APX_EVEX_BMI,
|
||||
ZYDIS_EXCEPTION_CLASS_APX_EVEX_CCMP,
|
||||
ZYDIS_EXCEPTION_CLASS_APX_EVEX_CFCMOV,
|
||||
ZYDIS_EXCEPTION_CLASS_APX_EVEX_CMPCCXADD,
|
||||
ZYDIS_EXCEPTION_CLASS_APX_EVEX_ENQCMD,
|
||||
ZYDIS_EXCEPTION_CLASS_APX_EVEX_INVEPT,
|
||||
ZYDIS_EXCEPTION_CLASS_APX_EVEX_INVPCID,
|
||||
ZYDIS_EXCEPTION_CLASS_APX_EVEX_INVVPID,
|
||||
ZYDIS_EXCEPTION_CLASS_APX_EVEX_KMOV,
|
||||
ZYDIS_EXCEPTION_CLASS_APX_EVEX_PP2,
|
||||
ZYDIS_EXCEPTION_CLASS_APX_EVEX_SHA,
|
||||
ZYDIS_EXCEPTION_CLASS_APX_EVEX_CET_WRSS,
|
||||
ZYDIS_EXCEPTION_CLASS_APX_EVEX_CET_WRUSS,
|
||||
ZYDIS_EXCEPTION_CLASS_APX_LEGACY_JMPABS,
|
||||
ZYDIS_EXCEPTION_CLASS_APX_EVEX_RAO_INT,
|
||||
ZYDIS_EXCEPTION_CLASS_USER_MSR_EVEX,
|
||||
ZYDIS_EXCEPTION_CLASS_LEGACY_RAO_INT,
|
||||
|
||||
/**
|
||||
* Maximum value of this enum.
|
||||
*/
|
||||
ZYDIS_EXCEPTION_CLASS_MAX_VALUE = ZYDIS_EXCEPTION_CLASS_AMXE6,
|
||||
ZYDIS_EXCEPTION_CLASS_MAX_VALUE = ZYDIS_EXCEPTION_CLASS_LEGACY_RAO_INT,
|
||||
/**
|
||||
* The minimum number of bits required to represent all values of this enum.
|
||||
*/
|
||||
@@ -518,7 +566,7 @@ typedef enum ZydisExceptionClass_
|
||||
*/
|
||||
typedef enum ZydisMaskMode_
|
||||
{
|
||||
ZYDIS_MASK_MODE_INVALID,
|
||||
ZYDIS_MASK_MODE_NONE,
|
||||
/**
|
||||
* Masking is disabled for the current instruction (`K0` register is used).
|
||||
*/
|
||||
@@ -559,7 +607,7 @@ typedef enum ZydisMaskMode_
|
||||
*/
|
||||
typedef enum ZydisBroadcastMode_
|
||||
{
|
||||
ZYDIS_BROADCAST_MODE_INVALID,
|
||||
ZYDIS_BROADCAST_MODE_NONE,
|
||||
ZYDIS_BROADCAST_MODE_1_TO_2,
|
||||
ZYDIS_BROADCAST_MODE_1_TO_4,
|
||||
ZYDIS_BROADCAST_MODE_1_TO_8,
|
||||
@@ -592,7 +640,7 @@ typedef enum ZydisBroadcastMode_
|
||||
*/
|
||||
typedef enum ZydisRoundingMode_
|
||||
{
|
||||
ZYDIS_ROUNDING_MODE_INVALID,
|
||||
ZYDIS_ROUNDING_MODE_NONE,
|
||||
/**
|
||||
* Round to nearest.
|
||||
*/
|
||||
@@ -629,7 +677,7 @@ typedef enum ZydisRoundingMode_
|
||||
*/
|
||||
typedef enum ZydisSwizzleMode_
|
||||
{
|
||||
ZYDIS_SWIZZLE_MODE_INVALID,
|
||||
ZYDIS_SWIZZLE_MODE_NONE,
|
||||
ZYDIS_SWIZZLE_MODE_DCBA,
|
||||
ZYDIS_SWIZZLE_MODE_CDAB,
|
||||
ZYDIS_SWIZZLE_MODE_BADC,
|
||||
@@ -658,7 +706,7 @@ typedef enum ZydisSwizzleMode_
|
||||
*/
|
||||
typedef enum ZydisConversionMode_
|
||||
{
|
||||
ZYDIS_CONVERSION_MODE_INVALID,
|
||||
ZYDIS_CONVERSION_MODE_NONE,
|
||||
ZYDIS_CONVERSION_MODE_FLOAT16,
|
||||
ZYDIS_CONVERSION_MODE_SINT8,
|
||||
ZYDIS_CONVERSION_MODE_UINT8,
|
||||
@@ -675,6 +723,92 @@ typedef enum ZydisConversionMode_
|
||||
ZYDIS_CONVERSION_MODE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_CONVERSION_MODE_MAX_VALUE)
|
||||
} ZydisConversionMode;
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* APX default flags value */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Defines the `ZydisDefaultFlagsValue` data-type.
|
||||
*/
|
||||
typedef ZyanU8 ZydisDefaultFlagsValue;
|
||||
|
||||
/**
|
||||
* @defgroup decoder_apx_default_flags APX default flags
|
||||
* @ingroup decoder
|
||||
*
|
||||
* Constants used to determine which status flags are set by certain APX
|
||||
* instructions when the source condition code `SCC` evaluates to `false`.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Carry flag.
|
||||
*/
|
||||
#define ZYDIS_DFV_CF (1u << 0)
|
||||
/**
|
||||
* Zero flag.
|
||||
*/
|
||||
#define ZYDIS_DFV_ZF (1u << 1)
|
||||
/**
|
||||
* Sign flag.
|
||||
*/
|
||||
#define ZYDIS_DFV_SF (1u << 2)
|
||||
/**
|
||||
* Overflow flag.
|
||||
*/
|
||||
#define ZYDIS_DFV_OF (1u << 3)
|
||||
|
||||
/**
|
||||
* All default flags clear.
|
||||
*/
|
||||
#define ZYDIS_DFV_NONE 0
|
||||
/**
|
||||
* All default flags set.
|
||||
*/
|
||||
#define ZYDIS_DFV_ALL (ZYDIS_DFV_CF | ZYDIS_DFV_ZF | ZYDIS_DFV_SF | ZYDIS_DFV_OF)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* APX source condition code */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Defines the `ZydisSourceConditionCode` enum.
|
||||
*/
|
||||
typedef enum ZydisSourceConditionCode_
|
||||
{
|
||||
ZYDIS_SCC_NONE,
|
||||
ZYDIS_SCC_O,
|
||||
ZYDIS_SCC_NO,
|
||||
ZYDIS_SCC_B,
|
||||
ZYDIS_SCC_NB,
|
||||
ZYDIS_SCC_Z,
|
||||
ZYDIS_SCC_NZ,
|
||||
ZYDIS_SCC_BE,
|
||||
ZYDIS_SCC_NBE,
|
||||
ZYDIS_SCC_S,
|
||||
ZYDIS_SCC_NS,
|
||||
ZYDIS_SCC_TRUE,
|
||||
ZYDIS_SCC_FALSE,
|
||||
ZYDIS_SCC_L,
|
||||
ZYDIS_SCC_NL,
|
||||
ZYDIS_SCC_LE,
|
||||
ZYDIS_SCC_NLE,
|
||||
|
||||
/**
|
||||
* Maximum value of this enum.
|
||||
*/
|
||||
ZYDIS_SCC_MAX_VALUE = ZYDIS_SCC_NLE,
|
||||
/**
|
||||
* The minimum number of bits required to represent all values of this enum.
|
||||
*/
|
||||
ZYDIS_SCC_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_SCC_MAX_VALUE)
|
||||
} ZydisSourceConditionCode;
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Legacy prefix type */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
@@ -754,6 +888,54 @@ typedef struct ZydisDecodedInstructionRawRex_
|
||||
ZyanU8 offset;
|
||||
} ZydisDecodedInstructionRawRex;
|
||||
|
||||
/**
|
||||
* Detailed info about the `REX2` prefix.
|
||||
*/
|
||||
typedef struct ZydisDecodedInstructionRawRex2_
|
||||
{
|
||||
/**
|
||||
* Legacy map 0 (0x0F) selector bit.
|
||||
*/
|
||||
ZyanU8 M0;
|
||||
/**
|
||||
* Extension of the `ModRM.reg` field (bit 4).
|
||||
*/
|
||||
ZyanU8 R4;
|
||||
/**
|
||||
* Extension of the `SIB.index` field (bit 4).
|
||||
*/
|
||||
ZyanU8 X4;
|
||||
/**
|
||||
* Extension of the `ModRM.rm`, `SIB.base`, or `opcode.reg` field (bit 4).
|
||||
*/
|
||||
ZyanU8 B4;
|
||||
/**
|
||||
* 64-bit operand-size promotion, opcode-extension or PPX hint.
|
||||
*/
|
||||
ZyanU8 W;
|
||||
/**
|
||||
* Extension of the `ModRM.reg` field (bit 3).
|
||||
*/
|
||||
ZyanU8 R3;
|
||||
/**
|
||||
* Extension of the `SIB.index` field (bit 3).
|
||||
*/
|
||||
ZyanU8 X3;
|
||||
/**
|
||||
* Extension of the `ModRM.rm`, `SIB.base`, or `opcode.reg` field (bit 3).
|
||||
*/
|
||||
ZyanU8 B3;
|
||||
/**
|
||||
* The offset of the effective `REX2` byte, relative to the beginning of the
|
||||
* instruction, in bytes.
|
||||
*
|
||||
* Note that the `REX2` byte can be the first byte of the instruction, which would lead
|
||||
* to an offset of `0`. Please refer to the instruction attributes to check for the
|
||||
* presence of the `REX2` prefix.
|
||||
*/
|
||||
ZyanU8 offset;
|
||||
} ZydisDecodedInstructionRawRex2;
|
||||
|
||||
/**
|
||||
* Detailed info about the `XOP` prefix.
|
||||
*/
|
||||
@@ -851,24 +1033,28 @@ typedef struct ZydisDecodedInstructionRawVex_
|
||||
/**
|
||||
* Detailed info about the `EVEX` prefix.
|
||||
*/
|
||||
typedef struct ZydisDecodedInstructionRawEvex
|
||||
typedef struct ZydisDecodedInstructionRawEvex_
|
||||
{
|
||||
/**
|
||||
* Extension of the `ModRM.reg` field (inverted).
|
||||
*/
|
||||
ZyanU8 R;
|
||||
ZyanU8 R3;
|
||||
/**
|
||||
* Extension of the `SIB.index/vidx` field (inverted).
|
||||
*/
|
||||
ZyanU8 X;
|
||||
ZyanU8 X3;
|
||||
/**
|
||||
* Extension of the `ModRM.rm` or `SIB.base` field (inverted).
|
||||
*/
|
||||
ZyanU8 B;
|
||||
ZyanU8 B3;
|
||||
/**
|
||||
* High-16 register specifier modifier (inverted).
|
||||
* High-16 register specifier modifier for the `ModRM.reg` field (inverted).
|
||||
*/
|
||||
ZyanU8 R2;
|
||||
ZyanU8 R4;
|
||||
/**
|
||||
* High-16 register specifier modifier for the `ModRM.rm` or `SIB.base` field.
|
||||
*/
|
||||
ZyanU8 B4;
|
||||
/**
|
||||
* Opcode-map specifier.
|
||||
*/
|
||||
@@ -882,6 +1068,14 @@ typedef struct ZydisDecodedInstructionRawEvex
|
||||
* (inverted).
|
||||
*/
|
||||
ZyanU8 vvvv;
|
||||
/**
|
||||
* The `U`-bit.
|
||||
*/
|
||||
ZyanU8 U;
|
||||
/**
|
||||
* High-16 register specifier modifier for the `SIB.index/vidx` field (inverted).
|
||||
*/
|
||||
ZyanU8 X4;
|
||||
/**
|
||||
* Compressed legacy prefix.
|
||||
*/
|
||||
@@ -899,17 +1093,22 @@ typedef struct ZydisDecodedInstructionRawEvex
|
||||
*/
|
||||
ZyanU8 L;
|
||||
/**
|
||||
* Broadcast/RC/SAE context.
|
||||
* Broadcast/RC/SAE control.
|
||||
*/
|
||||
ZyanU8 b;
|
||||
/**
|
||||
* High-16 `NDS`/`VIDX` register specifier.
|
||||
*/
|
||||
ZyanU8 V2;
|
||||
ZyanU8 V4;
|
||||
/**
|
||||
* Embedded opmask register specifier.
|
||||
*/
|
||||
ZyanU8 aaa;
|
||||
|
||||
ZyanU8 ND;
|
||||
ZyanU8 NF;
|
||||
ZyanU8 SCC;
|
||||
|
||||
/**
|
||||
* The offset of the first evex byte, relative to the beginning of the
|
||||
* instruction, in bytes.
|
||||
@@ -1060,6 +1259,42 @@ typedef struct ZydisDecodedInstructionAvx_
|
||||
// TODO: publish EVEX tuple-type and MVEX functionality
|
||||
} ZydisDecodedInstructionAvx;
|
||||
|
||||
/**
|
||||
* Extended info for `APX` instructions.
|
||||
*/
|
||||
typedef struct ZydisDecodedInstructionApx_
|
||||
{
|
||||
/**
|
||||
* Signals, if the instruction uses the extended GP registers (R16..R31).
|
||||
*/
|
||||
ZyanBool uses_egpr;
|
||||
/**
|
||||
* Signals, if the APX `no flags` functionality is enabled for the instruction.
|
||||
*/
|
||||
ZyanBool has_nf;
|
||||
/**
|
||||
* Signals, if the APX `zero upper` functionality is enabled for the instruction.
|
||||
*/
|
||||
ZyanBool has_zu;
|
||||
/**
|
||||
* Signals, if the APX push/pop performance-hint (`PPX`) is enabled for the instruction.
|
||||
*
|
||||
* This flag is only valid for `push2p` and `pop2p`.
|
||||
*/
|
||||
ZyanBool has_ppx;
|
||||
/**
|
||||
* The APX source condition code.
|
||||
*/
|
||||
ZydisSourceConditionCode scc;
|
||||
/**
|
||||
* The APX default flags value (DFV) that is assigned to the status flags when the source
|
||||
* condition code `scc` evaluates to `false`.
|
||||
*
|
||||
* This value is only used, if `scc` is not `ZYDIS_SCC_NONE`.
|
||||
*/
|
||||
ZydisDefaultFlagsValue default_flags;
|
||||
} ZydisDecodedInstructionApx;
|
||||
|
||||
/**
|
||||
* Instruction meta info.
|
||||
*/
|
||||
@@ -1125,6 +1360,7 @@ typedef struct ZydisDecodedInstructionRaw_
|
||||
union
|
||||
{
|
||||
ZydisDecodedInstructionRawRex rex;
|
||||
ZydisDecodedInstructionRawRex2 rex2;
|
||||
ZydisDecodedInstructionRawXop xop;
|
||||
ZydisDecodedInstructionRawVex vex;
|
||||
ZydisDecodedInstructionRawEvex evex;
|
||||
@@ -1206,6 +1442,10 @@ typedef struct ZydisDecodedInstructionRaw_
|
||||
* Signals, if the immediate value is signed.
|
||||
*/
|
||||
ZyanBool is_signed;
|
||||
/**
|
||||
* Signals, if the immediate value contains an address.
|
||||
*/
|
||||
ZyanBool is_address;
|
||||
/**
|
||||
* Signals, if the immediate value contains a relative offset. You can use
|
||||
* `ZydisCalcAbsoluteAddress` to determine the absolute address value.
|
||||
@@ -1308,6 +1548,10 @@ typedef struct ZydisDecodedInstruction_
|
||||
* Extended info for `AVX` instructions.
|
||||
*/
|
||||
ZydisDecodedInstructionAvx avx;
|
||||
/**
|
||||
* Extended info for `APX` instructions.
|
||||
*/
|
||||
ZydisDecodedInstructionApx apx;
|
||||
/**
|
||||
* Meta info.
|
||||
*/
|
||||
@@ -1354,18 +1598,20 @@ typedef struct ZydisDecoderContext_
|
||||
*/
|
||||
ZyanU8 easz_index;
|
||||
/**
|
||||
* Contains some cached REX/XOP/VEX/EVEX/MVEX values to provide uniform access.
|
||||
* Contains some cached REX/REX2/XOP/VEX/EVEX/MVEX values to provide uniform access.
|
||||
*/
|
||||
struct
|
||||
{
|
||||
ZyanU8 W;
|
||||
ZyanU8 R;
|
||||
ZyanU8 X;
|
||||
ZyanU8 B;
|
||||
ZyanU8 R3;
|
||||
ZyanU8 R4;
|
||||
ZyanU8 X3;
|
||||
ZyanU8 X4;
|
||||
ZyanU8 B3;
|
||||
ZyanU8 B4;
|
||||
ZyanU8 L;
|
||||
ZyanU8 LL;
|
||||
ZyanU8 R2;
|
||||
ZyanU8 V2;
|
||||
ZyanU8 V4;
|
||||
ZyanU8 vvvv;
|
||||
ZyanU8 mask;
|
||||
} vector_unified;
|
||||
|
||||
+20
-1
@@ -221,7 +221,11 @@ typedef struct ZydisEncoderOperand_
|
||||
*/
|
||||
ZyanU8 scale;
|
||||
/**
|
||||
* The displacement value.
|
||||
* The displacement value. This value is always treated as 64-bit signed integer, so it's
|
||||
* important to take this into account when specifying absolute addresses. For example
|
||||
* to specify a 16-bit address 0x8000 in 16-bit mode it should be sign extended to
|
||||
* `0xFFFFFFFFFFFF8000`. See `address_size_hint` for more information about absolute
|
||||
* addresses.
|
||||
*/
|
||||
ZyanI64 displacement;
|
||||
/**
|
||||
@@ -302,6 +306,13 @@ typedef struct ZydisEncoderRequest_
|
||||
* encoder deduces address size from `ZydisEncoderOperand` structures that represent
|
||||
* explicit and implicit operands. This hint resolves conflicts when instruction's hidden
|
||||
* operands scale with address size attribute.
|
||||
*
|
||||
* This hint is also used for instructions with absolute memory addresses (memory operands with
|
||||
* displacement and no registers). Since displacement field is a 64-bit signed integer it's not
|
||||
* possible to determine actual size of the address value in all situations. This hint
|
||||
* specifies size of the address value provided inside encoder request rather than desired
|
||||
* address size attribute of encoded instruction. Use `ZYDIS_ADDRESS_SIZE_HINT_NONE` to assume
|
||||
* address size default for specified machine mode.
|
||||
*/
|
||||
ZydisAddressSizeHint address_size_hint;
|
||||
/**
|
||||
@@ -345,6 +356,14 @@ typedef struct ZydisEncoderRequest_
|
||||
* Specify `ZYAN_TRUE` for instructions with forced zeroing mask.
|
||||
*/
|
||||
ZyanBool zeroing_mask;
|
||||
/**
|
||||
* Supress status flags update for certain `APX` instructions.
|
||||
*/
|
||||
ZyanBool no_flags;
|
||||
/**
|
||||
* The APX default flags value (DFV).
|
||||
*/
|
||||
ZydisDefaultFlagsValue default_flags;
|
||||
} evex;
|
||||
/**
|
||||
* Extended info for `MVEX` instructions.
|
||||
|
||||
+46
-3
@@ -224,7 +224,7 @@ typedef enum ZydisFormatterProperty_
|
||||
/**
|
||||
* Controls the padding of immediate values.
|
||||
*
|
||||
* Pass `ZYDIS_PADDING_DISABLED` to disable padding, `ZYDIS_PADDING_AUTO` to padd all
|
||||
* Pass `ZYDIS_PADDING_DISABLED` to disable padding, `ZYDIS_PADDING_AUTO` to pad all
|
||||
* immediates to the operand-width (hexadecimal only), or any other integer value for custom
|
||||
* padding.
|
||||
*/
|
||||
@@ -329,12 +329,39 @@ typedef enum ZydisFormatterProperty_
|
||||
*/
|
||||
ZYDIS_FORMATTER_PROP_HEX_SUFFIX,
|
||||
|
||||
/* ---------------------------------------------------------------------------------------- */
|
||||
/* Decorator formatting */
|
||||
/* ---------------------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Controls the printing of the APX `nf` decorator.
|
||||
*
|
||||
* Pass `ZYAN_TRUE` to append the `nf` decorator as a suffix to the instruction mnemonic
|
||||
* instead of prepending it as a pseudo prefix.
|
||||
*
|
||||
* The default value is implementation specific: `ZYAN_FALSE` for Intel and `ZYAN_TRUE` for ATT.
|
||||
*
|
||||
* WARNING: Suffix mode currently does not correctly follow the standard. The `nf` suffix should
|
||||
* appear before any additional `zu` and/or `cc` suffix. This is not the case.
|
||||
* The current implementation would e.g. emit `imulzunf` instead of `imulnfzu`.
|
||||
*/
|
||||
ZYDIS_FORMATTER_PROP_DECO_APX_NF_USE_SUFFIX,
|
||||
|
||||
/**
|
||||
* Controls the printing of the APX `dfv` decorator.
|
||||
*
|
||||
* Pass `ZYAN_TRUE` to use the immediate notation instead of the finite set notation.
|
||||
*
|
||||
* The default value is implementation specific: `ZYAN_FALSE` for Intel and `ZYAN_TRUE` for ATT.
|
||||
*/
|
||||
ZYDIS_FORMATTER_PROP_DECO_APX_DFV_USE_IMMEDIATE,
|
||||
|
||||
/* ---------------------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Maximum value of this enum.
|
||||
*/
|
||||
ZYDIS_FORMATTER_PROP_MAX_VALUE = ZYDIS_FORMATTER_PROP_HEX_SUFFIX,
|
||||
ZYDIS_FORMATTER_PROP_MAX_VALUE = ZYDIS_FORMATTER_PROP_DECO_APX_DFV_USE_IMMEDIATE,
|
||||
/**
|
||||
* The minimum number of bits required to represent all values of this enum.
|
||||
*/
|
||||
@@ -628,11 +655,19 @@ typedef enum ZydisDecorator_
|
||||
* The eviction-hint decorator.
|
||||
*/
|
||||
ZYDIS_DECORATOR_EH,
|
||||
/**
|
||||
* The APX no-flags decorator.
|
||||
*/
|
||||
ZYDIS_DECORATOR_APX_NF,
|
||||
/**
|
||||
* The APX default flags value decorator.
|
||||
*/
|
||||
ZYDIS_DECORATOR_APX_DFV,
|
||||
|
||||
/**
|
||||
* Maximum value of this enum.
|
||||
*/
|
||||
ZYDIS_DECORATOR_MAX_VALUE = ZYDIS_DECORATOR_EH,
|
||||
ZYDIS_DECORATOR_MAX_VALUE = ZYDIS_DECORATOR_APX_DFV,
|
||||
/**
|
||||
* The minimum number of bits required to represent all values of this enum.
|
||||
*/
|
||||
@@ -892,6 +927,14 @@ struct ZydisFormatter_
|
||||
*/
|
||||
char buffer[11];
|
||||
} number_format[ZYDIS_NUMERIC_BASE_MAX_VALUE + 1][2];
|
||||
/**
|
||||
* The `ZYDIS_FORMATTER_PROP_DECO_APX_NF_USE_SUFFIX` property.
|
||||
*/
|
||||
ZyanBool deco_apx_nf_use_suffix;
|
||||
/**
|
||||
* The `ZYDIS_FORMATTER_PROP_DECO_APX_DFV_USE_IMMEDIATE` property.
|
||||
*/
|
||||
ZyanBool deco_apx_dfv_use_immediate;
|
||||
/**
|
||||
* The `ZYDIS_FORMATTER_FUNC_PRE_INSTRUCTION` function.
|
||||
*/
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ typedef const ZydisFormatterToken ZydisFormatterTokenConst;
|
||||
typedef struct ZydisFormatterBuffer_
|
||||
{
|
||||
/**
|
||||
* `ZYAN_TRUE`, if the buffer contains a token stream or `ZYAN_FALSE, if it
|
||||
* `ZYAN_TRUE`, if the buffer contains a token stream or `ZYAN_FALSE`, if it
|
||||
* contains a simple string.
|
||||
*/
|
||||
ZyanBool is_token_list;
|
||||
|
||||
+4
@@ -13,6 +13,8 @@ typedef enum ZydisISAExt_
|
||||
ZYDIS_ISA_EXT_AMX_FP16,
|
||||
ZYDIS_ISA_EXT_AMX_INT8,
|
||||
ZYDIS_ISA_EXT_AMX_TILE,
|
||||
ZYDIS_ISA_EXT_APXEVEX,
|
||||
ZYDIS_ISA_EXT_APXLEGACY,
|
||||
ZYDIS_ISA_EXT_AVX,
|
||||
ZYDIS_ISA_EXT_AVX2,
|
||||
ZYDIS_ISA_EXT_AVX2GATHER,
|
||||
@@ -37,6 +39,7 @@ typedef enum ZydisISAExt_
|
||||
ZYDIS_ISA_EXT_F16C,
|
||||
ZYDIS_ISA_EXT_FMA,
|
||||
ZYDIS_ISA_EXT_FMA4,
|
||||
ZYDIS_ISA_EXT_FRED,
|
||||
ZYDIS_ISA_EXT_GFNI,
|
||||
ZYDIS_ISA_EXT_HRESET,
|
||||
ZYDIS_ISA_EXT_ICACHE_PREFETCH,
|
||||
@@ -46,6 +49,7 @@ typedef enum ZydisISAExt_
|
||||
ZYDIS_ISA_EXT_KNC,
|
||||
ZYDIS_ISA_EXT_KNCE,
|
||||
ZYDIS_ISA_EXT_KNCV,
|
||||
ZYDIS_ISA_EXT_LKGS,
|
||||
ZYDIS_ISA_EXT_LONGMODE,
|
||||
ZYDIS_ISA_EXT_LZCNT,
|
||||
ZYDIS_ISA_EXT_MCOMMIT,
|
||||
|
||||
+23
@@ -13,6 +13,27 @@ typedef enum ZydisISASet_
|
||||
ZYDIS_ISA_SET_AMX_FP16,
|
||||
ZYDIS_ISA_SET_AMX_INT8,
|
||||
ZYDIS_ISA_SET_AMX_TILE,
|
||||
ZYDIS_ISA_SET_APX_F,
|
||||
ZYDIS_ISA_SET_APX_F_ADX,
|
||||
ZYDIS_ISA_SET_APX_F_AMX,
|
||||
ZYDIS_ISA_SET_APX_F_BMI1,
|
||||
ZYDIS_ISA_SET_APX_F_BMI2,
|
||||
ZYDIS_ISA_SET_APX_F_CET,
|
||||
ZYDIS_ISA_SET_APX_F_CMPCCXADD,
|
||||
ZYDIS_ISA_SET_APX_F_ENQCMD,
|
||||
ZYDIS_ISA_SET_APX_F_INVPCID,
|
||||
ZYDIS_ISA_SET_APX_F_KOPB,
|
||||
ZYDIS_ISA_SET_APX_F_KOPD,
|
||||
ZYDIS_ISA_SET_APX_F_KOPQ,
|
||||
ZYDIS_ISA_SET_APX_F_KOPW,
|
||||
ZYDIS_ISA_SET_APX_F_LZCNT,
|
||||
ZYDIS_ISA_SET_APX_F_MOVBE,
|
||||
ZYDIS_ISA_SET_APX_F_MOVDIR64B,
|
||||
ZYDIS_ISA_SET_APX_F_MOVDIRI,
|
||||
ZYDIS_ISA_SET_APX_F_POPCNT,
|
||||
ZYDIS_ISA_SET_APX_F_RAO_INT,
|
||||
ZYDIS_ISA_SET_APX_F_USER_MSR,
|
||||
ZYDIS_ISA_SET_APX_F_VMX,
|
||||
ZYDIS_ISA_SET_AVX,
|
||||
ZYDIS_ISA_SET_AVX2,
|
||||
ZYDIS_ISA_SET_AVX2GATHER,
|
||||
@@ -104,6 +125,7 @@ typedef enum ZydisISASet_
|
||||
ZYDIS_ISA_SET_FCOMI,
|
||||
ZYDIS_ISA_SET_FMA,
|
||||
ZYDIS_ISA_SET_FMA4,
|
||||
ZYDIS_ISA_SET_FRED,
|
||||
ZYDIS_ISA_SET_FXSAVE,
|
||||
ZYDIS_ISA_SET_FXSAVE64,
|
||||
ZYDIS_ISA_SET_GFNI,
|
||||
@@ -126,6 +148,7 @@ typedef enum ZydisISASet_
|
||||
ZYDIS_ISA_SET_KNC_MISC,
|
||||
ZYDIS_ISA_SET_KNC_PF_HINT,
|
||||
ZYDIS_ISA_SET_LAHF,
|
||||
ZYDIS_ISA_SET_LKGS,
|
||||
ZYDIS_ISA_SET_LONGMODE,
|
||||
ZYDIS_ISA_SET_LWP,
|
||||
ZYDIS_ISA_SET_LZCNT,
|
||||
|
||||
+3
@@ -8,6 +8,7 @@ typedef enum ZydisInstructionCategory_
|
||||
ZYDIS_CATEGORY_AES,
|
||||
ZYDIS_CATEGORY_AMD3DNOW,
|
||||
ZYDIS_CATEGORY_AMX_TILE,
|
||||
ZYDIS_CATEGORY_APX,
|
||||
ZYDIS_CATEGORY_AVX,
|
||||
ZYDIS_CATEGORY_AVX2,
|
||||
ZYDIS_CATEGORY_AVX2GATHER,
|
||||
@@ -43,6 +44,7 @@ typedef enum ZydisInstructionCategory_
|
||||
ZYDIS_CATEGORY_FLAGOP,
|
||||
ZYDIS_CATEGORY_FMA4,
|
||||
ZYDIS_CATEGORY_FP16,
|
||||
ZYDIS_CATEGORY_FRED,
|
||||
ZYDIS_CATEGORY_GATHER,
|
||||
ZYDIS_CATEGORY_GFNI,
|
||||
ZYDIS_CATEGORY_HRESET,
|
||||
@@ -57,6 +59,7 @@ typedef enum ZydisInstructionCategory_
|
||||
ZYDIS_CATEGORY_KNCMASK,
|
||||
ZYDIS_CATEGORY_KNCSCALAR,
|
||||
ZYDIS_CATEGORY_LEGACY,
|
||||
ZYDIS_CATEGORY_LKGS,
|
||||
ZYDIS_CATEGORY_LOGICAL,
|
||||
ZYDIS_CATEGORY_LOGICAL_FP,
|
||||
ZYDIS_CATEGORY_LZCNT,
|
||||
|
||||
+93
@@ -76,8 +76,40 @@ typedef enum ZydisMnemonic_
|
||||
ZYDIS_MNEMONIC_BZHI,
|
||||
ZYDIS_MNEMONIC_CALL,
|
||||
ZYDIS_MNEMONIC_CBW,
|
||||
ZYDIS_MNEMONIC_CCMPB,
|
||||
ZYDIS_MNEMONIC_CCMPBE,
|
||||
ZYDIS_MNEMONIC_CCMPF,
|
||||
ZYDIS_MNEMONIC_CCMPL,
|
||||
ZYDIS_MNEMONIC_CCMPLE,
|
||||
ZYDIS_MNEMONIC_CCMPNB,
|
||||
ZYDIS_MNEMONIC_CCMPNBE,
|
||||
ZYDIS_MNEMONIC_CCMPNL,
|
||||
ZYDIS_MNEMONIC_CCMPNLE,
|
||||
ZYDIS_MNEMONIC_CCMPNO,
|
||||
ZYDIS_MNEMONIC_CCMPNS,
|
||||
ZYDIS_MNEMONIC_CCMPNZ,
|
||||
ZYDIS_MNEMONIC_CCMPO,
|
||||
ZYDIS_MNEMONIC_CCMPS,
|
||||
ZYDIS_MNEMONIC_CCMPT,
|
||||
ZYDIS_MNEMONIC_CCMPZ,
|
||||
ZYDIS_MNEMONIC_CDQ,
|
||||
ZYDIS_MNEMONIC_CDQE,
|
||||
ZYDIS_MNEMONIC_CFCMOVB,
|
||||
ZYDIS_MNEMONIC_CFCMOVBE,
|
||||
ZYDIS_MNEMONIC_CFCMOVL,
|
||||
ZYDIS_MNEMONIC_CFCMOVLE,
|
||||
ZYDIS_MNEMONIC_CFCMOVNB,
|
||||
ZYDIS_MNEMONIC_CFCMOVNBE,
|
||||
ZYDIS_MNEMONIC_CFCMOVNL,
|
||||
ZYDIS_MNEMONIC_CFCMOVNLE,
|
||||
ZYDIS_MNEMONIC_CFCMOVNO,
|
||||
ZYDIS_MNEMONIC_CFCMOVNP,
|
||||
ZYDIS_MNEMONIC_CFCMOVNS,
|
||||
ZYDIS_MNEMONIC_CFCMOVNZ,
|
||||
ZYDIS_MNEMONIC_CFCMOVO,
|
||||
ZYDIS_MNEMONIC_CFCMOVP,
|
||||
ZYDIS_MNEMONIC_CFCMOVS,
|
||||
ZYDIS_MNEMONIC_CFCMOVZ,
|
||||
ZYDIS_MNEMONIC_CLAC,
|
||||
ZYDIS_MNEMONIC_CLC,
|
||||
ZYDIS_MNEMONIC_CLD,
|
||||
@@ -111,21 +143,53 @@ typedef enum ZydisMnemonic_
|
||||
ZYDIS_MNEMONIC_CMOVS,
|
||||
ZYDIS_MNEMONIC_CMOVZ,
|
||||
ZYDIS_MNEMONIC_CMP,
|
||||
ZYDIS_MNEMONIC_CMPBEXADD,
|
||||
ZYDIS_MNEMONIC_CMPBXADD,
|
||||
ZYDIS_MNEMONIC_CMPLEXADD,
|
||||
ZYDIS_MNEMONIC_CMPLXADD,
|
||||
ZYDIS_MNEMONIC_CMPNBEXADD,
|
||||
ZYDIS_MNEMONIC_CMPNBXADD,
|
||||
ZYDIS_MNEMONIC_CMPNLEXADD,
|
||||
ZYDIS_MNEMONIC_CMPNLXADD,
|
||||
ZYDIS_MNEMONIC_CMPNOXADD,
|
||||
ZYDIS_MNEMONIC_CMPNPXADD,
|
||||
ZYDIS_MNEMONIC_CMPNSXADD,
|
||||
ZYDIS_MNEMONIC_CMPNZXADD,
|
||||
ZYDIS_MNEMONIC_CMPOXADD,
|
||||
ZYDIS_MNEMONIC_CMPPD,
|
||||
ZYDIS_MNEMONIC_CMPPS,
|
||||
ZYDIS_MNEMONIC_CMPPXADD,
|
||||
ZYDIS_MNEMONIC_CMPSB,
|
||||
ZYDIS_MNEMONIC_CMPSD,
|
||||
ZYDIS_MNEMONIC_CMPSQ,
|
||||
ZYDIS_MNEMONIC_CMPSS,
|
||||
ZYDIS_MNEMONIC_CMPSW,
|
||||
ZYDIS_MNEMONIC_CMPSXADD,
|
||||
ZYDIS_MNEMONIC_CMPXCHG,
|
||||
ZYDIS_MNEMONIC_CMPXCHG16B,
|
||||
ZYDIS_MNEMONIC_CMPXCHG8B,
|
||||
ZYDIS_MNEMONIC_CMPZXADD,
|
||||
ZYDIS_MNEMONIC_COMISD,
|
||||
ZYDIS_MNEMONIC_COMISS,
|
||||
ZYDIS_MNEMONIC_CPUID,
|
||||
ZYDIS_MNEMONIC_CQO,
|
||||
ZYDIS_MNEMONIC_CRC32,
|
||||
ZYDIS_MNEMONIC_CTESTB,
|
||||
ZYDIS_MNEMONIC_CTESTBE,
|
||||
ZYDIS_MNEMONIC_CTESTF,
|
||||
ZYDIS_MNEMONIC_CTESTL,
|
||||
ZYDIS_MNEMONIC_CTESTLE,
|
||||
ZYDIS_MNEMONIC_CTESTNB,
|
||||
ZYDIS_MNEMONIC_CTESTNBE,
|
||||
ZYDIS_MNEMONIC_CTESTNL,
|
||||
ZYDIS_MNEMONIC_CTESTNLE,
|
||||
ZYDIS_MNEMONIC_CTESTNO,
|
||||
ZYDIS_MNEMONIC_CTESTNS,
|
||||
ZYDIS_MNEMONIC_CTESTNZ,
|
||||
ZYDIS_MNEMONIC_CTESTO,
|
||||
ZYDIS_MNEMONIC_CTESTS,
|
||||
ZYDIS_MNEMONIC_CTESTT,
|
||||
ZYDIS_MNEMONIC_CTESTZ,
|
||||
ZYDIS_MNEMONIC_CVTDQ2PD,
|
||||
ZYDIS_MNEMONIC_CVTDQ2PS,
|
||||
ZYDIS_MNEMONIC_CVTPD2DQ,
|
||||
@@ -172,6 +236,8 @@ typedef enum ZydisMnemonic_
|
||||
ZYDIS_MNEMONIC_ENQCMD,
|
||||
ZYDIS_MNEMONIC_ENQCMDS,
|
||||
ZYDIS_MNEMONIC_ENTER,
|
||||
ZYDIS_MNEMONIC_ERETS,
|
||||
ZYDIS_MNEMONIC_ERETU,
|
||||
ZYDIS_MNEMONIC_EXTRACTPS,
|
||||
ZYDIS_MNEMONIC_EXTRQ,
|
||||
ZYDIS_MNEMONIC_F2XM1,
|
||||
@@ -283,6 +349,7 @@ typedef enum ZydisMnemonic_
|
||||
ZYDIS_MNEMONIC_HSUBPS,
|
||||
ZYDIS_MNEMONIC_IDIV,
|
||||
ZYDIS_MNEMONIC_IMUL,
|
||||
ZYDIS_MNEMONIC_IMULZU,
|
||||
ZYDIS_MNEMONIC_IN,
|
||||
ZYDIS_MNEMONIC_INC,
|
||||
ZYDIS_MNEMONIC_INCSSPD,
|
||||
@@ -315,6 +382,7 @@ typedef enum ZydisMnemonic_
|
||||
ZYDIS_MNEMONIC_JL,
|
||||
ZYDIS_MNEMONIC_JLE,
|
||||
ZYDIS_MNEMONIC_JMP,
|
||||
ZYDIS_MNEMONIC_JMPABS,
|
||||
ZYDIS_MNEMONIC_JNB,
|
||||
ZYDIS_MNEMONIC_JNBE,
|
||||
ZYDIS_MNEMONIC_JNL,
|
||||
@@ -407,6 +475,7 @@ typedef enum ZydisMnemonic_
|
||||
ZYDIS_MNEMONIC_LGDT,
|
||||
ZYDIS_MNEMONIC_LGS,
|
||||
ZYDIS_MNEMONIC_LIDT,
|
||||
ZYDIS_MNEMONIC_LKGS,
|
||||
ZYDIS_MNEMONIC_LLDT,
|
||||
ZYDIS_MNEMONIC_LLWPCB,
|
||||
ZYDIS_MNEMONIC_LMSW,
|
||||
@@ -613,12 +682,15 @@ typedef enum ZydisMnemonic_
|
||||
ZYDIS_MNEMONIC_PMULLW,
|
||||
ZYDIS_MNEMONIC_PMULUDQ,
|
||||
ZYDIS_MNEMONIC_POP,
|
||||
ZYDIS_MNEMONIC_POP2,
|
||||
ZYDIS_MNEMONIC_POP2P,
|
||||
ZYDIS_MNEMONIC_POPA,
|
||||
ZYDIS_MNEMONIC_POPAD,
|
||||
ZYDIS_MNEMONIC_POPCNT,
|
||||
ZYDIS_MNEMONIC_POPF,
|
||||
ZYDIS_MNEMONIC_POPFD,
|
||||
ZYDIS_MNEMONIC_POPFQ,
|
||||
ZYDIS_MNEMONIC_POPP,
|
||||
ZYDIS_MNEMONIC_POR,
|
||||
ZYDIS_MNEMONIC_PREFETCH,
|
||||
ZYDIS_MNEMONIC_PREFETCHIT0,
|
||||
@@ -669,11 +741,14 @@ typedef enum ZydisMnemonic_
|
||||
ZYDIS_MNEMONIC_PUNPCKLQDQ,
|
||||
ZYDIS_MNEMONIC_PUNPCKLWD,
|
||||
ZYDIS_MNEMONIC_PUSH,
|
||||
ZYDIS_MNEMONIC_PUSH2,
|
||||
ZYDIS_MNEMONIC_PUSH2P,
|
||||
ZYDIS_MNEMONIC_PUSHA,
|
||||
ZYDIS_MNEMONIC_PUSHAD,
|
||||
ZYDIS_MNEMONIC_PUSHF,
|
||||
ZYDIS_MNEMONIC_PUSHFD,
|
||||
ZYDIS_MNEMONIC_PUSHFQ,
|
||||
ZYDIS_MNEMONIC_PUSHP,
|
||||
ZYDIS_MNEMONIC_PVALIDATE,
|
||||
ZYDIS_MNEMONIC_PXOR,
|
||||
ZYDIS_MNEMONIC_RCL,
|
||||
@@ -740,6 +815,22 @@ typedef enum ZydisMnemonic_
|
||||
ZYDIS_MNEMONIC_SETS,
|
||||
ZYDIS_MNEMONIC_SETSSBSY,
|
||||
ZYDIS_MNEMONIC_SETZ,
|
||||
ZYDIS_MNEMONIC_SETZUB,
|
||||
ZYDIS_MNEMONIC_SETZUBE,
|
||||
ZYDIS_MNEMONIC_SETZUL,
|
||||
ZYDIS_MNEMONIC_SETZULE,
|
||||
ZYDIS_MNEMONIC_SETZUNB,
|
||||
ZYDIS_MNEMONIC_SETZUNBE,
|
||||
ZYDIS_MNEMONIC_SETZUNL,
|
||||
ZYDIS_MNEMONIC_SETZUNLE,
|
||||
ZYDIS_MNEMONIC_SETZUNO,
|
||||
ZYDIS_MNEMONIC_SETZUNP,
|
||||
ZYDIS_MNEMONIC_SETZUNS,
|
||||
ZYDIS_MNEMONIC_SETZUNZ,
|
||||
ZYDIS_MNEMONIC_SETZUO,
|
||||
ZYDIS_MNEMONIC_SETZUP,
|
||||
ZYDIS_MNEMONIC_SETZUS,
|
||||
ZYDIS_MNEMONIC_SETZUZ,
|
||||
ZYDIS_MNEMONIC_SFENCE,
|
||||
ZYDIS_MNEMONIC_SGDT,
|
||||
ZYDIS_MNEMONIC_SHA1MSG1,
|
||||
@@ -822,6 +913,8 @@ typedef enum ZydisMnemonic_
|
||||
ZYDIS_MNEMONIC_UNPCKHPS,
|
||||
ZYDIS_MNEMONIC_UNPCKLPD,
|
||||
ZYDIS_MNEMONIC_UNPCKLPS,
|
||||
ZYDIS_MNEMONIC_URDMSR,
|
||||
ZYDIS_MNEMONIC_UWRMSR,
|
||||
ZYDIS_MNEMONIC_V4FMADDPS,
|
||||
ZYDIS_MNEMONIC_V4FMADDSS,
|
||||
ZYDIS_MNEMONIC_V4FNMADDPS,
|
||||
|
||||
+66
-1
@@ -26,6 +26,22 @@ typedef enum ZydisRegister_
|
||||
ZYDIS_REGISTER_R13B,
|
||||
ZYDIS_REGISTER_R14B,
|
||||
ZYDIS_REGISTER_R15B,
|
||||
ZYDIS_REGISTER_R16B,
|
||||
ZYDIS_REGISTER_R17B,
|
||||
ZYDIS_REGISTER_R18B,
|
||||
ZYDIS_REGISTER_R19B,
|
||||
ZYDIS_REGISTER_R20B,
|
||||
ZYDIS_REGISTER_R21B,
|
||||
ZYDIS_REGISTER_R22B,
|
||||
ZYDIS_REGISTER_R23B,
|
||||
ZYDIS_REGISTER_R24B,
|
||||
ZYDIS_REGISTER_R25B,
|
||||
ZYDIS_REGISTER_R26B,
|
||||
ZYDIS_REGISTER_R27B,
|
||||
ZYDIS_REGISTER_R28B,
|
||||
ZYDIS_REGISTER_R29B,
|
||||
ZYDIS_REGISTER_R30B,
|
||||
ZYDIS_REGISTER_R31B,
|
||||
|
||||
// General purpose registers 16-bit
|
||||
ZYDIS_REGISTER_AX,
|
||||
@@ -44,6 +60,22 @@ typedef enum ZydisRegister_
|
||||
ZYDIS_REGISTER_R13W,
|
||||
ZYDIS_REGISTER_R14W,
|
||||
ZYDIS_REGISTER_R15W,
|
||||
ZYDIS_REGISTER_R16W,
|
||||
ZYDIS_REGISTER_R17W,
|
||||
ZYDIS_REGISTER_R18W,
|
||||
ZYDIS_REGISTER_R19W,
|
||||
ZYDIS_REGISTER_R20W,
|
||||
ZYDIS_REGISTER_R21W,
|
||||
ZYDIS_REGISTER_R22W,
|
||||
ZYDIS_REGISTER_R23W,
|
||||
ZYDIS_REGISTER_R24W,
|
||||
ZYDIS_REGISTER_R25W,
|
||||
ZYDIS_REGISTER_R26W,
|
||||
ZYDIS_REGISTER_R27W,
|
||||
ZYDIS_REGISTER_R28W,
|
||||
ZYDIS_REGISTER_R29W,
|
||||
ZYDIS_REGISTER_R30W,
|
||||
ZYDIS_REGISTER_R31W,
|
||||
|
||||
// General purpose registers 32-bit
|
||||
ZYDIS_REGISTER_EAX,
|
||||
@@ -62,6 +94,22 @@ typedef enum ZydisRegister_
|
||||
ZYDIS_REGISTER_R13D,
|
||||
ZYDIS_REGISTER_R14D,
|
||||
ZYDIS_REGISTER_R15D,
|
||||
ZYDIS_REGISTER_R16D,
|
||||
ZYDIS_REGISTER_R17D,
|
||||
ZYDIS_REGISTER_R18D,
|
||||
ZYDIS_REGISTER_R19D,
|
||||
ZYDIS_REGISTER_R20D,
|
||||
ZYDIS_REGISTER_R21D,
|
||||
ZYDIS_REGISTER_R22D,
|
||||
ZYDIS_REGISTER_R23D,
|
||||
ZYDIS_REGISTER_R24D,
|
||||
ZYDIS_REGISTER_R25D,
|
||||
ZYDIS_REGISTER_R26D,
|
||||
ZYDIS_REGISTER_R27D,
|
||||
ZYDIS_REGISTER_R28D,
|
||||
ZYDIS_REGISTER_R29D,
|
||||
ZYDIS_REGISTER_R30D,
|
||||
ZYDIS_REGISTER_R31D,
|
||||
|
||||
// General purpose registers 64-bit
|
||||
ZYDIS_REGISTER_RAX,
|
||||
@@ -80,6 +128,22 @@ typedef enum ZydisRegister_
|
||||
ZYDIS_REGISTER_R13,
|
||||
ZYDIS_REGISTER_R14,
|
||||
ZYDIS_REGISTER_R15,
|
||||
ZYDIS_REGISTER_R16,
|
||||
ZYDIS_REGISTER_R17,
|
||||
ZYDIS_REGISTER_R18,
|
||||
ZYDIS_REGISTER_R19,
|
||||
ZYDIS_REGISTER_R20,
|
||||
ZYDIS_REGISTER_R21,
|
||||
ZYDIS_REGISTER_R22,
|
||||
ZYDIS_REGISTER_R23,
|
||||
ZYDIS_REGISTER_R24,
|
||||
ZYDIS_REGISTER_R25,
|
||||
ZYDIS_REGISTER_R26,
|
||||
ZYDIS_REGISTER_R27,
|
||||
ZYDIS_REGISTER_R28,
|
||||
ZYDIS_REGISTER_R29,
|
||||
ZYDIS_REGISTER_R30,
|
||||
ZYDIS_REGISTER_R31,
|
||||
|
||||
// Floating point legacy registers
|
||||
ZYDIS_REGISTER_ST0,
|
||||
@@ -309,11 +373,12 @@ typedef enum ZydisRegister_
|
||||
ZYDIS_REGISTER_PKRU,
|
||||
ZYDIS_REGISTER_XCR0,
|
||||
ZYDIS_REGISTER_UIF,
|
||||
ZYDIS_REGISTER_IA32_KERNEL_GS_BASE,
|
||||
|
||||
/**
|
||||
* Maximum value of this enum.
|
||||
*/
|
||||
ZYDIS_REGISTER_MAX_VALUE = ZYDIS_REGISTER_UIF,
|
||||
ZYDIS_REGISTER_MAX_VALUE = ZYDIS_REGISTER_IA32_KERNEL_GS_BASE,
|
||||
/**
|
||||
* The minimum number of bits required to represent all values of this enum.
|
||||
*/
|
||||
|
||||
+151
-91
@@ -52,151 +52,193 @@ extern "C" {
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Defines the `ZydisDecoderTreeNodeType` data-type.
|
||||
* Defines the `ZydisDecoderTreeNode` data-type.
|
||||
*/
|
||||
typedef ZyanU8 ZydisDecoderTreeNodeType;
|
||||
typedef ZyanU16 ZydisDecoderTreeNode;
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Values that represent zydis decoder tree node types.
|
||||
* Values that represent Zydis decoder tree node types.
|
||||
*/
|
||||
enum ZydisDecoderTreeNodeTypes
|
||||
typedef enum ZydisDecoderTreeNodeType_
|
||||
{
|
||||
ZYDIS_NODETYPE_INVALID = 0x00,
|
||||
ZYDIS_NODETYPE_INVALID = 0,
|
||||
/**
|
||||
* Reference to an instruction-definition.
|
||||
*/
|
||||
ZYDIS_NODETYPE_DEFINITION_MASK = 0x80,
|
||||
ZYDIS_NODETYPE_DEFINITION,
|
||||
/**
|
||||
* Reference to an XOP-map filter.
|
||||
* A decoder tree node that instructs the decoder to switch to a different opcode table.
|
||||
* The `arg0` value of the node header is the id of the opcode table to switch to.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_XOP = 0x01,
|
||||
ZYDIS_NODETYPE_SWITCH_TABLE,
|
||||
/**
|
||||
* Reference to an VEX-map filter.
|
||||
* Reference to an XOP-map selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_VEX = 0x02,
|
||||
ZYDIS_NODETYPE_SWITCH_TABLE_XOP,
|
||||
/**
|
||||
* Reference to an EVEX/MVEX-map filter.
|
||||
* Reference to an VEX-map selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_EMVEX = 0x03,
|
||||
ZYDIS_NODETYPE_SWITCH_TABLE_VEX,
|
||||
/**
|
||||
* Reference to an opcode filter.
|
||||
* Reference to an EVEX/MVEX-map selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_OPCODE = 0x04,
|
||||
ZYDIS_NODETYPE_SWITCH_TABLE_EMVEX,
|
||||
/**
|
||||
* Reference to an instruction-mode filter.
|
||||
* Reference to a REX2-map selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_MODE = 0x05,
|
||||
ZYDIS_NODETYPE_SWITCH_TABLE_REX2,
|
||||
/**
|
||||
* Reference to an compacted instruction-mode filter.
|
||||
* Reference to an opcode selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_MODE_COMPACT = 0x06,
|
||||
ZYDIS_NODETYPE_OPCODE_TABLE,
|
||||
/**
|
||||
* Reference to a ModRM.mod filter.
|
||||
* Reference to an instruction-mode selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_MODRM_MOD = 0x07,
|
||||
ZYDIS_NODETYPE_MODE,
|
||||
/**
|
||||
* Reference to a compacted ModRM.mod filter.
|
||||
* Reference to an compacted instruction-mode selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_MODRM_MOD_COMPACT = 0x08,
|
||||
ZYDIS_NODETYPE_MODE_COMPACT,
|
||||
/**
|
||||
* Reference to a ModRM.reg filter.
|
||||
* Reference to a ModRM.mod selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_MODRM_REG = 0x09,
|
||||
ZYDIS_NODETYPE_MODRM_MOD,
|
||||
/**
|
||||
* Reference to a ModRM.rm filter.
|
||||
* Reference to a compacted ModRM.mod selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_MODRM_RM = 0x0A,
|
||||
ZYDIS_NODETYPE_MODRM_MOD_COMPACT,
|
||||
/**
|
||||
* Reference to a PrefixGroup1 filter.
|
||||
* Reference to a ModRM.reg selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_PREFIX_GROUP1 = 0x0B,
|
||||
ZYDIS_NODETYPE_MODRM_REG,
|
||||
/**
|
||||
* Reference to a mandatory-prefix filter.
|
||||
* Reference to a ModRM.rm selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_MANDATORY_PREFIX = 0x0C,
|
||||
ZYDIS_NODETYPE_MODRM_RM,
|
||||
/**
|
||||
* Reference to an operand-size filter.
|
||||
* Reference to a PrefixGroup1 selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_OPERAND_SIZE = 0x0D,
|
||||
ZYDIS_NODETYPE_PREFIX_GROUP1,
|
||||
/**
|
||||
* Reference to an address-size filter.
|
||||
* Reference to a mandatory-prefix selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_ADDRESS_SIZE = 0x0E,
|
||||
ZYDIS_NODETYPE_MANDATORY_PREFIX,
|
||||
/**
|
||||
* Reference to a vector-length filter.
|
||||
* Reference to an operand-size selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_VECTOR_LENGTH = 0x0F,
|
||||
ZYDIS_NODETYPE_OPERAND_SIZE,
|
||||
/**
|
||||
* Reference to an REX/VEX/EVEX.W filter.
|
||||
* Reference to an address-size selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_REX_W = 0x10,
|
||||
ZYDIS_NODETYPE_ADDRESS_SIZE,
|
||||
/**
|
||||
* Reference to an REX/VEX/EVEX.B filter.
|
||||
* Reference to a vector-length selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_REX_B = 0x11,
|
||||
ZYDIS_NODETYPE_VECTOR_LENGTH,
|
||||
/**
|
||||
* Reference to an EVEX.b filter.
|
||||
* Reference to an REX/VEX/EVEX.W selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_EVEX_B = 0x12,
|
||||
ZYDIS_NODETYPE_REX_W,
|
||||
/**
|
||||
* Reference to an MVEX.E filter.
|
||||
* Reference to an REX/VEX/EVEX.B selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_MVEX_E = 0x13,
|
||||
ZYDIS_NODETYPE_REX_B,
|
||||
/**
|
||||
* Reference to a AMD-mode filter.
|
||||
* Reference to an EVEX.b selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_MODE_AMD = 0x14,
|
||||
ZYDIS_NODETYPE_EVEX_B,
|
||||
/**
|
||||
* Reference to a KNC-mode filter.
|
||||
* Reference to an MVEX.E selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_MODE_KNC = 0x15,
|
||||
ZYDIS_NODETYPE_MVEX_E,
|
||||
/**
|
||||
* Reference to a MPX-mode filter.
|
||||
* Reference to a AMD-mode selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_MODE_MPX = 0x16,
|
||||
ZYDIS_NODETYPE_MODE_AMD,
|
||||
/**
|
||||
* Reference to a CET-mode filter.
|
||||
* Reference to a KNC-mode selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_MODE_CET = 0x17,
|
||||
ZYDIS_NODETYPE_MODE_KNC,
|
||||
/**
|
||||
* Reference to a LZCNT-mode filter.
|
||||
* Reference to a MPX-mode selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_MODE_LZCNT = 0x18,
|
||||
ZYDIS_NODETYPE_MODE_MPX,
|
||||
/**
|
||||
* Reference to a TZCNT-mode filter.
|
||||
* Reference to a CET-mode selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_MODE_TZCNT = 0x19,
|
||||
ZYDIS_NODETYPE_MODE_CET,
|
||||
/**
|
||||
* Reference to a WBNOINVD-mode filter.
|
||||
* Reference to a LZCNT-mode selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_MODE_WBNOINVD = 0x1A,
|
||||
ZYDIS_NODETYPE_MODE_LZCNT,
|
||||
/**
|
||||
* Reference to a CLDEMOTE-mode filter.
|
||||
* Reference to a TZCNT-mode selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_MODE_CLDEMOTE = 0x1B,
|
||||
ZYDIS_NODETYPE_MODE_TZCNT,
|
||||
/**
|
||||
* Reference to a IPREFETCH-mode filter.
|
||||
* Reference to a WBNOINVD-mode selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_FILTER_MODE_IPREFETCH = 0x1C
|
||||
};
|
||||
ZYDIS_NODETYPE_MODE_WBNOINVD,
|
||||
/**
|
||||
* Reference to a CLDEMOTE-mode selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_MODE_CLDEMOTE,
|
||||
/**
|
||||
* Reference to a IPREFETCH-mode selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_MODE_IPREFETCH,
|
||||
/**
|
||||
* Reference to a UD0_COMPAT-mode selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_MODE_UD0_COMPAT,
|
||||
/**
|
||||
* Reference to an EVEX.nd selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_EVEX_ND,
|
||||
/**
|
||||
* Reference to an EVEX.nf selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_EVEX_NF,
|
||||
/**
|
||||
* Reference to an EVEX.scc selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_EVEX_SCC,
|
||||
/**
|
||||
* Reference to a REX2-prefix selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_REX_2,
|
||||
/**
|
||||
* Reference to a EVEX.U selector.
|
||||
*/
|
||||
ZYDIS_NODETYPE_EVEX_U,
|
||||
|
||||
/**
|
||||
* Maximum value of this enum.
|
||||
*/
|
||||
ZYDIS_NODETYPE_MAX_VALUE = ZYDIS_NODETYPE_EVEX_U,
|
||||
/**
|
||||
* The minimum number of bits required to represent all values of this enum.
|
||||
*/
|
||||
ZYDIS_NODETYPE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_NODETYPE_MAX_VALUE)
|
||||
} ZydisDecoderTreeNodeType;
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Defines the `ZydisDecoderTreeNodeValue` data-type.
|
||||
*/
|
||||
typedef ZyanU16 ZydisDecoderTreeNodeValue;
|
||||
|
||||
/* Opcode tables */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Defines the `ZydisDecoderTreeNode` struct.
|
||||
*/
|
||||
typedef struct ZydisDecoderTreeNode_
|
||||
{
|
||||
ZydisDecoderTreeNodeType type;
|
||||
ZydisDecoderTreeNodeValue value;
|
||||
} ZydisDecoderTreeNode;
|
||||
// TODO: Auto generate this.
|
||||
|
||||
#define ZYDIS_OPCODE_TABLE_PRIMARY 0x00
|
||||
#define ZYDIS_OPCODE_TABLE_0F 0x01
|
||||
#define ZYDIS_OPCODE_TABLE_0F38 0x02
|
||||
#define ZYDIS_OPCODE_TABLE_0F3A 0x03
|
||||
#define ZYDIS_OPCODE_TABLE_VEX 0x04
|
||||
#define ZYDIS_OPCODE_TABLE_EVEX 0x14
|
||||
#define ZYDIS_OPCODE_TABLE_MVEX 0x34
|
||||
#define ZYDIS_OPCODE_TABLE_XOP 0x44
|
||||
#define ZYDIS_OPCODE_TABLE_3DNOW 0x47
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
@@ -275,6 +317,10 @@ typedef struct ZydisInstructionEncodingInfo_
|
||||
* Signals, if the value is signed.
|
||||
*/
|
||||
ZyanBool is_signed;
|
||||
/**
|
||||
* Signals, if the value is an address.
|
||||
*/
|
||||
ZyanBool is_address;
|
||||
/**
|
||||
* Signals, if the value is a relative offset.
|
||||
*/
|
||||
@@ -292,28 +338,42 @@ typedef struct ZydisInstructionEncodingInfo_
|
||||
/* Decoder tree */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
extern const ZydisDecoderTreeNode zydis_decoder_tree_root;
|
||||
/**
|
||||
* Gets the type of the given decoder tree node.
|
||||
*
|
||||
* @param node The decoder tree node.
|
||||
*
|
||||
* Encoding: [15..8] = ARG0, [7..0] = TYPE.
|
||||
*/
|
||||
#define ZYDIS_DT_GET_TYPE(node) \
|
||||
((ZydisDecoderTreeNodeType)((*(node)) & 0xFF))
|
||||
|
||||
/**
|
||||
* Returns the root node of the instruction tree.
|
||||
* Gets the first argument of the given decoder tree node.
|
||||
*
|
||||
* @return The root node of the instruction tree.
|
||||
* @param node The decoder tree node.
|
||||
*
|
||||
* Encoding: [15..8] = ARG0, [7..0] = TYPE.
|
||||
*/
|
||||
ZYAN_INLINE const ZydisDecoderTreeNode* ZydisDecoderTreeGetRootNode(void)
|
||||
{
|
||||
return &zydis_decoder_tree_root;
|
||||
}
|
||||
#define ZYDIS_DT_GET_ARG0(node) \
|
||||
((ZyanU8)(((*(node)) >> 8) & 0xFF))
|
||||
|
||||
/**
|
||||
* Returns the child node of `parent` specified by `index`.
|
||||
* Gets the value at index `index` of the given decoder tree node.
|
||||
*
|
||||
* @param parent The parent node.
|
||||
* @param index The index of the child node to retrieve.
|
||||
*
|
||||
* @return The specified child node.
|
||||
* @param node The decoder tree node.
|
||||
* @param index The index of the value to retrieve.
|
||||
*/
|
||||
ZYDIS_NO_EXPORT const ZydisDecoderTreeNode* ZydisDecoderTreeGetChildNode(
|
||||
const ZydisDecoderTreeNode* parent, ZyanU16 index);
|
||||
#define ZYDIS_DT_GET_VALUE(node, index) \
|
||||
((ZyanU16)(*((node) + 1 + (index))))
|
||||
|
||||
/**
|
||||
* Returns the root node of the opcode table with the given `opcode_table_id`.
|
||||
*
|
||||
* @param opcode_table_id The id of the opcode table to retrieve.
|
||||
* @return The root node of the opcode table with the given `opcode_table_id`.
|
||||
*/
|
||||
ZYDIS_NO_EXPORT const ZydisDecoderTreeNode* ZydisGetOpcodeTableRootNode(ZyanU8 opcode_table_id);
|
||||
|
||||
/**
|
||||
* Returns information about optional instruction parts (like modrm, displacement or
|
||||
|
||||
+49
-3
@@ -30,6 +30,7 @@
|
||||
#include <Zycore/Defines.h>
|
||||
#include <Zydis/Mnemonic.h>
|
||||
#include <Zydis/SharedTypes.h>
|
||||
#include <Zydis/DecoderTypes.h>
|
||||
|
||||
/**
|
||||
* Used in encoder's table to represent standard ISA sizes in form of bit flags.
|
||||
@@ -111,6 +112,25 @@ typedef enum ZydisSizeHint_
|
||||
ZYDIS_SIZE_HINT_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_SIZE_HINT_MAX_VALUE)
|
||||
} ZydisSizeHint;
|
||||
|
||||
/**
|
||||
* Used in encoder's table to indicate `REX2` prefix support type.
|
||||
*/
|
||||
typedef enum ZydisRex2Type_
|
||||
{
|
||||
ZYDIS_REX2_TYPE_FORBIDDEN,
|
||||
ZYDIS_REX2_TYPE_ALLOWED,
|
||||
ZYDIS_REX2_TYPE_MANDATORY,
|
||||
|
||||
/**
|
||||
* Maximum value of this enum.
|
||||
*/
|
||||
ZYDIS_REX2_TYPE_MAX_VALUE = ZYDIS_REX2_TYPE_MANDATORY,
|
||||
/**
|
||||
* The minimum number of bits required to represent all values of this enum.
|
||||
*/
|
||||
ZYDIS_REX2_TYPE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_REX2_TYPE_MAX_VALUE)
|
||||
} ZydisRex2Type;
|
||||
|
||||
/**
|
||||
* Used in encoder's primary lookup table which allows to access a set of instruction definitions
|
||||
* for specified mnemonic in constant time.
|
||||
@@ -179,10 +199,26 @@ typedef struct ZydisEncodableInstruction_
|
||||
* True if `REX.W` is required for this definition.
|
||||
*/
|
||||
ZyanU8 rex_w ZYAN_BITFIELD(1);
|
||||
/**
|
||||
* True if `REX2` prefix is required for this definition.
|
||||
*/
|
||||
ZyanU8 rex2 ZYAN_BITFIELD(ZYDIS_REX2_TYPE_REQUIRED_BITS);
|
||||
/**
|
||||
* True if `EEVEX.ND` is required for this definition.
|
||||
*/
|
||||
ZyanU8 evex_nd ZYAN_BITFIELD(1);
|
||||
/**
|
||||
* True if `EEVEX.NF` is required for this definition.
|
||||
*/
|
||||
ZyanU8 evex_nf ZYAN_BITFIELD(1);
|
||||
/**
|
||||
* True if `APX` definition scales memory operand with operand size attribute.
|
||||
*/
|
||||
ZyanU8 apx_osz ZYAN_BITFIELD(1);
|
||||
/**
|
||||
* The vector length.
|
||||
*/
|
||||
ZyanU8 vector_length ZYAN_BITFIELD(ZYDIS_MANDATORY_PREFIX_REQUIRED_BITS);
|
||||
ZyanU8 vector_length ZYAN_BITFIELD(ZYDIS_VECTOR_LENGTH_REQUIRED_BITS);
|
||||
/**
|
||||
* The accepted sizing hint.
|
||||
*/
|
||||
@@ -194,8 +230,8 @@ typedef struct ZydisEncodableInstruction_
|
||||
* (high bit in `REX.R`). Encoder uses swappable definitions to take advantage of this
|
||||
* optimization opportunity.
|
||||
*
|
||||
* Second use of this field is to handle special case for `mov` instruction. This particular
|
||||
* conflict is described in detail inside `ZydisHandleSwappableDefinition`.
|
||||
* This field is also used to handle special cases for optimizations. Those opportunities are
|
||||
* described inside `ZydisHandleSwappableDefinition`.
|
||||
*/
|
||||
ZyanU8 swappable ZYAN_BITFIELD(1);
|
||||
} ZydisEncodableInstruction;
|
||||
@@ -250,4 +286,14 @@ ZyanU8 ZydisGetEncodableInstructions(ZydisMnemonic mnemonic,
|
||||
*/
|
||||
const ZydisEncoderRelInfo *ZydisGetRelInfo(ZydisMnemonic mnemonic);
|
||||
|
||||
/**
|
||||
* Fetches information about APX conditional instructions.
|
||||
*
|
||||
* @param mnemonic Instruction mnemonic.
|
||||
* @param scc Receives `scc` if applicable.
|
||||
*
|
||||
* @return True if mnemonic represents an APX conditional instruction, false otherwise.
|
||||
*/
|
||||
ZyanBool ZydisGetCcInfo(ZydisMnemonic mnemonic, ZydisSourceConditionCode *scc);
|
||||
|
||||
#endif /* ZYDIS_INTERNAL_ENCODERDATA_H */
|
||||
|
||||
+59
-57
@@ -92,84 +92,86 @@ ZyanStatus ZydisFormatterATTPrintIMM(const ZydisFormatter* formatter,
|
||||
*/
|
||||
static const ZydisFormatter FORMATTER_ATT =
|
||||
{
|
||||
/* style */ ZYDIS_FORMATTER_STYLE_ATT,
|
||||
/* force_memory_size */ ZYAN_FALSE,
|
||||
/* force_memory_seg */ ZYAN_FALSE,
|
||||
/* force_memory_scale */ ZYAN_TRUE,
|
||||
/* force_relative_branches */ ZYAN_FALSE,
|
||||
/* force_relative_riprel */ ZYAN_FALSE,
|
||||
/* print_branch_size */ ZYAN_FALSE,
|
||||
/* detailed_prefixes */ ZYAN_FALSE,
|
||||
/* addr_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* addr_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
|
||||
/* addr_padding_absolute */ ZYDIS_PADDING_AUTO,
|
||||
/* addr_padding_relative */ 2,
|
||||
/* disp_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* disp_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
|
||||
/* disp_padding */ 2,
|
||||
/* imm_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* imm_signedness */ ZYDIS_SIGNEDNESS_AUTO,
|
||||
/* imm_padding */ 2,
|
||||
/* case_prefixes */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_mnemonic */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_registers */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_typecasts */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_decorators */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* hex_uppercase */ ZYAN_TRUE,
|
||||
/* hex_force_leading_number */ ZYAN_FALSE,
|
||||
/* number_format */
|
||||
/* style */ ZYDIS_FORMATTER_STYLE_ATT,
|
||||
/* force_memory_size */ ZYAN_FALSE,
|
||||
/* force_memory_seg */ ZYAN_FALSE,
|
||||
/* force_memory_scale */ ZYAN_TRUE,
|
||||
/* force_relative_branches */ ZYAN_FALSE,
|
||||
/* force_relative_riprel */ ZYAN_FALSE,
|
||||
/* print_branch_size */ ZYAN_FALSE,
|
||||
/* detailed_prefixes */ ZYAN_FALSE,
|
||||
/* addr_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* addr_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
|
||||
/* addr_padding_absolute */ ZYDIS_PADDING_AUTO,
|
||||
/* addr_padding_relative */ 2,
|
||||
/* disp_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* disp_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
|
||||
/* disp_padding */ 2,
|
||||
/* imm_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* imm_signedness */ ZYDIS_SIGNEDNESS_AUTO,
|
||||
/* imm_padding */ 2,
|
||||
/* case_prefixes */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_mnemonic */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_registers */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_typecasts */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_decorators */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* hex_uppercase */ ZYAN_TRUE,
|
||||
/* hex_force_leading_number */ ZYAN_FALSE,
|
||||
/* number_format */
|
||||
{
|
||||
// ZYDIS_NUMERIC_BASE_DEC
|
||||
{
|
||||
// Prefix
|
||||
{
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
},
|
||||
// Suffix
|
||||
{
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
}
|
||||
},
|
||||
// ZYDIS_NUMERIC_BASE_HEX
|
||||
{
|
||||
// Prefix
|
||||
{
|
||||
/* string */ &FORMATTER_ATT.number_format[
|
||||
/* string */ &FORMATTER_ATT.number_format[
|
||||
ZYDIS_NUMERIC_BASE_HEX][0].string_data,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW("0x"),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW("0x"),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
},
|
||||
// Suffix
|
||||
{
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
}
|
||||
}
|
||||
},
|
||||
/* func_pre_instruction */ ZYAN_NULL,
|
||||
/* func_post_instruction */ ZYAN_NULL,
|
||||
/* func_format_instruction */ &ZydisFormatterATTFormatInstruction,
|
||||
/* func_pre_operand */ ZYAN_NULL,
|
||||
/* func_post_operand */ ZYAN_NULL,
|
||||
/* func_format_operand_reg */ &ZydisFormatterBaseFormatOperandREG,
|
||||
/* func_format_operand_mem */ &ZydisFormatterATTFormatOperandMEM,
|
||||
/* func_format_operand_ptr */ &ZydisFormatterBaseFormatOperandPTR,
|
||||
/* func_format_operand_imm */ &ZydisFormatterBaseFormatOperandIMM,
|
||||
/* func_print_mnemonic */ &ZydisFormatterATTPrintMnemonic,
|
||||
/* func_print_register */ &ZydisFormatterATTPrintRegister,
|
||||
/* func_print_address_abs */ &ZydisFormatterATTPrintAddressABS,
|
||||
/* func_print_address_rel */ &ZydisFormatterBasePrintAddressREL,
|
||||
/* func_print_disp */ &ZydisFormatterATTPrintDISP,
|
||||
/* func_print_imm */ &ZydisFormatterATTPrintIMM,
|
||||
/* func_print_typecast */ ZYAN_NULL,
|
||||
/* func_print_segment */ &ZydisFormatterBasePrintSegment,
|
||||
/* func_print_prefixes */ &ZydisFormatterBasePrintPrefixes,
|
||||
/* func_print_decorator */ &ZydisFormatterBasePrintDecorator
|
||||
/* deco_apx_nf_use_suffix */ ZYAN_TRUE,
|
||||
/* deco_apx_dfv_use_immediate */ ZYAN_TRUE,
|
||||
/* func_pre_instruction */ ZYAN_NULL,
|
||||
/* func_post_instruction */ ZYAN_NULL,
|
||||
/* func_format_instruction */ &ZydisFormatterATTFormatInstruction,
|
||||
/* func_pre_operand */ ZYAN_NULL,
|
||||
/* func_post_operand */ ZYAN_NULL,
|
||||
/* func_format_operand_reg */ &ZydisFormatterBaseFormatOperandREG,
|
||||
/* func_format_operand_mem */ &ZydisFormatterATTFormatOperandMEM,
|
||||
/* func_format_operand_ptr */ &ZydisFormatterBaseFormatOperandPTR,
|
||||
/* func_format_operand_imm */ &ZydisFormatterBaseFormatOperandIMM,
|
||||
/* func_print_mnemonic */ &ZydisFormatterATTPrintMnemonic,
|
||||
/* func_print_register */ &ZydisFormatterATTPrintRegister,
|
||||
/* func_print_address_abs */ &ZydisFormatterATTPrintAddressABS,
|
||||
/* func_print_address_rel */ &ZydisFormatterBasePrintAddressREL,
|
||||
/* func_print_disp */ &ZydisFormatterATTPrintDISP,
|
||||
/* func_print_imm */ &ZydisFormatterATTPrintIMM,
|
||||
/* func_print_typecast */ ZYAN_NULL,
|
||||
/* func_print_segment */ &ZydisFormatterBasePrintSegment,
|
||||
/* func_print_prefixes */ &ZydisFormatterBasePrintPrefixes,
|
||||
/* func_print_decorator */ &ZydisFormatterBasePrintDecorator
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
+2
@@ -227,6 +227,8 @@ ZYAN_INLINE ZyanStatus ZydisFormatterBufferAppendPredefined(ZydisFormatterBuffer
|
||||
ZYAN_ASSERT(buffer);
|
||||
ZYAN_ASSERT(data);
|
||||
|
||||
// TODO: Merge with last token, if `last->type == predefined->first_token.type`
|
||||
|
||||
const ZyanUSize len = buffer->string.vector.size;
|
||||
ZYAN_ASSERT((len > 0) && (len < 256));
|
||||
if (buffer->capacity <= len + data->size)
|
||||
|
||||
+118
-114
@@ -91,84 +91,86 @@ ZyanStatus ZydisFormatterIntelPrintAddressMASM(const ZydisFormatter* formatter,
|
||||
*/
|
||||
static const ZydisFormatter FORMATTER_INTEL =
|
||||
{
|
||||
/* style */ ZYDIS_FORMATTER_STYLE_INTEL,
|
||||
/* force_memory_size */ ZYAN_FALSE,
|
||||
/* force_memory_seg */ ZYAN_FALSE,
|
||||
/* force_memory_scale */ ZYAN_TRUE,
|
||||
/* force_relative_branches */ ZYAN_FALSE,
|
||||
/* force_relative_riprel */ ZYAN_FALSE,
|
||||
/* print_branch_size */ ZYAN_FALSE,
|
||||
/* detailed_prefixes */ ZYAN_FALSE,
|
||||
/* addr_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* addr_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
|
||||
/* addr_padding_absolute */ ZYDIS_PADDING_AUTO,
|
||||
/* addr_padding_relative */ 2,
|
||||
/* disp_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* disp_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
|
||||
/* disp_padding */ 2,
|
||||
/* imm_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* imm_signedness */ ZYDIS_SIGNEDNESS_UNSIGNED,
|
||||
/* imm_padding */ 2,
|
||||
/* case_prefixes */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_mnemonic */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_registers */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_typecasts */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_decorators */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* hex_uppercase */ ZYAN_TRUE,
|
||||
/* hex_force_leading_number */ ZYAN_FALSE,
|
||||
/* number_format */
|
||||
/* style */ ZYDIS_FORMATTER_STYLE_INTEL,
|
||||
/* force_memory_size */ ZYAN_FALSE,
|
||||
/* force_memory_seg */ ZYAN_FALSE,
|
||||
/* force_memory_scale */ ZYAN_TRUE,
|
||||
/* force_relative_branches */ ZYAN_FALSE,
|
||||
/* force_relative_riprel */ ZYAN_FALSE,
|
||||
/* print_branch_size */ ZYAN_FALSE,
|
||||
/* detailed_prefixes */ ZYAN_FALSE,
|
||||
/* addr_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* addr_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
|
||||
/* addr_padding_absolute */ ZYDIS_PADDING_AUTO,
|
||||
/* addr_padding_relative */ 2,
|
||||
/* disp_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* disp_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
|
||||
/* disp_padding */ 2,
|
||||
/* imm_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* imm_signedness */ ZYDIS_SIGNEDNESS_UNSIGNED,
|
||||
/* imm_padding */ 2,
|
||||
/* case_prefixes */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_mnemonic */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_registers */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_typecasts */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_decorators */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* hex_uppercase */ ZYAN_TRUE,
|
||||
/* hex_force_leading_number */ ZYAN_FALSE,
|
||||
/* number_format */
|
||||
{
|
||||
// ZYDIS_NUMERIC_BASE_DEC
|
||||
{
|
||||
// Prefix
|
||||
{
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
},
|
||||
// Suffix
|
||||
{
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
}
|
||||
},
|
||||
// ZYDIS_NUMERIC_BASE_HEX
|
||||
{
|
||||
// Prefix
|
||||
{
|
||||
/* string */ &FORMATTER_INTEL.number_format[
|
||||
/* string */ &FORMATTER_INTEL.number_format[
|
||||
ZYDIS_NUMERIC_BASE_HEX][0].string_data,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW("0x"),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW("0x"),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
},
|
||||
// Suffix
|
||||
{
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
}
|
||||
}
|
||||
},
|
||||
/* func_pre_instruction */ ZYAN_NULL,
|
||||
/* func_post_instruction */ ZYAN_NULL,
|
||||
/* func_format_instruction */ &ZydisFormatterIntelFormatInstruction,
|
||||
/* func_pre_operand */ ZYAN_NULL,
|
||||
/* func_post_operand */ ZYAN_NULL,
|
||||
/* func_format_operand_reg */ &ZydisFormatterBaseFormatOperandREG,
|
||||
/* func_format_operand_mem */ &ZydisFormatterIntelFormatOperandMEM,
|
||||
/* func_format_operand_ptr */ &ZydisFormatterBaseFormatOperandPTR,
|
||||
/* func_format_operand_imm */ &ZydisFormatterBaseFormatOperandIMM,
|
||||
/* func_print_mnemonic */ &ZydisFormatterIntelPrintMnemonic,
|
||||
/* func_print_register */ &ZydisFormatterIntelPrintRegister,
|
||||
/* func_print_address_abs */ &ZydisFormatterBasePrintAddressABS,
|
||||
/* func_print_address_rel */ &ZydisFormatterBasePrintAddressREL,
|
||||
/* func_print_disp */ &ZydisFormatterIntelPrintDISP,
|
||||
/* func_print_imm */ &ZydisFormatterBasePrintIMM,
|
||||
/* func_print_typecast */ &ZydisFormatterIntelPrintTypecast,
|
||||
/* func_print_segment */ &ZydisFormatterBasePrintSegment,
|
||||
/* func_print_prefixes */ &ZydisFormatterBasePrintPrefixes,
|
||||
/* func_print_decorator */ &ZydisFormatterBasePrintDecorator
|
||||
/* deco_apx_nf_use_suffix */ ZYAN_FALSE,
|
||||
/* deco_apx_dfv_use_immediate */ ZYAN_FALSE,
|
||||
/* func_pre_instruction */ ZYAN_NULL,
|
||||
/* func_post_instruction */ ZYAN_NULL,
|
||||
/* func_format_instruction */ &ZydisFormatterIntelFormatInstruction,
|
||||
/* func_pre_operand */ ZYAN_NULL,
|
||||
/* func_post_operand */ ZYAN_NULL,
|
||||
/* func_format_operand_reg */ &ZydisFormatterBaseFormatOperandREG,
|
||||
/* func_format_operand_mem */ &ZydisFormatterIntelFormatOperandMEM,
|
||||
/* func_format_operand_ptr */ &ZydisFormatterBaseFormatOperandPTR,
|
||||
/* func_format_operand_imm */ &ZydisFormatterBaseFormatOperandIMM,
|
||||
/* func_print_mnemonic */ &ZydisFormatterIntelPrintMnemonic,
|
||||
/* func_print_register */ &ZydisFormatterIntelPrintRegister,
|
||||
/* func_print_address_abs */ &ZydisFormatterBasePrintAddressABS,
|
||||
/* func_print_address_rel */ &ZydisFormatterBasePrintAddressREL,
|
||||
/* func_print_disp */ &ZydisFormatterIntelPrintDISP,
|
||||
/* func_print_imm */ &ZydisFormatterBasePrintIMM,
|
||||
/* func_print_typecast */ &ZydisFormatterIntelPrintTypecast,
|
||||
/* func_print_segment */ &ZydisFormatterBasePrintSegment,
|
||||
/* func_print_prefixes */ &ZydisFormatterBasePrintPrefixes,
|
||||
/* func_print_decorator */ &ZydisFormatterBasePrintDecorator
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
@@ -180,84 +182,86 @@ static const ZydisFormatter FORMATTER_INTEL =
|
||||
*/
|
||||
static const ZydisFormatter FORMATTER_INTEL_MASM =
|
||||
{
|
||||
/* style */ ZYDIS_FORMATTER_STYLE_INTEL_MASM,
|
||||
/* force_memory_size */ ZYAN_TRUE,
|
||||
/* force_memory_seg */ ZYAN_FALSE,
|
||||
/* force_memory_scale */ ZYAN_TRUE,
|
||||
/* force_relative_branches */ ZYAN_FALSE,
|
||||
/* force_relative_riprel */ ZYAN_FALSE,
|
||||
/* print_branch_size */ ZYAN_FALSE,
|
||||
/* detailed_prefixes */ ZYAN_FALSE,
|
||||
/* addr_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* addr_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
|
||||
/* addr_padding_absolute */ ZYDIS_PADDING_DISABLED,
|
||||
/* addr_padding_relative */ ZYDIS_PADDING_DISABLED,
|
||||
/* disp_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* disp_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
|
||||
/* disp_padding */ ZYDIS_PADDING_DISABLED,
|
||||
/* imm_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* imm_signedness */ ZYDIS_SIGNEDNESS_AUTO,
|
||||
/* imm_padding */ ZYDIS_PADDING_DISABLED,
|
||||
/* case_prefixes */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_mnemonic */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_registers */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_typecasts */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_decorators */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* hex_uppercase */ ZYAN_TRUE,
|
||||
/* hex_force_leading_number */ ZYAN_TRUE,
|
||||
/* number_format */
|
||||
/* style */ ZYDIS_FORMATTER_STYLE_INTEL_MASM,
|
||||
/* force_memory_size */ ZYAN_TRUE,
|
||||
/* force_memory_seg */ ZYAN_FALSE,
|
||||
/* force_memory_scale */ ZYAN_TRUE,
|
||||
/* force_relative_branches */ ZYAN_FALSE,
|
||||
/* force_relative_riprel */ ZYAN_FALSE,
|
||||
/* print_branch_size */ ZYAN_FALSE,
|
||||
/* detailed_prefixes */ ZYAN_FALSE,
|
||||
/* addr_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* addr_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
|
||||
/* addr_padding_absolute */ ZYDIS_PADDING_DISABLED,
|
||||
/* addr_padding_relative */ ZYDIS_PADDING_DISABLED,
|
||||
/* disp_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* disp_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
|
||||
/* disp_padding */ ZYDIS_PADDING_DISABLED,
|
||||
/* imm_base */ ZYDIS_NUMERIC_BASE_HEX,
|
||||
/* imm_signedness */ ZYDIS_SIGNEDNESS_AUTO,
|
||||
/* imm_padding */ ZYDIS_PADDING_DISABLED,
|
||||
/* case_prefixes */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_mnemonic */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_registers */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_typecasts */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* case_decorators */ ZYDIS_LETTER_CASE_DEFAULT,
|
||||
/* hex_uppercase */ ZYAN_TRUE,
|
||||
/* hex_force_leading_number */ ZYAN_TRUE,
|
||||
/* number_format */
|
||||
{
|
||||
// ZYDIS_NUMERIC_BASE_DEC
|
||||
{
|
||||
// Prefix
|
||||
{
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
},
|
||||
// Suffix
|
||||
{
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
}
|
||||
},
|
||||
// ZYDIS_NUMERIC_BASE_HEX
|
||||
{
|
||||
// Prefix
|
||||
{
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
/* string */ ZYAN_NULL,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
},
|
||||
// Suffix
|
||||
{
|
||||
/* string */ &FORMATTER_INTEL_MASM.number_format[
|
||||
/* string */ &FORMATTER_INTEL_MASM.number_format[
|
||||
ZYDIS_NUMERIC_BASE_HEX][1].string_data,
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW("h"),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
/* string_data */ ZYAN_DEFINE_STRING_VIEW("h"),
|
||||
/* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
}
|
||||
}
|
||||
},
|
||||
/* func_pre_instruction */ ZYAN_NULL,
|
||||
/* func_post_instruction */ ZYAN_NULL,
|
||||
/* func_format_instruction */ &ZydisFormatterIntelFormatInstructionMASM,
|
||||
/* func_pre_operand */ ZYAN_NULL,
|
||||
/* func_post_operand */ ZYAN_NULL,
|
||||
/* func_format_operand_reg */ &ZydisFormatterBaseFormatOperandREG,
|
||||
/* func_format_operand_mem */ &ZydisFormatterIntelFormatOperandMEM,
|
||||
/* func_format_operand_ptr */ &ZydisFormatterBaseFormatOperandPTR,
|
||||
/* func_format_operand_imm */ &ZydisFormatterBaseFormatOperandIMM,
|
||||
/* func_print_mnemonic */ &ZydisFormatterIntelPrintMnemonic,
|
||||
/* func_print_register */ &ZydisFormatterIntelPrintRegister,
|
||||
/* func_print_address_abs */ &ZydisFormatterIntelPrintAddressMASM,
|
||||
/* func_print_address_rel */ &ZydisFormatterIntelPrintAddressMASM,
|
||||
/* func_print_disp */ &ZydisFormatterIntelPrintDISP,
|
||||
/* func_print_imm */ &ZydisFormatterBasePrintIMM,
|
||||
/* func_print_typecast */ &ZydisFormatterIntelPrintTypecast,
|
||||
/* func_print_segment */ &ZydisFormatterBasePrintSegment,
|
||||
/* func_print_prefixes */ &ZydisFormatterBasePrintPrefixes,
|
||||
/* func_print_decorator */ &ZydisFormatterBasePrintDecorator
|
||||
/* deco_apx_nf_use_suffix */ ZYAN_FALSE,
|
||||
/* deco_apx_dfv_use_immediate */ ZYAN_FALSE,
|
||||
/* func_pre_instruction */ ZYAN_NULL,
|
||||
/* func_post_instruction */ ZYAN_NULL,
|
||||
/* func_format_instruction */ &ZydisFormatterIntelFormatInstructionMASM,
|
||||
/* func_pre_operand */ ZYAN_NULL,
|
||||
/* func_post_operand */ ZYAN_NULL,
|
||||
/* func_format_operand_reg */ &ZydisFormatterBaseFormatOperandREG,
|
||||
/* func_format_operand_mem */ &ZydisFormatterIntelFormatOperandMEM,
|
||||
/* func_format_operand_ptr */ &ZydisFormatterBaseFormatOperandPTR,
|
||||
/* func_format_operand_imm */ &ZydisFormatterBaseFormatOperandIMM,
|
||||
/* func_print_mnemonic */ &ZydisFormatterIntelPrintMnemonic,
|
||||
/* func_print_register */ &ZydisFormatterIntelPrintRegister,
|
||||
/* func_print_address_abs */ &ZydisFormatterIntelPrintAddressMASM,
|
||||
/* func_print_address_rel */ &ZydisFormatterIntelPrintAddressMASM,
|
||||
/* func_print_disp */ &ZydisFormatterIntelPrintDISP,
|
||||
/* func_print_imm */ &ZydisFormatterBasePrintIMM,
|
||||
/* func_print_typecast */ &ZydisFormatterIntelPrintTypecast,
|
||||
/* func_print_segment */ &ZydisFormatterBasePrintSegment,
|
||||
/* func_print_prefixes */ &ZydisFormatterBasePrintPrefixes,
|
||||
/* func_print_decorator */ &ZydisFormatterBasePrintDecorator
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
+53
-19
@@ -87,6 +87,7 @@ typedef enum ZydisSemanticOperandType_
|
||||
ZYDIS_SEMANTIC_OPTYPE_MEM_VSIBZ,
|
||||
ZYDIS_SEMANTIC_OPTYPE_IMM,
|
||||
ZYDIS_SEMANTIC_OPTYPE_REL,
|
||||
ZYDIS_SEMANTIC_OPTYPE_ABS,
|
||||
ZYDIS_SEMANTIC_OPTYPE_PTR,
|
||||
ZYDIS_SEMANTIC_OPTYPE_AGEN,
|
||||
ZYDIS_SEMANTIC_OPTYPE_MOFFS,
|
||||
@@ -121,6 +122,7 @@ typedef enum ZydisInternalElementType_
|
||||
ZYDIS_IELEMENT_TYPE_INT16X2,
|
||||
ZYDIS_IELEMENT_TYPE_INT32,
|
||||
ZYDIS_IELEMENT_TYPE_INT64,
|
||||
ZYDIS_IELEMENT_TYPE_INT128,
|
||||
ZYDIS_IELEMENT_TYPE_UINT8,
|
||||
ZYDIS_IELEMENT_TYPE_UINT8X4,
|
||||
ZYDIS_IELEMENT_TYPE_UINT16,
|
||||
@@ -216,6 +218,28 @@ ZYAN_STATIC_ASSERT(ZYDIS_IMPLREG_TYPE_REQUIRED_BITS <= 8);
|
||||
ZYAN_STATIC_ASSERT(ZYDIS_REGISTER_REQUIRED_BITS <= 16);
|
||||
ZYAN_STATIC_ASSERT(ZYDIS_IMPLMEM_BASE_REQUIRED_BITS <= 8);
|
||||
|
||||
/**
|
||||
* Defines the `ZydisOperandDetails` struct.
|
||||
*/
|
||||
typedef union ZydisOperandDetails_
|
||||
{
|
||||
ZyanU8 encoding ZYAN_BITFIELD(ZYDIS_OPERAND_ENCODING_REQUIRED_BITS);
|
||||
struct
|
||||
{
|
||||
ZyanU8 type ZYAN_BITFIELD(ZYDIS_IMPLREG_TYPE_REQUIRED_BITS);
|
||||
union
|
||||
{
|
||||
ZyanU16 reg ZYAN_BITFIELD(ZYDIS_REGISTER_REQUIRED_BITS);
|
||||
ZyanU8 id ZYAN_BITFIELD(6);
|
||||
} reg;
|
||||
} reg;
|
||||
struct
|
||||
{
|
||||
ZyanU8 seg ZYAN_BITFIELD(3);
|
||||
ZyanU8 base ZYAN_BITFIELD(ZYDIS_IMPLMEM_BASE_REQUIRED_BITS);
|
||||
} mem;
|
||||
} ZydisOperandDetails;
|
||||
|
||||
/**
|
||||
* Defines the `ZydisOperandDefinition` struct.
|
||||
*/
|
||||
@@ -224,28 +248,11 @@ typedef struct ZydisOperandDefinition_
|
||||
ZyanU8 type ZYAN_BITFIELD(ZYDIS_SEMANTIC_OPTYPE_REQUIRED_BITS);
|
||||
ZyanU8 visibility ZYAN_BITFIELD(ZYDIS_OPERAND_VISIBILITY_REQUIRED_BITS);
|
||||
ZyanU8 actions ZYAN_BITFIELD(ZYDIS_OPERAND_ACTION_REQUIRED_BITS);
|
||||
ZyanU16 size[3];
|
||||
ZyanU8 element_type ZYAN_BITFIELD(ZYDIS_IELEMENT_TYPE_REQUIRED_BITS);
|
||||
union
|
||||
{
|
||||
ZyanU8 encoding ZYAN_BITFIELD(ZYDIS_OPERAND_ENCODING_REQUIRED_BITS);
|
||||
struct
|
||||
{
|
||||
ZyanU8 type ZYAN_BITFIELD(ZYDIS_IMPLREG_TYPE_REQUIRED_BITS);
|
||||
union
|
||||
{
|
||||
ZyanU16 reg ZYAN_BITFIELD(ZYDIS_REGISTER_REQUIRED_BITS);
|
||||
ZyanU8 id ZYAN_BITFIELD(6);
|
||||
} reg;
|
||||
} reg;
|
||||
struct
|
||||
{
|
||||
ZyanU8 seg ZYAN_BITFIELD(3);
|
||||
ZyanU8 base ZYAN_BITFIELD(ZYDIS_IMPLMEM_BASE_REQUIRED_BITS);
|
||||
} mem;
|
||||
} op;
|
||||
ZyanBool is_multisource4 ZYAN_BITFIELD(1);
|
||||
ZyanBool ignore_seg_override ZYAN_BITFIELD(1);
|
||||
ZyanU8 size_reference;
|
||||
ZyanU8 details_reference;
|
||||
} ZydisOperandDefinition;
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
@@ -357,6 +364,10 @@ typedef enum ZydisEVEXFunctionality_
|
||||
typedef enum ZydisEVEXTupleType_
|
||||
{
|
||||
ZYDIS_TUPLETYPE_INVALID,
|
||||
/**
|
||||
* No CD8 scaling.
|
||||
*/
|
||||
ZYDIS_TUPLETYPE_NO_SCALE,
|
||||
/**
|
||||
* Full Vector
|
||||
*/
|
||||
@@ -852,6 +863,10 @@ typedef struct ZydisInstructionDefinitionEVEX_
|
||||
ZyanU8 mask_override ZYAN_BITFIELD(ZYDIS_MASK_OVERRIDE_REQUIRED_BITS);
|
||||
ZyanU8 broadcast ZYAN_BITFIELD(ZYDIS_EVEX_STATIC_BROADCAST_REQUIRED_BITS);
|
||||
#endif
|
||||
ZyanU8 is_eevex ZYAN_BITFIELD( 1);
|
||||
ZyanU8 has_apx_nf ZYAN_BITFIELD( 1);
|
||||
ZyanU8 has_apx_zu ZYAN_BITFIELD( 1);
|
||||
ZyanU8 has_apx_ppx ZYAN_BITFIELD( 1);
|
||||
} ZydisInstructionDefinitionEVEX;
|
||||
#endif
|
||||
|
||||
@@ -937,6 +952,25 @@ ZYDIS_NO_EXPORT void ZydisGetInstructionDefinition(ZydisInstructionEncoding enco
|
||||
*/
|
||||
ZYDIS_NO_EXPORT const ZydisOperandDefinition* ZydisGetOperandDefinitions(
|
||||
const ZydisInstructionDefinition* definition);
|
||||
|
||||
/**
|
||||
* Returns size table associated with given operand definition.
|
||||
*
|
||||
* @param definition A pointer to the operand definition.
|
||||
*
|
||||
* @return A pointer to the beginning of size table.
|
||||
*/
|
||||
ZYDIS_NO_EXPORT const ZyanU16* ZydisGetOperandSizes(const ZydisOperandDefinition *definition);
|
||||
|
||||
/**
|
||||
* Returns pointer to `ZydisOperandDetails` structure associated with given operand definition.
|
||||
*
|
||||
* @param definition A pointer to the operand definition.
|
||||
*
|
||||
* @return A pointer to `ZydisOperandDetails` structure.
|
||||
*/
|
||||
ZYDIS_NO_EXPORT const ZydisOperandDetails* ZydisGetOperandDetails(
|
||||
const ZydisOperandDefinition *definition);
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
+4
@@ -76,6 +76,10 @@ typedef enum ZydisInstructionSegment_
|
||||
* The effective `REX` prefix byte.
|
||||
*/
|
||||
ZYDIS_INSTR_SEGMENT_REX,
|
||||
/**
|
||||
* The `REX2` prefix bytes.
|
||||
*/
|
||||
ZYDIS_INSTR_SEGMENT_REX2,
|
||||
/**
|
||||
* The `XOP` prefix bytes.
|
||||
*/
|
||||
|
||||
+19
-3
@@ -438,11 +438,15 @@ typedef enum ZydisInstructionEncoding_
|
||||
* The instruction uses the MVEX-encoding.
|
||||
*/
|
||||
ZYDIS_INSTRUCTION_ENCODING_MVEX,
|
||||
/**
|
||||
* The instruction uses the REX2-encoding.
|
||||
*/
|
||||
ZYDIS_INSTRUCTION_ENCODING_REX2,
|
||||
|
||||
/**
|
||||
* Maximum value of this enum.
|
||||
*/
|
||||
ZYDIS_INSTRUCTION_ENCODING_MAX_VALUE = ZYDIS_INSTRUCTION_ENCODING_MVEX,
|
||||
ZYDIS_INSTRUCTION_ENCODING_MAX_VALUE = ZYDIS_INSTRUCTION_ENCODING_REX2,
|
||||
/**
|
||||
* The minimum number of bits required to represent all values of this enum.
|
||||
*/
|
||||
@@ -463,15 +467,19 @@ typedef enum ZydisOpcodeMap_
|
||||
ZYDIS_OPCODE_MAP_0F,
|
||||
ZYDIS_OPCODE_MAP_0F38,
|
||||
ZYDIS_OPCODE_MAP_0F3A,
|
||||
ZYDIS_OPCODE_MAP_MAP4, // not used
|
||||
ZYDIS_OPCODE_MAP_MAP4,
|
||||
ZYDIS_OPCODE_MAP_MAP5,
|
||||
ZYDIS_OPCODE_MAP_MAP6,
|
||||
ZYDIS_OPCODE_MAP_MAP7, // not used
|
||||
ZYDIS_OPCODE_MAP_MAP7,
|
||||
ZYDIS_OPCODE_MAP_0F0F,
|
||||
ZYDIS_OPCODE_MAP_XOP8,
|
||||
ZYDIS_OPCODE_MAP_XOP9,
|
||||
ZYDIS_OPCODE_MAP_XOPA,
|
||||
|
||||
/**
|
||||
* Minimum value of this enum.
|
||||
*/
|
||||
ZYDIS_OPCODE_MAP_MIN_VALUE = ZYDIS_OPCODE_MAP_DEFAULT,
|
||||
/**
|
||||
* Maximum value of this enum.
|
||||
*/
|
||||
@@ -715,6 +723,14 @@ typedef ZyanU64 ZydisInstructionAttributes;
|
||||
* This attribute is mainly used by the encoder.
|
||||
*/
|
||||
#define ZYDIS_ATTRIB_HAS_EVEX_B (1ULL << 45) // TODO: rename
|
||||
/**
|
||||
* The instruction has the `REX2` prefix.
|
||||
*/
|
||||
#define ZYDIS_ATTRIB_HAS_REX2 (1ULL << 46) // TODO: rebase
|
||||
/**
|
||||
* The instruction has the `EEVEX` (extended `EVEX`) prefix.
|
||||
*/
|
||||
#define ZYDIS_ATTRIB_HAS_EEVEX (1ULL << 47) // TODO: rebase
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
+13
-7
@@ -100,34 +100,40 @@ extern "C" {
|
||||
ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x05u)
|
||||
|
||||
/**
|
||||
* A rex-prefix was found while decoding a XOP/VEX/EVEX/MVEX instruction.
|
||||
* A REX-prefix was found while decoding a REX2/XOP/VEX/EVEX/MVEX instruction.
|
||||
*/
|
||||
#define ZYDIS_STATUS_ILLEGAL_REX \
|
||||
ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x06u)
|
||||
|
||||
/**
|
||||
* A REX2-prefix was found while decoding a REX/XOP/VEX/EVEX/MVEX instruction.
|
||||
*/
|
||||
#define ZYDIS_STATUS_ILLEGAL_REX2 \
|
||||
ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x07u)
|
||||
|
||||
/**
|
||||
* An invalid opcode-map value was found while decoding a XOP/VEX/EVEX/MVEX-prefix.
|
||||
*/
|
||||
#define ZYDIS_STATUS_INVALID_MAP \
|
||||
ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x07u)
|
||||
ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x08u)
|
||||
|
||||
/**
|
||||
* An error occured while decoding the EVEX-prefix.
|
||||
*/
|
||||
#define ZYDIS_STATUS_MALFORMED_EVEX \
|
||||
ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x08u)
|
||||
ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x09u)
|
||||
|
||||
/**
|
||||
* An error occured while decoding the MVEX-prefix.
|
||||
*/
|
||||
#define ZYDIS_STATUS_MALFORMED_MVEX \
|
||||
ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x09u)
|
||||
ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x0Au)
|
||||
|
||||
/**
|
||||
* An invalid write-mask was specified for an EVEX/MVEX instruction.
|
||||
*/
|
||||
#define ZYDIS_STATUS_INVALID_MASK \
|
||||
ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x0Au)
|
||||
ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x0Bu)
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Formatter */
|
||||
@@ -146,14 +152,14 @@ extern "C" {
|
||||
* - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM`
|
||||
*/
|
||||
#define ZYDIS_STATUS_SKIP_TOKEN \
|
||||
ZYAN_MAKE_STATUS(0u, ZYAN_MODULE_ZYDIS, 0x0Bu)
|
||||
ZYAN_MAKE_STATUS(0u, ZYAN_MODULE_ZYDIS, 0x0Cu)
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Encoder */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#define ZYDIS_STATUS_IMPOSSIBLE_INSTRUCTION \
|
||||
ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x0Cu)
|
||||
ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x0Du)
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
+5
-5
@@ -86,7 +86,7 @@ extern "C" {
|
||||
/**
|
||||
* A macro that defines the zydis version.
|
||||
*/
|
||||
#define ZYDIS_VERSION (ZyanU64)0x0004000000000000
|
||||
#define ZYDIS_VERSION 0x0005000000000000ULL
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Helper macros */
|
||||
@@ -97,28 +97,28 @@ extern "C" {
|
||||
*
|
||||
* @param version The zydis version value
|
||||
*/
|
||||
#define ZYDIS_VERSION_MAJOR(version) (ZyanU16)(((version) & 0xFFFF000000000000) >> 48)
|
||||
#define ZYDIS_VERSION_MAJOR(version) (((version) & 0xFFFF000000000000) >> 48)
|
||||
|
||||
/**
|
||||
* Extracts the minor-part of the zydis version.
|
||||
*
|
||||
* @param version The zydis version value
|
||||
*/
|
||||
#define ZYDIS_VERSION_MINOR(version) (ZyanU16)(((version) & 0x0000FFFF00000000) >> 32)
|
||||
#define ZYDIS_VERSION_MINOR(version) (((version) & 0x0000FFFF00000000) >> 32)
|
||||
|
||||
/**
|
||||
* Extracts the patch-part of the zydis version.
|
||||
*
|
||||
* @param version The zydis version value
|
||||
*/
|
||||
#define ZYDIS_VERSION_PATCH(version) (ZyanU16)(((version) & 0x00000000FFFF0000) >> 16)
|
||||
#define ZYDIS_VERSION_PATCH(version) (((version) & 0x00000000FFFF0000) >> 16)
|
||||
|
||||
/**
|
||||
* Extracts the build-part of the zydis version.
|
||||
*
|
||||
* @param version The zydis version value
|
||||
*/
|
||||
#define ZYDIS_VERSION_BUILD(version) (ZyanU16)((version) & 0x000000000000FFFF)
|
||||
#define ZYDIS_VERSION_BUILD(version) ((version) & 0x000000000000FFFF)
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
ronn_exe = find_program('ronn', required: man)
|
||||
man_req = ronn_exe.found()
|
||||
|
||||
if man_req
|
||||
man_names = [
|
||||
'ZydisDisasm.1',
|
||||
'ZydisInfo.1',
|
||||
]
|
||||
|
||||
foreach page : man_names
|
||||
custom_target(
|
||||
page,
|
||||
input: files(f'@page@.ronn'),
|
||||
command: [ronn_exe, '--roff', '--output-dir', '@OUTDIR@', '@INPUT@'],
|
||||
output: page,
|
||||
install: true,
|
||||
install_dir: datadir / 'man' / 'man1',
|
||||
)
|
||||
endforeach
|
||||
endif
|
||||
|
||||
summary(
|
||||
{'man': man_req},
|
||||
section: 'Features',
|
||||
)
|
||||
+348
@@ -0,0 +1,348 @@
|
||||
project(
|
||||
'Zydis',
|
||||
'c',
|
||||
version: '5.0.0',
|
||||
license: 'MIT',
|
||||
license_files: 'LICENSE',
|
||||
meson_version: '>=1.3',
|
||||
default_options: [
|
||||
'c_std=c11',
|
||||
'warning_level=3',
|
||||
],
|
||||
)
|
||||
|
||||
datadir = get_option('datadir')
|
||||
|
||||
root = not meson.is_subproject()
|
||||
|
||||
minimal = get_option('minimal')
|
||||
decoder = get_option('decoder')
|
||||
formatter = get_option('formatter')
|
||||
avx512 = get_option('avx512')
|
||||
knc = get_option('knc')
|
||||
segment = get_option('segment')
|
||||
encoder = get_option('encoder')
|
||||
|
||||
examples = get_option('examples')
|
||||
tools = get_option('tools')
|
||||
man = get_option('man')
|
||||
doc = get_option('doc')
|
||||
tests = get_option('tests')
|
||||
|
||||
nolibc = get_option('nolibc')
|
||||
|
||||
# Auto feature set
|
||||
encoder = encoder.enable_auto_if(
|
||||
minimal.disabled()
|
||||
and decoder.allowed()
|
||||
and avx512.allowed()
|
||||
and knc.allowed(),
|
||||
)
|
||||
decoder = decoder.enable_auto_if(encoder.enabled())
|
||||
|
||||
avx512 = avx512.enable_auto_if(encoder.enabled())
|
||||
knc = knc.enable_auto_if(encoder.enabled())
|
||||
segment = segment.enable_auto_if(decoder.enabled())
|
||||
|
||||
formatter = formatter.enable_auto_if(
|
||||
decoder.enabled(),
|
||||
)
|
||||
|
||||
# Feature guards
|
||||
minimal = minimal.disable_if(encoder.enabled())
|
||||
decoder = decoder.enable_if(encoder.enabled() or formatter.enabled())
|
||||
avx512 = avx512.enable_if(encoder.enabled())
|
||||
knc = knc.enable_if(encoder.enabled())
|
||||
|
||||
# Extra targets
|
||||
examples = examples.disable_if(nolibc)
|
||||
tools = tools.disable_if(nolibc)
|
||||
tests = tests.disable_if(nolibc)
|
||||
|
||||
examples = examples.disable_auto_if(not root).enable_auto_if(root)
|
||||
tools = tools.disable_auto_if(not root).enable_auto_if(root)
|
||||
tests = tests.disable_auto_if(not root)
|
||||
man = man.disable_auto_if(not root)
|
||||
doc = doc.disable_auto_if(not root)
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
if cc.get_argument_syntax() == 'msvc'
|
||||
if get_option('b_lto')
|
||||
add_project_arguments(
|
||||
'/GL', # -flto
|
||||
language: 'c',
|
||||
)
|
||||
add_project_link_arguments(
|
||||
'/LTCG',
|
||||
language: 'c',
|
||||
)
|
||||
endif
|
||||
elif nolibc
|
||||
add_project_arguments(
|
||||
'-fno-stack-protector',
|
||||
language: 'c',
|
||||
)
|
||||
add_project_link_arguments(
|
||||
'-nostdlib',
|
||||
'-nodefaultlibs',
|
||||
language: 'c',
|
||||
)
|
||||
endif
|
||||
|
||||
if cc.get_linker_id() == 'ld.wasm'
|
||||
emflags = ['-sEXPORT_NAME="Zydis"', '-sMODULARIZE=1']
|
||||
add_project_link_arguments(
|
||||
emflags,
|
||||
language: 'c',
|
||||
)
|
||||
endif
|
||||
|
||||
zycore_dep = dependency(
|
||||
'zycore',
|
||||
version: '>=1.5.0',
|
||||
)
|
||||
|
||||
predef = []
|
||||
|
||||
if minimal.enabled()
|
||||
predef += 'ZYDIS_MINIMAL_MODE'
|
||||
endif
|
||||
if decoder.disabled()
|
||||
predef += 'ZYDIS_DISABLE_DECODER'
|
||||
endif
|
||||
if encoder.disabled()
|
||||
predef += 'ZYDIS_DISABLE_ENCODER'
|
||||
endif
|
||||
if formatter.disabled()
|
||||
predef += 'ZYDIS_DISABLE_FORMATTER'
|
||||
endif
|
||||
if avx512.disabled()
|
||||
predef += 'ZYDIS_DISABLE_AVX512'
|
||||
endif
|
||||
if knc.disabled()
|
||||
predef += 'ZYDIS_DISABLE_KNC'
|
||||
endif
|
||||
if segment.disabled()
|
||||
predef += 'ZYDIS_DISABLE_SEGMENT'
|
||||
endif
|
||||
|
||||
foreach def : predef
|
||||
add_project_arguments(f'-D@def@', language: 'c')
|
||||
endforeach
|
||||
|
||||
inc = include_directories('include')
|
||||
inc_private = include_directories('src')
|
||||
|
||||
hdrs_common = files(
|
||||
'include/Zydis/Defines.h',
|
||||
'include/Zydis/MetaInfo.h',
|
||||
'include/Zydis/Mnemonic.h',
|
||||
'include/Zydis/Register.h',
|
||||
'include/Zydis/SharedTypes.h',
|
||||
'include/Zydis/ShortString.h',
|
||||
'include/Zydis/Status.h',
|
||||
'include/Zydis/Utils.h',
|
||||
'include/Zydis/Zydis.h',
|
||||
)
|
||||
|
||||
hdrs_internal = files(
|
||||
'include/Zydis/Internal/SharedData.h',
|
||||
'include/Zydis/Internal/String.h',
|
||||
)
|
||||
|
||||
hdrs_generated = files(
|
||||
'include/Zydis/Generated/EnumISAExt.h',
|
||||
'include/Zydis/Generated/EnumISASet.h',
|
||||
'include/Zydis/Generated/EnumInstructionCategory.h',
|
||||
'include/Zydis/Generated/EnumMnemonic.h',
|
||||
'include/Zydis/Generated/EnumRegister.h',
|
||||
)
|
||||
|
||||
src = files(
|
||||
'src/MetaInfo.c',
|
||||
'src/Mnemonic.c',
|
||||
'src/Register.c',
|
||||
'src/SharedData.c',
|
||||
'src/String.c',
|
||||
'src/Utils.c',
|
||||
'src/Zydis.c',
|
||||
)
|
||||
|
||||
if decoder.enabled()
|
||||
hdrs_common += files(
|
||||
'include/Zydis/Decoder.h',
|
||||
'include/Zydis/DecoderTypes.h',
|
||||
)
|
||||
hdrs_internal += files(
|
||||
'include/Zydis/Internal/DecoderData.h',
|
||||
)
|
||||
src += files(
|
||||
'src/Decoder.c',
|
||||
'src/DecoderData.c',
|
||||
)
|
||||
endif
|
||||
|
||||
if encoder.enabled()
|
||||
hdrs_common += files(
|
||||
'include/Zydis/Encoder.h',
|
||||
)
|
||||
hdrs_internal += files(
|
||||
'include/Zydis/Internal/EncoderData.h',
|
||||
)
|
||||
src += files(
|
||||
'src/Encoder.c',
|
||||
'src/EncoderData.c',
|
||||
)
|
||||
endif
|
||||
|
||||
if formatter.enabled()
|
||||
hdrs_common += files(
|
||||
'include/Zydis/Disassembler.h',
|
||||
'include/Zydis/Formatter.h',
|
||||
'include/Zydis/FormatterBuffer.h',
|
||||
)
|
||||
hdrs_internal += files(
|
||||
'include/Zydis/Internal/FormatterATT.h',
|
||||
'include/Zydis/Internal/FormatterBase.h',
|
||||
'include/Zydis/Internal/FormatterIntel.h',
|
||||
)
|
||||
src += files(
|
||||
'src/Disassembler.c',
|
||||
'src/Formatter.c',
|
||||
'src/FormatterATT.c',
|
||||
'src/FormatterBase.c',
|
||||
'src/FormatterBuffer.c',
|
||||
'src/FormatterIntel.c',
|
||||
)
|
||||
endif
|
||||
|
||||
if segment.enabled()
|
||||
hdrs_common += files(
|
||||
'include/Zydis/Segment.h',
|
||||
)
|
||||
src += files(
|
||||
'src/Segment.c',
|
||||
)
|
||||
endif
|
||||
|
||||
hdrs = hdrs_common + hdrs_internal + hdrs_generated
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
windows = import('windows')
|
||||
src += windows.compile_resources('resources/VersionInfo.rc')
|
||||
endif
|
||||
|
||||
zydis_lib = library(
|
||||
'Zydis',
|
||||
src + hdrs,
|
||||
c_static_args: ['-DZYDIS_STATIC_BUILD'],
|
||||
c_shared_args: ['-DZYDIS_SHOULD_EXPORT'],
|
||||
include_directories: [inc, inc_private],
|
||||
implicit_include_directories: false,
|
||||
dependencies: [zycore_dep],
|
||||
version: meson.project_version(),
|
||||
install: true,
|
||||
)
|
||||
|
||||
install_headers(hdrs_common, subdir: 'Zydis')
|
||||
install_headers(hdrs_internal, subdir: 'Zydis/Internal')
|
||||
install_headers(hdrs_generated, subdir: 'Zydis/Generated')
|
||||
|
||||
# Note: on MSVC, define ZYDIS_STATIC_BUILD and ZYCORE_STATIC_BUILD accordingly
|
||||
# in the user project.
|
||||
zydis_dep = declare_dependency(
|
||||
include_directories: inc,
|
||||
link_with: zydis_lib,
|
||||
dependencies: [zycore_dep],
|
||||
)
|
||||
|
||||
pkg = import('pkgconfig')
|
||||
pkg.generate(
|
||||
zydis_lib,
|
||||
name: 'zydis',
|
||||
description: 'Zyan Disassembler Library',
|
||||
url: 'https://github.com/zyantific/zydis',
|
||||
)
|
||||
|
||||
meson.override_dependency('zydis', zydis_dep)
|
||||
|
||||
subdir('examples')
|
||||
subdir('tools')
|
||||
subdir('tests')
|
||||
|
||||
doxygen_exe = find_program('doxygen', required: doc)
|
||||
doc_req = doxygen_exe.found()
|
||||
if doc_req
|
||||
cdata = configuration_data()
|
||||
cdata.set('VERSION', meson.project_version())
|
||||
cdata.set('TOP_SRCDIR', meson.project_source_root())
|
||||
cdata.set('TOP_BUILDDIR', meson.project_build_root())
|
||||
|
||||
dot_exe = find_program('dot', required: false)
|
||||
if dot_exe.found()
|
||||
cdata.set('HAVE_DOT', 'YES')
|
||||
cdata.set('DOT_PATH', dot_exe.full_path())
|
||||
cdata.set(
|
||||
'HAVE_DOT_1_8_10',
|
||||
dot_exe.version().version_compare('>=1.8.10') ? 'YES' : 'NO',
|
||||
)
|
||||
else
|
||||
cdata.set('HAVE_DOT', 'NO')
|
||||
endif
|
||||
|
||||
if find_program('pdf2svg', required: false).found() or find_program('inkscape', required: false).found()
|
||||
cdata.set('HTML_FORMULA_FORMAT', 'svg')
|
||||
else
|
||||
cdata.set('HTML_FORMULA_FORMAT', 'png')
|
||||
endif
|
||||
|
||||
cdata.set('PREDEFINED', ' '.join(predef))
|
||||
cdata.set(
|
||||
'ZYCORE_INCLUDE_PATH',
|
||||
# We don't care if the directory exists or not
|
||||
meson.project_source_root() / 'subprojects/zycore/include',
|
||||
)
|
||||
|
||||
doxyfile = configure_file(
|
||||
input: 'Doxyfile.meson.in',
|
||||
output: 'Doxyfile',
|
||||
configuration: cdata,
|
||||
install: false,
|
||||
)
|
||||
|
||||
custom_target(
|
||||
'ZydisDoc',
|
||||
input: doxyfile,
|
||||
output: 'doc',
|
||||
command: [doxygen_exe, doxyfile],
|
||||
depend_files: [hdrs, files('Doxyfile')],
|
||||
install: true,
|
||||
install_dir: datadir / 'doc' / 'Zydis',
|
||||
)
|
||||
|
||||
summary(
|
||||
{
|
||||
'dot': cdata.get('HAVE_DOT') == 'YES',
|
||||
'formula format': cdata.get('HTML_FORMULA_FORMAT'),
|
||||
},
|
||||
section: 'Doxygen',
|
||||
)
|
||||
endif
|
||||
|
||||
subdir('man')
|
||||
|
||||
summary(
|
||||
{
|
||||
'doc': doc_req,
|
||||
'nolibc': nolibc,
|
||||
'minimal': minimal,
|
||||
'decoder': decoder,
|
||||
'formatter': formatter,
|
||||
'avx512': avx512,
|
||||
'knc': knc,
|
||||
'segment': segment,
|
||||
'encoder': encoder,
|
||||
},
|
||||
section: 'Features',
|
||||
)
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
option(
|
||||
'minimal',
|
||||
type: 'feature',
|
||||
value: 'disabled',
|
||||
description: 'Enable minimal mode (forces ZYDIS_DECODER_MODE_MINIMAL runtime option)',
|
||||
)
|
||||
option(
|
||||
'decoder',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Enable instruction decoding functionality',
|
||||
)
|
||||
option(
|
||||
'encoder',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Enable instruction encoding functionality',
|
||||
)
|
||||
option(
|
||||
'formatter',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Enable instruction formatting functionality',
|
||||
)
|
||||
option(
|
||||
'avx512',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Enable support for AVX-512 instructions',
|
||||
)
|
||||
option(
|
||||
'knc',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Enable support for KNC instructions',
|
||||
)
|
||||
option(
|
||||
'segment',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Enable instruction segment API',
|
||||
)
|
||||
|
||||
option(
|
||||
'examples',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Build examples',
|
||||
)
|
||||
option(
|
||||
'tools',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Build tools',
|
||||
)
|
||||
option(
|
||||
'man',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Build manpages for the tools (requires Ronn-NG)',
|
||||
)
|
||||
option(
|
||||
'doc',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Build doxygen documentation (requires Doxygen)',
|
||||
)
|
||||
option(
|
||||
'tests',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Build tests',
|
||||
)
|
||||
|
||||
option(
|
||||
'nolibc',
|
||||
type: 'boolean',
|
||||
value: false,
|
||||
description: 'Do not use any C standard library functions (for exotic build-envs like kernel drivers)',
|
||||
)
|
||||
|
||||
option(
|
||||
'llvm-fuzz',
|
||||
type: 'boolean',
|
||||
value: false,
|
||||
description: 'Enables LLVM libfuzzer mode and reduces prints in ZydisFuzzIn',
|
||||
)
|
||||
BIN
Binary file not shown.
+885
-437
File diff suppressed because it is too large
Load Diff
+80
-111
@@ -24,6 +24,7 @@
|
||||
|
||||
***************************************************************************************************/
|
||||
|
||||
#include <Zydis/SharedTypes.h>
|
||||
#include <Zydis/Internal/DecoderData.h>
|
||||
|
||||
/* ============================================================================================== */
|
||||
@@ -40,136 +41,104 @@
|
||||
/* Decoder tree */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#define ZYDIS_INVALID \
|
||||
{ ZYDIS_NODETYPE_INVALID, 0x00000000 }
|
||||
#define ZYDIS_FILTER(type, id) \
|
||||
{ type, id }
|
||||
#define ZYDIS_DEFINITION(encoding_id, id) \
|
||||
{ ZYDIS_NODETYPE_DEFINITION_MASK | encoding_id, id }
|
||||
ZYAN_STATIC_ASSERT(ZYDIS_NODETYPE_REQUIRED_BITS <= 8);
|
||||
|
||||
/**
|
||||
* Defines a decoder tree node header.
|
||||
*
|
||||
* @param type The node type, see `ZydisDecoderTreeNodeTypes`.
|
||||
* @param arg0 The first argument (if applicable).
|
||||
*
|
||||
* Encoding: [15..8] = ARG0, [7..0] = TYPE.
|
||||
*/
|
||||
#define ZYDIS_DT_HEADER(type, arg0) \
|
||||
(0x0000 | (((ZyanU8)(arg0)) << 8) | ((ZyanU8)(type)))
|
||||
|
||||
/**
|
||||
* Defines an arbitrary value decoder tree node entry.
|
||||
*
|
||||
* @param value The value.
|
||||
*/
|
||||
#define ZYDIS_DT_VALUE(value) \
|
||||
((ZyanU16)(value))
|
||||
|
||||
/**
|
||||
* Defines an invalid (unused) decoder tree node entry.
|
||||
*/
|
||||
#define ZYDIS_DT_INVALID \
|
||||
0x0000
|
||||
|
||||
/**
|
||||
* Defines the offset to the next node in the decoder tree, relative to the start of the current
|
||||
* node.
|
||||
*
|
||||
* @param offset The offset to the next node.
|
||||
*/
|
||||
#define ZYDIS_DT_OFFSET(offset) \
|
||||
((ZyanU16)(offset))
|
||||
|
||||
/**
|
||||
* Defines an opcode table switch decoder tree node header that instructs the decoder to switch
|
||||
* to the opcode table with the given `opcode_table_id`.
|
||||
*
|
||||
* @param opcode_table_id The id of the opcode table to switch to.
|
||||
*/
|
||||
#define ZYDIS_DT_SWITCH_TABLE_HEADER(opcode_table_id) \
|
||||
ZYDIS_DT_HEADER(ZYDIS_NODETYPE_SWITCH_TABLE, (opcode_table_id))
|
||||
|
||||
/**
|
||||
* Defines a definition node decoder tree node header.
|
||||
*
|
||||
* @param encoding_id The id of the physical instruction encoding entry for the definition.
|
||||
* See `INSTR_ENCODINGS`.
|
||||
*/
|
||||
#define ZYDIS_DT_DEFINITION_HEADER(encoding_id) \
|
||||
ZYDIS_DT_HEADER(ZYDIS_NODETYPE_DEFINITION, (encoding_id))
|
||||
|
||||
/**
|
||||
* Represents an instruction definition reference. Only valid in combination with the corresponding
|
||||
* instruction encoding.
|
||||
*
|
||||
* @param id The instruction definition.
|
||||
*/
|
||||
#define ZYDIS_DT_DEFINITION(id) \
|
||||
((ZyanU16)(id))
|
||||
|
||||
#include <Generated/DecoderTables.inc>
|
||||
|
||||
#undef ZYDIS_INVALID
|
||||
#undef ZYDIS_FILTER
|
||||
#undef ZYDIS_DEFINITION
|
||||
#undef ZYDIS_DT_HEADER
|
||||
#undef ZYDIS_DT_VALUE
|
||||
#undef ZYDIS_DT_INVALID
|
||||
#undef ZYDIS_DT_OFFSET
|
||||
#undef ZYDIS_DT_SWITCH_TABLE_HEADER
|
||||
#undef ZYDIS_DT_DEFINITION_HEADER
|
||||
#undef ZYDIS_DT_DEFINITION
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* ============================================================================================== */
|
||||
/* Functions */
|
||||
/* API */
|
||||
/* ============================================================================================== */
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
/* Decoder tree */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
const ZydisDecoderTreeNode zydis_decoder_tree_root = { ZYDIS_NODETYPE_FILTER_OPCODE, 0x0000 };
|
||||
|
||||
const ZydisDecoderTreeNode* ZydisDecoderTreeGetChildNode(const ZydisDecoderTreeNode* parent,
|
||||
ZyanU16 index)
|
||||
const ZydisDecoderTreeNode* ZydisGetOpcodeTableRootNode(ZyanU8 opcode_table_id)
|
||||
{
|
||||
switch (parent->type)
|
||||
{
|
||||
case ZYDIS_NODETYPE_FILTER_XOP:
|
||||
ZYAN_ASSERT(index < 13);
|
||||
return &FILTERS_XOP[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_VEX:
|
||||
ZYAN_ASSERT(index < 17);
|
||||
return &FILTERS_VEX[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_EMVEX:
|
||||
ZYAN_ASSERT(index < 49);
|
||||
return &FILTERS_EMVEX[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_OPCODE:
|
||||
ZYAN_ASSERT(index < 256);
|
||||
return &FILTERS_OPCODE[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE:
|
||||
ZYAN_ASSERT(index < 4);
|
||||
return &FILTERS_MODE[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_COMPACT:
|
||||
ZYAN_ASSERT(index < 3);
|
||||
return &FILTERS_MODE_COMPACT[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODRM_MOD:
|
||||
ZYAN_ASSERT(index < 4);
|
||||
return &FILTERS_MODRM_MOD[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODRM_MOD_COMPACT:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODRM_MOD_COMPACT[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODRM_REG:
|
||||
ZYAN_ASSERT(index < 8);
|
||||
return &FILTERS_MODRM_REG[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODRM_RM:
|
||||
ZYAN_ASSERT(index < 8);
|
||||
return &FILTERS_MODRM_RM[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_PREFIX_GROUP1:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_PREFIX_GROUP1[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MANDATORY_PREFIX:
|
||||
ZYAN_ASSERT(index < 5);
|
||||
return &FILTERS_MANDATORY_PREFIX[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_OPERAND_SIZE:
|
||||
ZYAN_ASSERT(index < 3);
|
||||
return &FILTERS_OPERAND_SIZE[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_ADDRESS_SIZE:
|
||||
ZYAN_ASSERT(index < 3);
|
||||
return &FILTERS_ADDRESS_SIZE[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_VECTOR_LENGTH:
|
||||
ZYAN_ASSERT(index < 3);
|
||||
return &FILTERS_VECTOR_LENGTH[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_REX_W:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_REX_W[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_REX_B:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_REX_B[parent->value][index];
|
||||
#ifndef ZYDIS_DISABLE_AVX512
|
||||
case ZYDIS_NODETYPE_FILTER_EVEX_B:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_EVEX_B[parent->value][index];
|
||||
#endif
|
||||
#ifndef ZYDIS_DISABLE_KNC
|
||||
case ZYDIS_NODETYPE_FILTER_MVEX_E:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MVEX_E[parent->value][index];
|
||||
#endif
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_AMD:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODE_AMD[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_KNC:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODE_KNC[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_MPX:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODE_MPX[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_CET:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODE_CET[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_LZCNT:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODE_LZCNT[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_TZCNT:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODE_TZCNT[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_WBNOINVD:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODE_WBNOINVD[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_CLDEMOTE:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODE_CLDEMOTE[parent->value][index];
|
||||
case ZYDIS_NODETYPE_FILTER_MODE_IPREFETCH:
|
||||
ZYAN_ASSERT(index < 2);
|
||||
return &FILTERS_MODE_IPREFETCH[parent->value][index];
|
||||
default:
|
||||
ZYAN_UNREACHABLE;
|
||||
}
|
||||
ZYAN_ASSERT((ZyanUSize)opcode_table_id < ZYAN_ARRAY_LENGTH(OPCODE_TABLE_TREES));
|
||||
|
||||
return OPCODE_TABLE_TREES[opcode_table_id];
|
||||
}
|
||||
|
||||
void ZydisGetInstructionEncodingInfo(const ZydisDecoderTreeNode* node,
|
||||
const ZydisInstructionEncodingInfo** info)
|
||||
{
|
||||
ZYAN_ASSERT(node->type & ZYDIS_NODETYPE_DEFINITION_MASK);
|
||||
const ZyanU8 class = (node->type) & 0x7F;
|
||||
ZYAN_ASSERT(class < ZYAN_ARRAY_LENGTH(INSTR_ENCODINGS));
|
||||
*info = &INSTR_ENCODINGS[class];
|
||||
ZYAN_ASSERT(ZYDIS_DT_GET_TYPE(node) == ZYDIS_NODETYPE_DEFINITION);
|
||||
const ZyanU8 encoding_id = ZYDIS_DT_GET_ARG0(node);
|
||||
|
||||
ZYAN_ASSERT((ZyanUSize)encoding_id < ZYAN_ARRAY_LENGTH(INSTR_ENCODINGS));
|
||||
*info = &INSTR_ENCODINGS[encoding_id];
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
+784
-445
File diff suppressed because it is too large
Load Diff
+1
@@ -28,6 +28,7 @@
|
||||
|
||||
#include <Generated/EncoderTables.inc>
|
||||
#include <Generated/GetRelInfo.inc>
|
||||
#include <Generated/GetCcInfo.inc>
|
||||
|
||||
ZyanU8 ZydisGetEncodableInstructions(ZydisMnemonic mnemonic,
|
||||
const ZydisEncodableInstruction **instruction)
|
||||
|
||||
+30
-4
@@ -49,12 +49,33 @@ ZyanStatus ZydisFormatterATTFormatInstruction(const ZydisFormatter* formatter,
|
||||
ZYAN_ASSERT(context->instruction);
|
||||
ZYAN_ASSERT(context->operands);
|
||||
|
||||
if (!formatter->deco_apx_nf_use_suffix)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context, ZYDIS_DECORATOR_APX_NF));
|
||||
}
|
||||
|
||||
ZYAN_CHECK(formatter->func_print_prefixes(formatter, buffer, context));
|
||||
ZYAN_CHECK(formatter->func_print_mnemonic(formatter, buffer, context));
|
||||
|
||||
if (!formatter->deco_apx_dfv_use_immediate)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context, ZYDIS_DECORATOR_APX_DFV));
|
||||
}
|
||||
|
||||
ZyanUPointer state_mnemonic;
|
||||
ZYDIS_BUFFER_REMEMBER(buffer, state_mnemonic);
|
||||
|
||||
if (formatter->deco_apx_dfv_use_immediate && (context->instruction->apx.scc != ZYDIS_SCC_NONE))
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND(buffer, DELIM_MNEMONIC);
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_IMMEDIATE);
|
||||
ZYDIS_BUFFER_APPEND(buffer, IMMEDIATE);
|
||||
ZYAN_CHECK(ZydisStringAppendDecU(&buffer->string,
|
||||
context->instruction->apx.default_flags, 0,
|
||||
formatter->number_format[ZYDIS_NUMERIC_BASE_DEC][0].string,
|
||||
formatter->number_format[ZYDIS_NUMERIC_BASE_DEC][1].string));
|
||||
}
|
||||
|
||||
const ZyanI8 c = (ZyanI8)context->instruction->operand_count_visible - 1;
|
||||
for (ZyanI8 i = c; i >= 0; --i)
|
||||
{
|
||||
@@ -208,7 +229,7 @@ ZyanStatus ZydisFormatterATTFormatOperandMEM(const ZydisFormatter* formatter,
|
||||
|
||||
const ZyanBool absolute = !formatter->force_relative_riprel &&
|
||||
(context->runtime_address != ZYDIS_RUNTIME_ADDRESS_NONE);
|
||||
if (absolute && context->operand->mem.disp.has_displacement &&
|
||||
if (absolute && context->operand->mem.disp.size &&
|
||||
(context->operand->mem.index == ZYDIS_REGISTER_NONE) &&
|
||||
((context->operand->mem.base == ZYDIS_REGISTER_NONE) ||
|
||||
(context->operand->mem.base == ZYDIS_REGISTER_EIP ) ||
|
||||
@@ -226,7 +247,7 @@ ZyanStatus ZydisFormatterATTFormatOperandMEM(const ZydisFormatter* formatter,
|
||||
if (neither_reg_nor_idx)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_address_abs(formatter, buffer, context));
|
||||
} else if (context->operand->mem.disp.has_displacement && context->operand->mem.disp.value)
|
||||
} else if (context->operand->mem.disp.size && context->operand->mem.disp.value)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_disp(formatter, buffer, context));
|
||||
}
|
||||
@@ -294,16 +315,21 @@ ZyanStatus ZydisFormatterATTPrintMnemonic(const ZydisFormatter* formatter,
|
||||
ZYAN_CHECK(ZydisStringAppendShortCase(&buffer->string, &STR_FAR_ATT,
|
||||
formatter->case_mnemonic));
|
||||
}
|
||||
|
||||
ZYAN_CHECK(ZydisStringAppendShortCase(&buffer->string, mnemonic, formatter->case_mnemonic));
|
||||
|
||||
if (formatter->deco_apx_nf_use_suffix && context->instruction->apx.has_nf)
|
||||
{
|
||||
ZYAN_CHECK(ZydisStringAppendShortCase(&buffer->string, &STR_NF, formatter->case_mnemonic));
|
||||
}
|
||||
|
||||
// Append operand-size suffix
|
||||
ZyanU32 size = 0;
|
||||
for (ZyanU8 i = 0; i < context->instruction->operand_count_visible; ++i)
|
||||
{
|
||||
const ZydisDecodedOperand* const operand = &context->operands[i];
|
||||
if ((operand->type == ZYDIS_OPERAND_TYPE_MEMORY) &&
|
||||
((operand->mem.type == ZYDIS_MEMOP_TYPE_MEM) ||
|
||||
(operand->mem.type == ZYDIS_MEMOP_TYPE_VSIB)))
|
||||
(operand->mem.type == ZYDIS_MEMOP_TYPE_MEM))
|
||||
{
|
||||
size = ZydisFormatterHelperGetExplicitSize(formatter, context, operand);
|
||||
break;
|
||||
|
||||
+45
-8
@@ -201,10 +201,11 @@ ZyanStatus ZydisFormatterBaseFormatOperandIMM(const ZydisFormatter* formatter,
|
||||
ZYAN_ASSERT(context);
|
||||
|
||||
// The immediate operand contains an address
|
||||
if (context->operand->imm.is_relative)
|
||||
if (context->operand->imm.is_address)
|
||||
{
|
||||
const ZyanBool absolute = !formatter->force_relative_branches &&
|
||||
(context->runtime_address != ZYDIS_RUNTIME_ADDRESS_NONE);
|
||||
const ZyanBool absolute = !context->operand->imm.is_relative ||
|
||||
(!formatter->force_relative_branches &&
|
||||
(context->runtime_address != ZYDIS_RUNTIME_ADDRESS_NONE));
|
||||
if (absolute)
|
||||
{
|
||||
return formatter->func_print_address_abs(formatter, buffer, context);
|
||||
@@ -632,7 +633,7 @@ ZyanStatus ZydisFormatterBasePrintDecorator(const ZydisFormatter* formatter,
|
||||
{
|
||||
switch (context->instruction->avx.broadcast.mode)
|
||||
{
|
||||
case ZYDIS_BROADCAST_MODE_INVALID:
|
||||
case ZYDIS_BROADCAST_MODE_NONE:
|
||||
break;
|
||||
case ZYDIS_BROADCAST_MODE_1_TO_2:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_1TO2, formatter->case_decorators);
|
||||
@@ -673,7 +674,7 @@ ZyanStatus ZydisFormatterBasePrintDecorator(const ZydisFormatter* formatter,
|
||||
{
|
||||
switch (context->instruction->avx.rounding.mode)
|
||||
{
|
||||
case ZYDIS_ROUNDING_MODE_INVALID:
|
||||
case ZYDIS_ROUNDING_MODE_NONE:
|
||||
break;
|
||||
case ZYDIS_ROUNDING_MODE_RN:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_RN_SAE, formatter->case_decorators);
|
||||
@@ -694,7 +695,7 @@ ZyanStatus ZydisFormatterBasePrintDecorator(const ZydisFormatter* formatter,
|
||||
{
|
||||
switch (context->instruction->avx.rounding.mode)
|
||||
{
|
||||
case ZYDIS_ROUNDING_MODE_INVALID:
|
||||
case ZYDIS_ROUNDING_MODE_NONE:
|
||||
break;
|
||||
case ZYDIS_ROUNDING_MODE_RN:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_RN, formatter->case_decorators);
|
||||
@@ -726,7 +727,7 @@ ZyanStatus ZydisFormatterBasePrintDecorator(const ZydisFormatter* formatter,
|
||||
#if !defined(ZYDIS_DISABLE_KNC)
|
||||
switch (context->instruction->avx.swizzle.mode)
|
||||
{
|
||||
case ZYDIS_SWIZZLE_MODE_INVALID:
|
||||
case ZYDIS_SWIZZLE_MODE_NONE:
|
||||
case ZYDIS_SWIZZLE_MODE_DCBA:
|
||||
// Nothing to do here
|
||||
break;
|
||||
@@ -760,7 +761,7 @@ ZyanStatus ZydisFormatterBasePrintDecorator(const ZydisFormatter* formatter,
|
||||
#if !defined(ZYDIS_DISABLE_KNC)
|
||||
switch (context->instruction->avx.conversion.mode)
|
||||
{
|
||||
case ZYDIS_CONVERSION_MODE_INVALID:
|
||||
case ZYDIS_CONVERSION_MODE_NONE:
|
||||
break;
|
||||
case ZYDIS_CONVERSION_MODE_FLOAT16:
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_FLOAT16, formatter->case_decorators);
|
||||
@@ -788,6 +789,42 @@ ZyanStatus ZydisFormatterBasePrintDecorator(const ZydisFormatter* formatter,
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_EH, formatter->case_decorators);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case ZYDIS_DECORATOR_APX_NF:
|
||||
#if !defined(ZYDIS_DISABLE_AVX512)
|
||||
if (context->instruction->apx.has_nf)
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_NF, formatter->case_decorators);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case ZYDIS_DECORATOR_APX_DFV:
|
||||
#if !defined(ZYDIS_DISABLE_AVX512)
|
||||
if (context->instruction->apx.scc != ZYDIS_SCC_NONE)
|
||||
{
|
||||
switch (context->instruction->apx.default_flags)
|
||||
{
|
||||
case 0x0: ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DFV_0, formatter->case_decorators); break;
|
||||
case 0x1: ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DFV_1, formatter->case_decorators); break;
|
||||
case 0x2: ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DFV_2, formatter->case_decorators); break;
|
||||
case 0x3: ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DFV_3, formatter->case_decorators); break;
|
||||
case 0x4: ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DFV_4, formatter->case_decorators); break;
|
||||
case 0x5: ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DFV_5, formatter->case_decorators); break;
|
||||
case 0x6: ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DFV_6, formatter->case_decorators); break;
|
||||
case 0x7: ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DFV_7, formatter->case_decorators); break;
|
||||
case 0x8: ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DFV_8, formatter->case_decorators); break;
|
||||
case 0x9: ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DFV_9, formatter->case_decorators); break;
|
||||
case 0xA: ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DFV_A, formatter->case_decorators); break;
|
||||
case 0xB: ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DFV_B, formatter->case_decorators); break;
|
||||
case 0xC: ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DFV_C, formatter->case_decorators); break;
|
||||
case 0xD: ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DFV_D, formatter->case_decorators); break;
|
||||
case 0xE: ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DFV_E, formatter->case_decorators); break;
|
||||
case 0xF: ZYDIS_BUFFER_APPEND_CASE(buffer, DECO_DFV_F, formatter->case_decorators); break;
|
||||
default:
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
|
||||
+6
-1
@@ -120,6 +120,12 @@ ZyanStatus ZydisFormatterBufferAppend(ZydisFormatterBuffer* buffer, ZydisTokenTy
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ZydisFormatterToken* const last = (ZydisFormatterToken*)buffer->string.vector.data - 1;
|
||||
if (last->type == type)
|
||||
{
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
const ZyanUSize len = buffer->string.vector.size;
|
||||
ZYAN_ASSERT((len > 0) && (len < 256));
|
||||
if (buffer->capacity <= len + sizeof(ZydisFormatterToken))
|
||||
@@ -127,7 +133,6 @@ ZyanStatus ZydisFormatterBufferAppend(ZydisFormatterBuffer* buffer, ZydisTokenTy
|
||||
return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
ZydisFormatterToken* const last = (ZydisFormatterToken*)buffer->string.vector.data - 1;
|
||||
last->next = (ZyanU8)len;
|
||||
|
||||
const ZyanUSize delta = len + sizeof(ZydisFormatterToken);
|
||||
|
||||
+32
-2
@@ -51,11 +51,34 @@ ZyanStatus ZydisFormatterIntelFormatInstruction(const ZydisFormatter* formatter,
|
||||
ZYAN_ASSERT(context->instruction);
|
||||
ZYAN_ASSERT(context->operands);
|
||||
|
||||
if (!formatter->deco_apx_nf_use_suffix)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
|
||||
ZYDIS_DECORATOR_APX_NF));
|
||||
}
|
||||
|
||||
ZYAN_CHECK(formatter->func_print_prefixes(formatter, buffer, context));
|
||||
ZYAN_CHECK(formatter->func_print_mnemonic(formatter, buffer, context));
|
||||
|
||||
if (!formatter->deco_apx_dfv_use_immediate)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_decorator(formatter, buffer, context,
|
||||
ZYDIS_DECORATOR_APX_DFV));
|
||||
}
|
||||
|
||||
ZyanUPointer state_mnemonic;
|
||||
ZYDIS_BUFFER_REMEMBER(buffer, state_mnemonic);
|
||||
|
||||
if (formatter->deco_apx_dfv_use_immediate && (context->instruction->apx.scc != ZYDIS_SCC_NONE))
|
||||
{
|
||||
ZYDIS_BUFFER_APPEND(buffer, DELIM_MNEMONIC);
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_IMMEDIATE);
|
||||
ZYAN_CHECK(ZydisStringAppendDecU(&buffer->string,
|
||||
context->instruction->apx.default_flags, 0,
|
||||
formatter->number_format[ZYDIS_NUMERIC_BASE_DEC][0].string,
|
||||
formatter->number_format[ZYDIS_NUMERIC_BASE_DEC][1].string));
|
||||
}
|
||||
|
||||
for (ZyanU8 i = 0; i < context->instruction->operand_count_visible; ++i)
|
||||
{
|
||||
const ZydisDecodedOperand* const operand = &context->operands[i];
|
||||
@@ -212,7 +235,7 @@ ZyanStatus ZydisFormatterIntelFormatOperandMEM(const ZydisFormatter* formatter,
|
||||
|
||||
const ZyanBool absolute = !formatter->force_relative_riprel &&
|
||||
(context->runtime_address != ZYDIS_RUNTIME_ADDRESS_NONE);
|
||||
if (absolute && context->operand->mem.disp.has_displacement &&
|
||||
if (absolute && context->operand->mem.disp.size &&
|
||||
(context->operand->mem.index == ZYDIS_REGISTER_NONE) &&
|
||||
((context->operand->mem.base == ZYDIS_REGISTER_NONE) ||
|
||||
(context->operand->mem.base == ZYDIS_REGISTER_EIP ) ||
|
||||
@@ -253,7 +276,7 @@ ZyanStatus ZydisFormatterIntelFormatOperandMEM(const ZydisFormatter* formatter,
|
||||
if (neither_reg_nor_idx)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_address_abs(formatter, buffer, context));
|
||||
} else if (context->operand->mem.disp.has_displacement && context->operand->mem.disp.value)
|
||||
} else if (context->operand->mem.disp.size && context->operand->mem.disp.value)
|
||||
{
|
||||
ZYAN_CHECK(formatter->func_print_disp(formatter, buffer, context));
|
||||
}
|
||||
@@ -280,10 +303,17 @@ ZyanStatus ZydisFormatterIntelPrintMnemonic(const ZydisFormatter* formatter,
|
||||
|
||||
ZYDIS_BUFFER_APPEND_TOKEN(buffer, ZYDIS_TOKEN_MNEMONIC);
|
||||
ZYAN_CHECK(ZydisStringAppendShortCase(&buffer->string, mnemonic, formatter->case_mnemonic));
|
||||
|
||||
if (formatter->deco_apx_nf_use_suffix && context->instruction->apx.has_nf)
|
||||
{
|
||||
ZYAN_CHECK(ZydisStringAppendShortCase(&buffer->string, &STR_NF, formatter->case_mnemonic));
|
||||
}
|
||||
|
||||
if (context->instruction->meta.branch_type == ZYDIS_BRANCH_TYPE_FAR)
|
||||
{
|
||||
return ZydisStringAppendShortCase(&buffer->string, &STR_FAR, formatter->case_mnemonic);
|
||||
}
|
||||
|
||||
if (formatter->print_branch_size)
|
||||
{
|
||||
switch (context->instruction->meta.branch_type)
|
||||
|
||||
+77
-74
@@ -1,78 +1,81 @@
|
||||
#ifndef ZYDIS_MINIMAL_MODE
|
||||
static const ZydisDefinitionAccessedFlags ACCESSED_FLAGS[] =
|
||||
static const ZydisDefinitionAccessedFlags ACCESSED_FLAGS[] =
|
||||
{
|
||||
{ { 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0xF, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x6, 0x0, 0x0, 0x9 } },
|
||||
{ { 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0xD } },
|
||||
{ { 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0xF } },
|
||||
{ { 0x0, 0x0, 0x40000, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x0, 0x40000, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1000, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x800, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x800, 0x800, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x400, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1400, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x400, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x0, 0x400, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1000, 0x80200, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x30200, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x21800, 0x64300, 0x10000, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x21000, 0xE4200, 0x10100, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x80, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x880, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x40, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x40, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0xD } },
|
||||
{ { 0x8C0, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x40, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x4, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x4, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0xD } },
|
||||
{ { 0x0, 0x8D4, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0xD } },
|
||||
{ { 0x41, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x41, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0xD } },
|
||||
{ { 0xD5, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x3F5FD5, 0x0, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1, 0x1, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1, 0x1, 0x0, 0x0, 0x800 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x11, 0xD5, 0x0, 0x0, 0x800 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1, 0x8D5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x1, 0x8C5, 0x0, 0x0, 0x10 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x1, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x1, 0x0, 0x0, 0x800 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x41, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x440, 0x8D5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0xD5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x8D5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x400, 0x8D5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x25000, 0x3F5FD5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x21000, 0x3D5FD5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x121000, 0x2C5FD5, 0x10000, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x3F5FD5, 0x0, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x3C5FD5, 0x10000, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x3C5FD5, 0x30000, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x45, 0x890, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x45, 0x890, 0x0, 0x0 }, { 0x0, 0x2, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0xC5, 0x0, 0x0, 0x810 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x8C1, 0x14, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x41, 0x894, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x1, 0x8D4, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x10, 0x11, 0x0, 0x0, 0x8C4 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x1, 0x0, 0x0, 0x894 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0xC1, 0x800, 0x0, 0x14 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x41, 0x0, 0x0, 0x894 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x81, 0x840, 0x0, 0x14 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x801, 0x0, 0x0, 0xD4 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x1, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0xC4, 0x801, 0x0, 0x10 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x40, 0x895, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x8D5, 0x0, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0xC0, 0x801, 0x0, 0x14 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x40, 0x801, 0x0, 0x94 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x0, 0x1, 0x0 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0xC4, 0x0, 0x0, 0x811 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x40, 0x0, 0x0, 0x895 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } },
|
||||
{ { 0x0, 0x0, 0x0, 0x0, 0x8D5 }, { 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
{ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000F } },
|
||||
{ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x0000000D } },
|
||||
{ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000006, 0x00000000, 0x00000000, 0x00000009 } },
|
||||
{ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x0000000F, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000008D5 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000000, 0x000008D5, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000000, 0x00030200, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000000, 0x00040000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000800 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000894 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000001, 0x000008D4, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000040, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000040, 0x00000000, 0x00000000, 0x00000895 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000040, 0x00000801, 0x00000000, 0x00000094 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000040, 0x00000895, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000041, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000041, 0x00000000, 0x00000000, 0x00000894 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000041, 0x00000894, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000045, 0x00000890, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000045, 0x00000890, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000081, 0x00000840, 0x00000000, 0x00000014 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x000000C0, 0x00000801, 0x00000000, 0x00000014 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x000000C1, 0x00000800, 0x00000000, 0x00000014 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x000000C4, 0x00000000, 0x00000000, 0x00000811 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x000000C4, 0x00000801, 0x00000000, 0x00000010 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x000000C5, 0x00000000, 0x00000000, 0x00000810 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x000000D5, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000800, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000801, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x00000801, 0x00000000, 0x00000000, 0x000000D4 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x000008C1, 0x00000014, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x000008C5, 0x00000000, 0x00000000, 0x00000010 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x000008D4, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x000008D5, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x003C5FD5, 0x00010000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x003C5FD5, 0x00030000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000000, 0x003F5FD5, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x0000000D } },
|
||||
{ { 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000800 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000001, 0x000008C5, 0x00000000, 0x00000000, 0x00000010 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000001, 0x000008D5, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x0000000D } },
|
||||
{ { 0x00000010, 0x00000011, 0x00000000, 0x00000000, 0x000008C4 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000011, 0x000000D5, 0x00000000, 0x00000000, 0x00000800 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x0000000D } },
|
||||
{ { 0x00000041, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000041, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x0000000D } },
|
||||
{ { 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x000000D5, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000400, 0x000008D5, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000440, 0x000008D5, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000800, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000800, 0x00000800, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00000880, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x000008C0, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00001000, 0x00080200, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00001400, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00021000, 0x000E4200, 0x00010100, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00021000, 0x003D5FD5, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00021800, 0x00064300, 0x00010000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00025000, 0x003F5FD5, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x00121000, 0x002C5FD5, 0x00010000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
|
||||
{ { 0x003F5FD5, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } }
|
||||
};
|
||||
#endif
|
||||
|
||||
+78630
-7775
File diff suppressed because one or more lines are too long
+11682
-9544
File diff suppressed because it is too large
Load Diff
+4
@@ -10,6 +10,8 @@ static const char* STR_ISAEXT[] =
|
||||
"AMX_FP16",
|
||||
"AMX_INT8",
|
||||
"AMX_TILE",
|
||||
"APXEVEX",
|
||||
"APXLEGACY",
|
||||
"AVX",
|
||||
"AVX2",
|
||||
"AVX2GATHER",
|
||||
@@ -34,6 +36,7 @@ static const char* STR_ISAEXT[] =
|
||||
"F16C",
|
||||
"FMA",
|
||||
"FMA4",
|
||||
"FRED",
|
||||
"GFNI",
|
||||
"HRESET",
|
||||
"ICACHE_PREFETCH",
|
||||
@@ -43,6 +46,7 @@ static const char* STR_ISAEXT[] =
|
||||
"KNC",
|
||||
"KNCE",
|
||||
"KNCV",
|
||||
"LKGS",
|
||||
"LONGMODE",
|
||||
"LZCNT",
|
||||
"MCOMMIT",
|
||||
|
||||
+23
@@ -10,6 +10,27 @@ static const char* STR_ISASET[] =
|
||||
"AMX_FP16",
|
||||
"AMX_INT8",
|
||||
"AMX_TILE",
|
||||
"APX_F",
|
||||
"APX_F_ADX",
|
||||
"APX_F_AMX",
|
||||
"APX_F_BMI1",
|
||||
"APX_F_BMI2",
|
||||
"APX_F_CET",
|
||||
"APX_F_CMPCCXADD",
|
||||
"APX_F_ENQCMD",
|
||||
"APX_F_INVPCID",
|
||||
"APX_F_KOPB",
|
||||
"APX_F_KOPD",
|
||||
"APX_F_KOPQ",
|
||||
"APX_F_KOPW",
|
||||
"APX_F_LZCNT",
|
||||
"APX_F_MOVBE",
|
||||
"APX_F_MOVDIR64B",
|
||||
"APX_F_MOVDIRI",
|
||||
"APX_F_POPCNT",
|
||||
"APX_F_RAO_INT",
|
||||
"APX_F_USER_MSR",
|
||||
"APX_F_VMX",
|
||||
"AVX",
|
||||
"AVX2",
|
||||
"AVX2GATHER",
|
||||
@@ -101,6 +122,7 @@ static const char* STR_ISASET[] =
|
||||
"FCOMI",
|
||||
"FMA",
|
||||
"FMA4",
|
||||
"FRED",
|
||||
"FXSAVE",
|
||||
"FXSAVE64",
|
||||
"GFNI",
|
||||
@@ -123,6 +145,7 @@ static const char* STR_ISASET[] =
|
||||
"KNC_MISC",
|
||||
"KNC_PF_HINT",
|
||||
"LAHF",
|
||||
"LKGS",
|
||||
"LONGMODE",
|
||||
"LWP",
|
||||
"LZCNT",
|
||||
|
||||
+3
@@ -5,6 +5,7 @@ static const char* STR_INSTRUCTIONCATEGORY[] =
|
||||
"AES",
|
||||
"AMD3DNOW",
|
||||
"AMX_TILE",
|
||||
"APX",
|
||||
"AVX",
|
||||
"AVX2",
|
||||
"AVX2GATHER",
|
||||
@@ -40,6 +41,7 @@ static const char* STR_INSTRUCTIONCATEGORY[] =
|
||||
"FLAGOP",
|
||||
"FMA4",
|
||||
"FP16",
|
||||
"FRED",
|
||||
"GATHER",
|
||||
"GFNI",
|
||||
"HRESET",
|
||||
@@ -54,6 +56,7 @@ static const char* STR_INSTRUCTIONCATEGORY[] =
|
||||
"KNCMASK",
|
||||
"KNCSCALAR",
|
||||
"LEGACY",
|
||||
"LKGS",
|
||||
"LOGICAL",
|
||||
"LOGICAL_FP",
|
||||
"LZCNT",
|
||||
|
||||
+93
@@ -73,8 +73,40 @@ static const ZydisShortString STR_MNEMONIC[] =
|
||||
ZYDIS_MAKE_SHORTSTRING("bzhi"),
|
||||
ZYDIS_MAKE_SHORTSTRING("call"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cbw"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ccmpb"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ccmpbe"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ccmpf"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ccmpl"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ccmple"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ccmpnb"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ccmpnbe"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ccmpnl"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ccmpnle"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ccmpno"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ccmpns"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ccmpnz"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ccmpo"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ccmps"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ccmpt"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ccmpz"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cdq"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cdqe"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cfcmovb"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cfcmovbe"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cfcmovl"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cfcmovle"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cfcmovnb"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cfcmovnbe"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cfcmovnl"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cfcmovnle"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cfcmovno"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cfcmovnp"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cfcmovns"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cfcmovnz"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cfcmovo"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cfcmovp"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cfcmovs"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cfcmovz"),
|
||||
ZYDIS_MAKE_SHORTSTRING("clac"),
|
||||
ZYDIS_MAKE_SHORTSTRING("clc"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cld"),
|
||||
@@ -108,21 +140,53 @@ static const ZydisShortString STR_MNEMONIC[] =
|
||||
ZYDIS_MAKE_SHORTSTRING("cmovs"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmovz"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmp"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpbexadd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpbxadd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmplexadd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmplxadd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpnbexadd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpnbxadd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpnlexadd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpnlxadd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpnoxadd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpnpxadd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpnsxadd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpnzxadd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpoxadd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmppd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpps"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmppxadd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpsb"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpsd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpsq"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpss"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpsw"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpsxadd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpxchg"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpxchg16b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpxchg8b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cmpzxadd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("comisd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("comiss"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cpuid"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cqo"),
|
||||
ZYDIS_MAKE_SHORTSTRING("crc32"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ctestb"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ctestbe"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ctestf"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ctestl"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ctestle"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ctestnb"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ctestnbe"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ctestnl"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ctestnle"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ctestno"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ctestns"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ctestnz"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ctesto"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ctests"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ctestt"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ctestz"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cvtdq2pd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cvtdq2ps"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cvtpd2dq"),
|
||||
@@ -169,6 +233,8 @@ static const ZydisShortString STR_MNEMONIC[] =
|
||||
ZYDIS_MAKE_SHORTSTRING("enqcmd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("enqcmds"),
|
||||
ZYDIS_MAKE_SHORTSTRING("enter"),
|
||||
ZYDIS_MAKE_SHORTSTRING("erets"),
|
||||
ZYDIS_MAKE_SHORTSTRING("eretu"),
|
||||
ZYDIS_MAKE_SHORTSTRING("extractps"),
|
||||
ZYDIS_MAKE_SHORTSTRING("extrq"),
|
||||
ZYDIS_MAKE_SHORTSTRING("f2xm1"),
|
||||
@@ -280,6 +346,7 @@ static const ZydisShortString STR_MNEMONIC[] =
|
||||
ZYDIS_MAKE_SHORTSTRING("hsubps"),
|
||||
ZYDIS_MAKE_SHORTSTRING("idiv"),
|
||||
ZYDIS_MAKE_SHORTSTRING("imul"),
|
||||
ZYDIS_MAKE_SHORTSTRING("imulzu"),
|
||||
ZYDIS_MAKE_SHORTSTRING("in"),
|
||||
ZYDIS_MAKE_SHORTSTRING("inc"),
|
||||
ZYDIS_MAKE_SHORTSTRING("incsspd"),
|
||||
@@ -312,6 +379,7 @@ static const ZydisShortString STR_MNEMONIC[] =
|
||||
ZYDIS_MAKE_SHORTSTRING("jl"),
|
||||
ZYDIS_MAKE_SHORTSTRING("jle"),
|
||||
ZYDIS_MAKE_SHORTSTRING("jmp"),
|
||||
ZYDIS_MAKE_SHORTSTRING("jmpabs"),
|
||||
ZYDIS_MAKE_SHORTSTRING("jnb"),
|
||||
ZYDIS_MAKE_SHORTSTRING("jnbe"),
|
||||
ZYDIS_MAKE_SHORTSTRING("jnl"),
|
||||
@@ -404,6 +472,7 @@ static const ZydisShortString STR_MNEMONIC[] =
|
||||
ZYDIS_MAKE_SHORTSTRING("lgdt"),
|
||||
ZYDIS_MAKE_SHORTSTRING("lgs"),
|
||||
ZYDIS_MAKE_SHORTSTRING("lidt"),
|
||||
ZYDIS_MAKE_SHORTSTRING("lkgs"),
|
||||
ZYDIS_MAKE_SHORTSTRING("lldt"),
|
||||
ZYDIS_MAKE_SHORTSTRING("llwpcb"),
|
||||
ZYDIS_MAKE_SHORTSTRING("lmsw"),
|
||||
@@ -610,12 +679,15 @@ static const ZydisShortString STR_MNEMONIC[] =
|
||||
ZYDIS_MAKE_SHORTSTRING("pmullw"),
|
||||
ZYDIS_MAKE_SHORTSTRING("pmuludq"),
|
||||
ZYDIS_MAKE_SHORTSTRING("pop"),
|
||||
ZYDIS_MAKE_SHORTSTRING("pop2"),
|
||||
ZYDIS_MAKE_SHORTSTRING("pop2p"),
|
||||
ZYDIS_MAKE_SHORTSTRING("popa"),
|
||||
ZYDIS_MAKE_SHORTSTRING("popad"),
|
||||
ZYDIS_MAKE_SHORTSTRING("popcnt"),
|
||||
ZYDIS_MAKE_SHORTSTRING("popf"),
|
||||
ZYDIS_MAKE_SHORTSTRING("popfd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("popfq"),
|
||||
ZYDIS_MAKE_SHORTSTRING("popp"),
|
||||
ZYDIS_MAKE_SHORTSTRING("por"),
|
||||
ZYDIS_MAKE_SHORTSTRING("prefetch"),
|
||||
ZYDIS_MAKE_SHORTSTRING("prefetchit0"),
|
||||
@@ -666,11 +738,14 @@ static const ZydisShortString STR_MNEMONIC[] =
|
||||
ZYDIS_MAKE_SHORTSTRING("punpcklqdq"),
|
||||
ZYDIS_MAKE_SHORTSTRING("punpcklwd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("push"),
|
||||
ZYDIS_MAKE_SHORTSTRING("push2"),
|
||||
ZYDIS_MAKE_SHORTSTRING("push2p"),
|
||||
ZYDIS_MAKE_SHORTSTRING("pusha"),
|
||||
ZYDIS_MAKE_SHORTSTRING("pushad"),
|
||||
ZYDIS_MAKE_SHORTSTRING("pushf"),
|
||||
ZYDIS_MAKE_SHORTSTRING("pushfd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("pushfq"),
|
||||
ZYDIS_MAKE_SHORTSTRING("pushp"),
|
||||
ZYDIS_MAKE_SHORTSTRING("pvalidate"),
|
||||
ZYDIS_MAKE_SHORTSTRING("pxor"),
|
||||
ZYDIS_MAKE_SHORTSTRING("rcl"),
|
||||
@@ -737,6 +812,22 @@ static const ZydisShortString STR_MNEMONIC[] =
|
||||
ZYDIS_MAKE_SHORTSTRING("sets"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setssbsy"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setz"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setzub"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setzube"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setzul"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setzule"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setzunb"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setzunbe"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setzunl"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setzunle"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setzuno"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setzunp"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setzuns"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setzunz"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setzuo"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setzup"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setzus"),
|
||||
ZYDIS_MAKE_SHORTSTRING("setzuz"),
|
||||
ZYDIS_MAKE_SHORTSTRING("sfence"),
|
||||
ZYDIS_MAKE_SHORTSTRING("sgdt"),
|
||||
ZYDIS_MAKE_SHORTSTRING("sha1msg1"),
|
||||
@@ -819,6 +910,8 @@ static const ZydisShortString STR_MNEMONIC[] =
|
||||
ZYDIS_MAKE_SHORTSTRING("unpckhps"),
|
||||
ZYDIS_MAKE_SHORTSTRING("unpcklpd"),
|
||||
ZYDIS_MAKE_SHORTSTRING("unpcklps"),
|
||||
ZYDIS_MAKE_SHORTSTRING("urdmsr"),
|
||||
ZYDIS_MAKE_SHORTSTRING("uwrmsr"),
|
||||
ZYDIS_MAKE_SHORTSTRING("v4fmaddps"),
|
||||
ZYDIS_MAKE_SHORTSTRING("v4fmaddss"),
|
||||
ZYDIS_MAKE_SHORTSTRING("v4fnmaddps"),
|
||||
|
||||
+66
-1
@@ -22,6 +22,22 @@ static const ZydisShortString STR_REGISTERS[] =
|
||||
ZYDIS_MAKE_SHORTSTRING("r13b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r14b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r15b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r16b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r17b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r18b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r19b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r20b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r21b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r22b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r23b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r24b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r25b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r26b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r27b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r28b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r29b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r30b"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r31b"),
|
||||
// General purpose registers 16-bit
|
||||
ZYDIS_MAKE_SHORTSTRING("ax"),
|
||||
ZYDIS_MAKE_SHORTSTRING("cx"),
|
||||
@@ -39,6 +55,22 @@ static const ZydisShortString STR_REGISTERS[] =
|
||||
ZYDIS_MAKE_SHORTSTRING("r13w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r14w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r15w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r16w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r17w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r18w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r19w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r20w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r21w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r22w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r23w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r24w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r25w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r26w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r27w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r28w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r29w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r30w"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r31w"),
|
||||
// General purpose registers 32-bit
|
||||
ZYDIS_MAKE_SHORTSTRING("eax"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ecx"),
|
||||
@@ -56,6 +88,22 @@ static const ZydisShortString STR_REGISTERS[] =
|
||||
ZYDIS_MAKE_SHORTSTRING("r13d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r14d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r15d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r16d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r17d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r18d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r19d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r20d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r21d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r22d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r23d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r24d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r25d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r26d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r27d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r28d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r29d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r30d"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r31d"),
|
||||
// General purpose registers 64-bit
|
||||
ZYDIS_MAKE_SHORTSTRING("rax"),
|
||||
ZYDIS_MAKE_SHORTSTRING("rcx"),
|
||||
@@ -73,6 +121,22 @@ static const ZydisShortString STR_REGISTERS[] =
|
||||
ZYDIS_MAKE_SHORTSTRING("r13"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r14"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r15"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r16"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r17"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r18"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r19"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r20"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r21"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r22"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r23"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r24"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r25"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r26"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r27"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r28"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r29"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r30"),
|
||||
ZYDIS_MAKE_SHORTSTRING("r31"),
|
||||
// Floating point legacy registers
|
||||
ZYDIS_MAKE_SHORTSTRING("st0"),
|
||||
ZYDIS_MAKE_SHORTSTRING("st1"),
|
||||
@@ -285,5 +349,6 @@ static const ZydisShortString STR_REGISTERS[] =
|
||||
ZYDIS_MAKE_SHORTSTRING("mxcsr"),
|
||||
ZYDIS_MAKE_SHORTSTRING("pkru"),
|
||||
ZYDIS_MAKE_SHORTSTRING("xcr0"),
|
||||
ZYDIS_MAKE_SHORTSTRING("uif")
|
||||
ZYDIS_MAKE_SHORTSTRING("uif"),
|
||||
ZYDIS_MAKE_SHORTSTRING("ia32_kernel_gs_base")
|
||||
};
|
||||
|
||||
+154
@@ -171,6 +171,150 @@ static const struct ZydisPredefinedTokenDECO_DDDD_
|
||||
} TOK_DATA_DECO_DDDD = { 19, 17, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 5, 'd', 'd', 'd', 'd', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DDDD = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DDDD;
|
||||
|
||||
static const ZydisShortString STR_DECO_DFV_0 = ZYDIS_MAKE_SHORTSTRING(" {dfv=}");
|
||||
static const struct ZydisPredefinedTokenDECO_DFV_0_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[19];
|
||||
} TOK_DATA_DECO_DFV_0 = { 19, 17, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 5, 'd', 'f', 'v', '=', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DFV_0 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DFV_0;
|
||||
|
||||
static const ZydisShortString STR_DECO_DFV_1 = ZYDIS_MAKE_SHORTSTRING(" {dfv=cf}");
|
||||
static const struct ZydisPredefinedTokenDECO_DFV_1_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[21];
|
||||
} TOK_DATA_DECO_DFV_1 = { 21, 19, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 7, 'd', 'f', 'v', '=', 'c', 'f', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DFV_1 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DFV_1;
|
||||
|
||||
static const ZydisShortString STR_DECO_DFV_2 = ZYDIS_MAKE_SHORTSTRING(" {dfv=zf}");
|
||||
static const struct ZydisPredefinedTokenDECO_DFV_2_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[21];
|
||||
} TOK_DATA_DECO_DFV_2 = { 21, 19, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 7, 'd', 'f', 'v', '=', 'z', 'f', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DFV_2 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DFV_2;
|
||||
|
||||
static const ZydisShortString STR_DECO_DFV_3 = ZYDIS_MAKE_SHORTSTRING(" {dfv=cf, zf}");
|
||||
static const struct ZydisPredefinedTokenDECO_DFV_3_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[25];
|
||||
} TOK_DATA_DECO_DFV_3 = { 25, 23, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 11, 'd', 'f', 'v', '=', 'c', 'f', ',', ' ', 'z', 'f', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DFV_3 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DFV_3;
|
||||
|
||||
static const ZydisShortString STR_DECO_DFV_4 = ZYDIS_MAKE_SHORTSTRING(" {dfv=sf}");
|
||||
static const struct ZydisPredefinedTokenDECO_DFV_4_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[21];
|
||||
} TOK_DATA_DECO_DFV_4 = { 21, 19, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 7, 'd', 'f', 'v', '=', 's', 'f', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DFV_4 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DFV_4;
|
||||
|
||||
static const ZydisShortString STR_DECO_DFV_5 = ZYDIS_MAKE_SHORTSTRING(" {dfv=cf, sf}");
|
||||
static const struct ZydisPredefinedTokenDECO_DFV_5_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[25];
|
||||
} TOK_DATA_DECO_DFV_5 = { 25, 23, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 11, 'd', 'f', 'v', '=', 'c', 'f', ',', ' ', 's', 'f', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DFV_5 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DFV_5;
|
||||
|
||||
static const ZydisShortString STR_DECO_DFV_6 = ZYDIS_MAKE_SHORTSTRING(" {dfv=zf, sf}");
|
||||
static const struct ZydisPredefinedTokenDECO_DFV_6_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[25];
|
||||
} TOK_DATA_DECO_DFV_6 = { 25, 23, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 11, 'd', 'f', 'v', '=', 'z', 'f', ',', ' ', 's', 'f', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DFV_6 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DFV_6;
|
||||
|
||||
static const ZydisShortString STR_DECO_DFV_7 = ZYDIS_MAKE_SHORTSTRING(" {dfv=cf, zf, sf}");
|
||||
static const struct ZydisPredefinedTokenDECO_DFV_7_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[29];
|
||||
} TOK_DATA_DECO_DFV_7 = { 29, 27, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 15, 'd', 'f', 'v', '=', 'c', 'f', ',', ' ', 'z', 'f', ',', ' ', 's', 'f', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DFV_7 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DFV_7;
|
||||
|
||||
static const ZydisShortString STR_DECO_DFV_8 = ZYDIS_MAKE_SHORTSTRING(" {dfv=of}");
|
||||
static const struct ZydisPredefinedTokenDECO_DFV_8_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[21];
|
||||
} TOK_DATA_DECO_DFV_8 = { 21, 19, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 7, 'd', 'f', 'v', '=', 'o', 'f', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DFV_8 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DFV_8;
|
||||
|
||||
static const ZydisShortString STR_DECO_DFV_9 = ZYDIS_MAKE_SHORTSTRING(" {dfv=cf, of}");
|
||||
static const struct ZydisPredefinedTokenDECO_DFV_9_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[25];
|
||||
} TOK_DATA_DECO_DFV_9 = { 25, 23, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 11, 'd', 'f', 'v', '=', 'c', 'f', ',', ' ', 'o', 'f', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DFV_9 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DFV_9;
|
||||
|
||||
static const ZydisShortString STR_DECO_DFV_A = ZYDIS_MAKE_SHORTSTRING(" {dfv=zf, of}");
|
||||
static const struct ZydisPredefinedTokenDECO_DFV_A_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[25];
|
||||
} TOK_DATA_DECO_DFV_A = { 25, 23, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 11, 'd', 'f', 'v', '=', 'z', 'f', ',', ' ', 'o', 'f', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DFV_A = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DFV_A;
|
||||
|
||||
static const ZydisShortString STR_DECO_DFV_B = ZYDIS_MAKE_SHORTSTRING(" {dfv=cf, zf, of}");
|
||||
static const struct ZydisPredefinedTokenDECO_DFV_B_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[29];
|
||||
} TOK_DATA_DECO_DFV_B = { 29, 27, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 15, 'd', 'f', 'v', '=', 'c', 'f', ',', ' ', 'z', 'f', ',', ' ', 'o', 'f', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DFV_B = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DFV_B;
|
||||
|
||||
static const ZydisShortString STR_DECO_DFV_C = ZYDIS_MAKE_SHORTSTRING(" {dfv=sf, of}");
|
||||
static const struct ZydisPredefinedTokenDECO_DFV_C_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[25];
|
||||
} TOK_DATA_DECO_DFV_C = { 25, 23, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 11, 'd', 'f', 'v', '=', 's', 'f', ',', ' ', 'o', 'f', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DFV_C = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DFV_C;
|
||||
|
||||
static const ZydisShortString STR_DECO_DFV_D = ZYDIS_MAKE_SHORTSTRING(" {dfv=cf, sf, of}");
|
||||
static const struct ZydisPredefinedTokenDECO_DFV_D_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[29];
|
||||
} TOK_DATA_DECO_DFV_D = { 29, 27, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 15, 'd', 'f', 'v', '=', 'c', 'f', ',', ' ', 's', 'f', ',', ' ', 'o', 'f', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DFV_D = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DFV_D;
|
||||
|
||||
static const ZydisShortString STR_DECO_DFV_E = ZYDIS_MAKE_SHORTSTRING(" {dfv=zf, sf, of}");
|
||||
static const struct ZydisPredefinedTokenDECO_DFV_E_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[29];
|
||||
} TOK_DATA_DECO_DFV_E = { 29, 27, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 15, 'd', 'f', 'v', '=', 'z', 'f', ',', ' ', 's', 'f', ',', ' ', 'o', 'f', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DFV_E = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DFV_E;
|
||||
|
||||
static const ZydisShortString STR_DECO_DFV_F = ZYDIS_MAKE_SHORTSTRING(" {dfv=cf, zf, sf, of}");
|
||||
static const struct ZydisPredefinedTokenDECO_DFV_F_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[33];
|
||||
} TOK_DATA_DECO_DFV_F = { 33, 31, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 19, 'd', 'f', 'v', '=', 'c', 'f', ',', ' ', 'z', 'f', ',', ' ', 's', 'f', ',', ' ', 'o', 'f', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_DFV_F = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_DFV_F;
|
||||
|
||||
static const ZydisShortString STR_DECO_EH = ZYDIS_MAKE_SHORTSTRING(" {eh}");
|
||||
static const struct ZydisPredefinedTokenDECO_EH_
|
||||
{
|
||||
@@ -198,6 +342,15 @@ static const struct ZydisPredefinedTokenDECO_FLOAT16_
|
||||
} TOK_DATA_DECO_FLOAT16 = { 22, 20, { ZYDIS_TOKEN_WHITESPACE, 2, ' ', '\0', ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 8, 'f', 'l', 'o', 'a', 't', '1', '6', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 0, '}', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_FLOAT16 = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_FLOAT16;
|
||||
|
||||
static const ZydisShortString STR_DECO_NF = ZYDIS_MAKE_SHORTSTRING("{nf} ");
|
||||
static const struct ZydisPredefinedTokenDECO_NF_
|
||||
{
|
||||
ZyanU8 size;
|
||||
ZyanU8 next;
|
||||
ZyanU8 data[17];
|
||||
} TOK_DATA_DECO_NF = { 17, 15, { ZYDIS_TOKEN_PARENTHESIS_OPEN, 2, '{', '\0', ZYDIS_TOKEN_DECORATOR, 3, 'n', 'f', '\0', ZYDIS_TOKEN_PARENTHESIS_CLOSE, 2, '}', '\0', ZYDIS_TOKEN_WHITESPACE, 0, ' ', '\0' } };
|
||||
static const ZydisPredefinedToken* const TOK_DECO_NF = (const ZydisPredefinedToken* const)&TOK_DATA_DECO_NF;
|
||||
|
||||
static const ZydisShortString STR_DECO_RD = ZYDIS_MAKE_SHORTSTRING(" {rd}");
|
||||
static const struct ZydisPredefinedTokenDECO_RD_
|
||||
{
|
||||
@@ -435,6 +588,7 @@ static const struct ZydisPredefinedTokenMUL_
|
||||
static const ZydisPredefinedToken* const TOK_MUL = (const ZydisPredefinedToken* const)&TOK_DATA_MUL;
|
||||
|
||||
static const ZydisShortString STR_NEAR = ZYDIS_MAKE_SHORTSTRING(" near");
|
||||
static const ZydisShortString STR_NF = ZYDIS_MAKE_SHORTSTRING("nf");
|
||||
static const ZydisShortString STR_PREF_BND = ZYDIS_MAKE_SHORTSTRING("bnd ");
|
||||
static const struct ZydisPredefinedTokenPREF_BND_
|
||||
{
|
||||
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
ZyanBool ZydisGetCcInfo(ZydisMnemonic mnemonic, ZydisSourceConditionCode *scc)
|
||||
{
|
||||
switch (mnemonic)
|
||||
{
|
||||
case ZYDIS_MNEMONIC_CCMPB:
|
||||
case ZYDIS_MNEMONIC_CTESTB:
|
||||
*scc = ZYDIS_SCC_B;
|
||||
return ZYAN_TRUE;
|
||||
case ZYDIS_MNEMONIC_CCMPBE:
|
||||
case ZYDIS_MNEMONIC_CTESTBE:
|
||||
*scc = ZYDIS_SCC_BE;
|
||||
return ZYAN_TRUE;
|
||||
case ZYDIS_MNEMONIC_CCMPF:
|
||||
case ZYDIS_MNEMONIC_CTESTF:
|
||||
*scc = ZYDIS_SCC_FALSE;
|
||||
return ZYAN_TRUE;
|
||||
case ZYDIS_MNEMONIC_CCMPL:
|
||||
case ZYDIS_MNEMONIC_CTESTL:
|
||||
*scc = ZYDIS_SCC_L;
|
||||
return ZYAN_TRUE;
|
||||
case ZYDIS_MNEMONIC_CCMPLE:
|
||||
case ZYDIS_MNEMONIC_CTESTLE:
|
||||
*scc = ZYDIS_SCC_LE;
|
||||
return ZYAN_TRUE;
|
||||
case ZYDIS_MNEMONIC_CCMPNB:
|
||||
case ZYDIS_MNEMONIC_CTESTNB:
|
||||
*scc = ZYDIS_SCC_NB;
|
||||
return ZYAN_TRUE;
|
||||
case ZYDIS_MNEMONIC_CCMPNBE:
|
||||
case ZYDIS_MNEMONIC_CTESTNBE:
|
||||
*scc = ZYDIS_SCC_NBE;
|
||||
return ZYAN_TRUE;
|
||||
case ZYDIS_MNEMONIC_CCMPNL:
|
||||
case ZYDIS_MNEMONIC_CTESTNL:
|
||||
*scc = ZYDIS_SCC_NL;
|
||||
return ZYAN_TRUE;
|
||||
case ZYDIS_MNEMONIC_CCMPNLE:
|
||||
case ZYDIS_MNEMONIC_CTESTNLE:
|
||||
*scc = ZYDIS_SCC_NLE;
|
||||
return ZYAN_TRUE;
|
||||
case ZYDIS_MNEMONIC_CCMPNO:
|
||||
case ZYDIS_MNEMONIC_CTESTNO:
|
||||
*scc = ZYDIS_SCC_NO;
|
||||
return ZYAN_TRUE;
|
||||
case ZYDIS_MNEMONIC_CCMPNS:
|
||||
case ZYDIS_MNEMONIC_CTESTNS:
|
||||
*scc = ZYDIS_SCC_NS;
|
||||
return ZYAN_TRUE;
|
||||
case ZYDIS_MNEMONIC_CCMPNZ:
|
||||
case ZYDIS_MNEMONIC_CTESTNZ:
|
||||
*scc = ZYDIS_SCC_NZ;
|
||||
return ZYAN_TRUE;
|
||||
case ZYDIS_MNEMONIC_CCMPO:
|
||||
case ZYDIS_MNEMONIC_CTESTO:
|
||||
*scc = ZYDIS_SCC_O;
|
||||
return ZYAN_TRUE;
|
||||
case ZYDIS_MNEMONIC_CCMPS:
|
||||
case ZYDIS_MNEMONIC_CTESTS:
|
||||
*scc = ZYDIS_SCC_S;
|
||||
return ZYAN_TRUE;
|
||||
case ZYDIS_MNEMONIC_CCMPT:
|
||||
case ZYDIS_MNEMONIC_CTESTT:
|
||||
*scc = ZYDIS_SCC_TRUE;
|
||||
return ZYAN_TRUE;
|
||||
case ZYDIS_MNEMONIC_CCMPZ:
|
||||
case ZYDIS_MNEMONIC_CTESTZ:
|
||||
*scc = ZYDIS_SCC_Z;
|
||||
return ZYAN_TRUE;
|
||||
case ZYDIS_MNEMONIC_CFCMOVB:
|
||||
case ZYDIS_MNEMONIC_CFCMOVBE:
|
||||
case ZYDIS_MNEMONIC_CFCMOVL:
|
||||
case ZYDIS_MNEMONIC_CFCMOVLE:
|
||||
case ZYDIS_MNEMONIC_CFCMOVNB:
|
||||
case ZYDIS_MNEMONIC_CFCMOVNBE:
|
||||
case ZYDIS_MNEMONIC_CFCMOVNL:
|
||||
case ZYDIS_MNEMONIC_CFCMOVNLE:
|
||||
case ZYDIS_MNEMONIC_CFCMOVNO:
|
||||
case ZYDIS_MNEMONIC_CFCMOVNP:
|
||||
case ZYDIS_MNEMONIC_CFCMOVNS:
|
||||
case ZYDIS_MNEMONIC_CFCMOVNZ:
|
||||
case ZYDIS_MNEMONIC_CFCMOVO:
|
||||
case ZYDIS_MNEMONIC_CFCMOVP:
|
||||
case ZYDIS_MNEMONIC_CFCMOVS:
|
||||
case ZYDIS_MNEMONIC_CFCMOVZ:
|
||||
case ZYDIS_MNEMONIC_CMOVB:
|
||||
case ZYDIS_MNEMONIC_CMOVBE:
|
||||
case ZYDIS_MNEMONIC_CMOVL:
|
||||
case ZYDIS_MNEMONIC_CMOVLE:
|
||||
case ZYDIS_MNEMONIC_CMOVNB:
|
||||
case ZYDIS_MNEMONIC_CMOVNBE:
|
||||
case ZYDIS_MNEMONIC_CMOVNL:
|
||||
case ZYDIS_MNEMONIC_CMOVNLE:
|
||||
case ZYDIS_MNEMONIC_CMOVNO:
|
||||
case ZYDIS_MNEMONIC_CMOVNP:
|
||||
case ZYDIS_MNEMONIC_CMOVNS:
|
||||
case ZYDIS_MNEMONIC_CMOVNZ:
|
||||
case ZYDIS_MNEMONIC_CMOVO:
|
||||
case ZYDIS_MNEMONIC_CMOVP:
|
||||
case ZYDIS_MNEMONIC_CMOVS:
|
||||
case ZYDIS_MNEMONIC_CMOVZ:
|
||||
*scc = ZYDIS_SCC_NONE;
|
||||
return ZYAN_TRUE;
|
||||
default:
|
||||
*scc = ZYDIS_SCC_NONE;
|
||||
return ZYAN_FALSE;
|
||||
}
|
||||
}
|
||||
-1
@@ -55,4 +55,3 @@ const ZydisEncoderRelInfo *ZydisGetRelInfo(ZydisMnemonic mnemonic)
|
||||
return ZYAN_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9203
-7933
File diff suppressed because it is too large
Load Diff
+22
-21
@@ -1,23 +1,24 @@
|
||||
static const ZydisInstructionEncodingInfo INSTR_ENCODINGS[] =
|
||||
static const ZydisInstructionEncodingInfo INSTR_ENCODINGS[] =
|
||||
{
|
||||
{ 0, { { 0, 0, 0 } }, { { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM, { { 0, 0, 0 } }, { { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_DISP, { { 16, 32, 64 } }, { { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 16, 16 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_TRUE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYAN_TRUE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 64 }, ZYAN_TRUE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_TRUE, ZYAN_TRUE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYAN_TRUE, ZYAN_TRUE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 32, 32, 32 }, ZYAN_TRUE, ZYAN_TRUE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 32, 32, 32 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_TRUE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYAN_TRUE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYAN_TRUE, ZYAN_TRUE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_FORCE_REG_FORM, { { 0, 0, 0 } }, { { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0 | ZYDIS_INSTR_ENC_FLAG_HAS_IMM1, { { 0, 0, 0 } }, { { { 16, 16, 16 }, ZYAN_FALSE, ZYAN_FALSE }, { { 8, 8, 8 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0 | ZYDIS_INSTR_ENC_FLAG_HAS_IMM1, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYAN_FALSE, ZYAN_FALSE }, { { 16, 16, 16 }, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0 | ZYDIS_INSTR_ENC_FLAG_HAS_IMM1, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_FALSE, ZYAN_FALSE }, { { 8, 8, 8 }, ZYAN_FALSE, ZYAN_FALSE } } }
|
||||
{ 0, { { 0, 0, 0 } }, { { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_TRUE, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_TRUE, ZYAN_TRUE, ZYAN_TRUE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 16, 16 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0 | ZYDIS_INSTR_ENC_FLAG_HAS_IMM1, { { 0, 0, 0 } }, { { { 16, 16, 16 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE }, { { 8, 8, 8 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0 | ZYDIS_INSTR_ENC_FLAG_HAS_IMM1, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYAN_FALSE, ZYAN_TRUE, ZYAN_FALSE }, { { 16, 16, 16 }, ZYAN_FALSE, ZYAN_TRUE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYAN_TRUE, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYAN_TRUE, ZYAN_TRUE, ZYAN_TRUE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 64 }, ZYAN_TRUE, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 32, 32, 32 }, ZYAN_TRUE, ZYAN_TRUE, ZYAN_TRUE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 64, 64, 64 }, ZYAN_FALSE, ZYAN_TRUE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_DISP, { { 16, 32, 64 } }, { { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM, { { 0, 0, 0 } }, { { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_FORCE_REG_FORM, { { 0, 0, 0 } }, { { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0 | ZYDIS_INSTR_ENC_FLAG_HAS_IMM1, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE }, { { 8, 8, 8 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 8, 8, 8 }, ZYAN_TRUE, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYAN_TRUE, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 16, 32, 32 }, ZYAN_TRUE, ZYAN_TRUE, ZYAN_TRUE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } },
|
||||
{ ZYDIS_INSTR_ENC_FLAG_HAS_MODRM | ZYDIS_INSTR_ENC_FLAG_HAS_IMM0, { { 0, 0, 0 } }, { { { 32, 32, 32 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE }, { { 0, 0, 0 }, ZYAN_FALSE, ZYAN_FALSE, ZYAN_FALSE } } }
|
||||
};
|
||||
|
||||
+8485
-7948
File diff suppressed because it is too large
Load Diff
+4
-4
@@ -1,10 +1,10 @@
|
||||
static const ZydisRegisterClassLookupItem REG_CLASS_LOOKUP[] =
|
||||
{
|
||||
/* INVALID */ { ZYDIS_REGISTER_NONE, ZYDIS_REGISTER_NONE, 0, 0 },
|
||||
/* GPR8 */ { ZYDIS_REGISTER_AL, ZYDIS_REGISTER_R15B, 8, 8 },
|
||||
/* GPR16 */ { ZYDIS_REGISTER_AX, ZYDIS_REGISTER_R15W, 16, 16 },
|
||||
/* GPR32 */ { ZYDIS_REGISTER_EAX, ZYDIS_REGISTER_R15D, 32, 32 },
|
||||
/* GPR64 */ { ZYDIS_REGISTER_RAX, ZYDIS_REGISTER_R15, 0, 64 },
|
||||
/* GPR8 */ { ZYDIS_REGISTER_AL, ZYDIS_REGISTER_R31B, 8, 8 },
|
||||
/* GPR16 */ { ZYDIS_REGISTER_AX, ZYDIS_REGISTER_R31W, 16, 16 },
|
||||
/* GPR32 */ { ZYDIS_REGISTER_EAX, ZYDIS_REGISTER_R31D, 32, 32 },
|
||||
/* GPR64 */ { ZYDIS_REGISTER_RAX, ZYDIS_REGISTER_R31, 0, 64 },
|
||||
/* X87 */ { ZYDIS_REGISTER_ST0, ZYDIS_REGISTER_ST7, 80, 80 },
|
||||
/* MMX */ { ZYDIS_REGISTER_MM0, ZYDIS_REGISTER_MM7, 64, 64 },
|
||||
/* XMM */ { ZYDIS_REGISTER_XMM0, ZYDIS_REGISTER_XMM31, 128, 128 },
|
||||
|
||||
+66
-1
@@ -21,6 +21,22 @@ static const ZydisRegisterLookupItem REG_LOOKUP[] =
|
||||
/* R13B */ { ZYDIS_REGCLASS_GPR8, 17, 8, 8 },
|
||||
/* R14B */ { ZYDIS_REGCLASS_GPR8, 18, 8, 8 },
|
||||
/* R15B */ { ZYDIS_REGCLASS_GPR8, 19, 8, 8 },
|
||||
/* R16B */ { ZYDIS_REGCLASS_GPR8, 20, 8, 8 },
|
||||
/* R17B */ { ZYDIS_REGCLASS_GPR8, 21, 8, 8 },
|
||||
/* R18B */ { ZYDIS_REGCLASS_GPR8, 22, 8, 8 },
|
||||
/* R19B */ { ZYDIS_REGCLASS_GPR8, 23, 8, 8 },
|
||||
/* R20B */ { ZYDIS_REGCLASS_GPR8, 24, 8, 8 },
|
||||
/* R21B */ { ZYDIS_REGCLASS_GPR8, 25, 8, 8 },
|
||||
/* R22B */ { ZYDIS_REGCLASS_GPR8, 26, 8, 8 },
|
||||
/* R23B */ { ZYDIS_REGCLASS_GPR8, 27, 8, 8 },
|
||||
/* R24B */ { ZYDIS_REGCLASS_GPR8, 28, 8, 8 },
|
||||
/* R25B */ { ZYDIS_REGCLASS_GPR8, 29, 8, 8 },
|
||||
/* R26B */ { ZYDIS_REGCLASS_GPR8, 30, 8, 8 },
|
||||
/* R27B */ { ZYDIS_REGCLASS_GPR8, 31, 8, 8 },
|
||||
/* R28B */ { ZYDIS_REGCLASS_GPR8, 32, 8, 8 },
|
||||
/* R29B */ { ZYDIS_REGCLASS_GPR8, 33, 8, 8 },
|
||||
/* R30B */ { ZYDIS_REGCLASS_GPR8, 34, 8, 8 },
|
||||
/* R31B */ { ZYDIS_REGCLASS_GPR8, 35, 8, 8 },
|
||||
/* AX */ { ZYDIS_REGCLASS_GPR16, 0, 16, 16 },
|
||||
/* CX */ { ZYDIS_REGCLASS_GPR16, 1, 16, 16 },
|
||||
/* DX */ { ZYDIS_REGCLASS_GPR16, 2, 16, 16 },
|
||||
@@ -37,6 +53,22 @@ static const ZydisRegisterLookupItem REG_LOOKUP[] =
|
||||
/* R13W */ { ZYDIS_REGCLASS_GPR16, 13, 16, 16 },
|
||||
/* R14W */ { ZYDIS_REGCLASS_GPR16, 14, 16, 16 },
|
||||
/* R15W */ { ZYDIS_REGCLASS_GPR16, 15, 16, 16 },
|
||||
/* R16W */ { ZYDIS_REGCLASS_GPR16, 16, 16, 16 },
|
||||
/* R17W */ { ZYDIS_REGCLASS_GPR16, 17, 16, 16 },
|
||||
/* R18W */ { ZYDIS_REGCLASS_GPR16, 18, 16, 16 },
|
||||
/* R19W */ { ZYDIS_REGCLASS_GPR16, 19, 16, 16 },
|
||||
/* R20W */ { ZYDIS_REGCLASS_GPR16, 20, 16, 16 },
|
||||
/* R21W */ { ZYDIS_REGCLASS_GPR16, 21, 16, 16 },
|
||||
/* R22W */ { ZYDIS_REGCLASS_GPR16, 22, 16, 16 },
|
||||
/* R23W */ { ZYDIS_REGCLASS_GPR16, 23, 16, 16 },
|
||||
/* R24W */ { ZYDIS_REGCLASS_GPR16, 24, 16, 16 },
|
||||
/* R25W */ { ZYDIS_REGCLASS_GPR16, 25, 16, 16 },
|
||||
/* R26W */ { ZYDIS_REGCLASS_GPR16, 26, 16, 16 },
|
||||
/* R27W */ { ZYDIS_REGCLASS_GPR16, 27, 16, 16 },
|
||||
/* R28W */ { ZYDIS_REGCLASS_GPR16, 28, 16, 16 },
|
||||
/* R29W */ { ZYDIS_REGCLASS_GPR16, 29, 16, 16 },
|
||||
/* R30W */ { ZYDIS_REGCLASS_GPR16, 30, 16, 16 },
|
||||
/* R31W */ { ZYDIS_REGCLASS_GPR16, 31, 16, 16 },
|
||||
/* EAX */ { ZYDIS_REGCLASS_GPR32, 0, 32, 32 },
|
||||
/* ECX */ { ZYDIS_REGCLASS_GPR32, 1, 32, 32 },
|
||||
/* EDX */ { ZYDIS_REGCLASS_GPR32, 2, 32, 32 },
|
||||
@@ -53,6 +85,22 @@ static const ZydisRegisterLookupItem REG_LOOKUP[] =
|
||||
/* R13D */ { ZYDIS_REGCLASS_GPR32, 13, 32, 32 },
|
||||
/* R14D */ { ZYDIS_REGCLASS_GPR32, 14, 32, 32 },
|
||||
/* R15D */ { ZYDIS_REGCLASS_GPR32, 15, 32, 32 },
|
||||
/* R16D */ { ZYDIS_REGCLASS_GPR32, 16, 32, 32 },
|
||||
/* R17D */ { ZYDIS_REGCLASS_GPR32, 17, 32, 32 },
|
||||
/* R18D */ { ZYDIS_REGCLASS_GPR32, 18, 32, 32 },
|
||||
/* R19D */ { ZYDIS_REGCLASS_GPR32, 19, 32, 32 },
|
||||
/* R20D */ { ZYDIS_REGCLASS_GPR32, 20, 32, 32 },
|
||||
/* R21D */ { ZYDIS_REGCLASS_GPR32, 21, 32, 32 },
|
||||
/* R22D */ { ZYDIS_REGCLASS_GPR32, 22, 32, 32 },
|
||||
/* R23D */ { ZYDIS_REGCLASS_GPR32, 23, 32, 32 },
|
||||
/* R24D */ { ZYDIS_REGCLASS_GPR32, 24, 32, 32 },
|
||||
/* R25D */ { ZYDIS_REGCLASS_GPR32, 25, 32, 32 },
|
||||
/* R26D */ { ZYDIS_REGCLASS_GPR32, 26, 32, 32 },
|
||||
/* R27D */ { ZYDIS_REGCLASS_GPR32, 27, 32, 32 },
|
||||
/* R28D */ { ZYDIS_REGCLASS_GPR32, 28, 32, 32 },
|
||||
/* R29D */ { ZYDIS_REGCLASS_GPR32, 29, 32, 32 },
|
||||
/* R30D */ { ZYDIS_REGCLASS_GPR32, 30, 32, 32 },
|
||||
/* R31D */ { ZYDIS_REGCLASS_GPR32, 31, 32, 32 },
|
||||
/* RAX */ { ZYDIS_REGCLASS_GPR64, 0, 0, 64 },
|
||||
/* RCX */ { ZYDIS_REGCLASS_GPR64, 1, 0, 64 },
|
||||
/* RDX */ { ZYDIS_REGCLASS_GPR64, 2, 0, 64 },
|
||||
@@ -69,6 +117,22 @@ static const ZydisRegisterLookupItem REG_LOOKUP[] =
|
||||
/* R13 */ { ZYDIS_REGCLASS_GPR64, 13, 0, 64 },
|
||||
/* R14 */ { ZYDIS_REGCLASS_GPR64, 14, 0, 64 },
|
||||
/* R15 */ { ZYDIS_REGCLASS_GPR64, 15, 0, 64 },
|
||||
/* R16 */ { ZYDIS_REGCLASS_GPR64, 16, 0, 64 },
|
||||
/* R17 */ { ZYDIS_REGCLASS_GPR64, 17, 0, 64 },
|
||||
/* R18 */ { ZYDIS_REGCLASS_GPR64, 18, 0, 64 },
|
||||
/* R19 */ { ZYDIS_REGCLASS_GPR64, 19, 0, 64 },
|
||||
/* R20 */ { ZYDIS_REGCLASS_GPR64, 20, 0, 64 },
|
||||
/* R21 */ { ZYDIS_REGCLASS_GPR64, 21, 0, 64 },
|
||||
/* R22 */ { ZYDIS_REGCLASS_GPR64, 22, 0, 64 },
|
||||
/* R23 */ { ZYDIS_REGCLASS_GPR64, 23, 0, 64 },
|
||||
/* R24 */ { ZYDIS_REGCLASS_GPR64, 24, 0, 64 },
|
||||
/* R25 */ { ZYDIS_REGCLASS_GPR64, 25, 0, 64 },
|
||||
/* R26 */ { ZYDIS_REGCLASS_GPR64, 26, 0, 64 },
|
||||
/* R27 */ { ZYDIS_REGCLASS_GPR64, 27, 0, 64 },
|
||||
/* R28 */ { ZYDIS_REGCLASS_GPR64, 28, 0, 64 },
|
||||
/* R29 */ { ZYDIS_REGCLASS_GPR64, 29, 0, 64 },
|
||||
/* R30 */ { ZYDIS_REGCLASS_GPR64, 30, 0, 64 },
|
||||
/* R31 */ { ZYDIS_REGCLASS_GPR64, 31, 0, 64 },
|
||||
/* ST0 */ { ZYDIS_REGCLASS_X87, 0, 80, 80 },
|
||||
/* ST1 */ { ZYDIS_REGCLASS_X87, 1, 80, 80 },
|
||||
/* ST2 */ { ZYDIS_REGCLASS_X87, 2, 80, 80 },
|
||||
@@ -265,5 +329,6 @@ static const ZydisRegisterLookupItem REG_LOOKUP[] =
|
||||
/* MXCSR */ { ZYDIS_REGCLASS_INVALID, -1, 32, 32 },
|
||||
/* PKRU */ { ZYDIS_REGCLASS_INVALID, -1, 32, 32 },
|
||||
/* XCR0 */ { ZYDIS_REGCLASS_INVALID, -1, 64, 64 },
|
||||
/* UIF */ { ZYDIS_REGCLASS_INVALID, -1, 1, 1 }
|
||||
/* UIF */ { ZYDIS_REGCLASS_INVALID, -1, 1, 1 },
|
||||
/* IA32_KERNEL_GS_BASE */ { ZYDIS_REGCLASS_INVALID, -1, 0, 0 }
|
||||
};
|
||||
|
||||
+21
-3
@@ -175,7 +175,7 @@ ZydisRegister ZydisRegisterGetLargestEnclosing(ZydisMachineMode mode, ZydisRegis
|
||||
[ZYDIS_REGCLASS_FLAGS] = { ZYDIS_REGISTER_FLAGS, ZYDIS_REGISTER_EFLAGS, ZYDIS_REGISTER_RFLAGS },
|
||||
[ZYDIS_REGCLASS_IP ] = { ZYDIS_REGISTER_IP , ZYDIS_REGISTER_EIP , ZYDIS_REGISTER_RIP },
|
||||
};
|
||||
ZYAN_ASSERT(reg_class < ZYAN_ARRAY_LENGTH(STATIC_MAPPING));
|
||||
ZYAN_ASSERT((ZyanUSize)reg_class < ZYAN_ARRAY_LENGTH(STATIC_MAPPING));
|
||||
|
||||
ZyanU8 mode_bits;
|
||||
switch (mode)
|
||||
@@ -202,7 +202,7 @@ ZydisRegister ZydisRegisterGetLargestEnclosing(ZydisMachineMode mode, ZydisRegis
|
||||
return static_reg;
|
||||
}
|
||||
|
||||
static const ZyanU8 GPR8_MAPPING[20] =
|
||||
static const ZyanU8 GPR8_MAPPING[36] =
|
||||
{
|
||||
/* AL */ 0,
|
||||
/* CL */ 1,
|
||||
@@ -223,13 +223,31 @@ ZydisRegister ZydisRegisterGetLargestEnclosing(ZydisMachineMode mode, ZydisRegis
|
||||
/* R12B */ 12,
|
||||
/* R13B */ 13,
|
||||
/* R14B */ 14,
|
||||
/* R15B */ 15
|
||||
/* R15B */ 15,
|
||||
/* APX */
|
||||
/* R16B */ 16,
|
||||
/* R17B */ 17,
|
||||
/* R18B */ 18,
|
||||
/* R19B */ 19,
|
||||
/* R20B */ 20,
|
||||
/* R21B */ 21,
|
||||
/* R22B */ 22,
|
||||
/* R23B */ 23,
|
||||
/* R24B */ 24,
|
||||
/* R25B */ 25,
|
||||
/* R26B */ 26,
|
||||
/* R27B */ 27,
|
||||
/* R28B */ 28,
|
||||
/* R29B */ 29,
|
||||
/* R30B */ 30,
|
||||
/* R31B */ 31
|
||||
};
|
||||
|
||||
ZyanU8 reg_id = REG_LOOKUP[reg].id;
|
||||
switch (reg_class)
|
||||
{
|
||||
case ZYDIS_REGCLASS_GPR8:
|
||||
ZYAN_ASSERT(reg_id < ZYAN_ARRAY_LENGTH(GPR8_MAPPING));
|
||||
reg_id = GPR8_MAPPING[reg_id];
|
||||
ZYAN_FALLTHROUGH;
|
||||
case ZYDIS_REGCLASS_GPR16:
|
||||
|
||||
+5
@@ -87,6 +87,11 @@ ZyanStatus ZydisGetInstructionSegments(const ZydisDecodedInstruction* instructio
|
||||
segment_offset = instruction->raw.mvex.offset;
|
||||
segment_size = 4;
|
||||
break;
|
||||
case ZYDIS_INSTRUCTION_ENCODING_REX2:
|
||||
segment_type = ZYDIS_INSTR_SEGMENT_REX2;
|
||||
segment_offset = instruction->raw.rex2.offset;
|
||||
segment_size = 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
+16
-4
@@ -77,6 +77,7 @@ void ZydisGetInstructionDefinition(ZydisInstructionEncoding encoding, ZyanU16 id
|
||||
switch (encoding)
|
||||
{
|
||||
case ZYDIS_INSTRUCTION_ENCODING_LEGACY:
|
||||
case ZYDIS_INSTRUCTION_ENCODING_REX2:
|
||||
*definition = (ZydisInstructionDefinition*)&ISTR_DEFINITIONS_LEGACY[id];
|
||||
break;
|
||||
case ZYDIS_INSTRUCTION_ENCODING_3DNOW:
|
||||
@@ -115,9 +116,19 @@ const ZydisOperandDefinition* ZydisGetOperandDefinitions(
|
||||
{
|
||||
return ZYAN_NULL;
|
||||
}
|
||||
ZYAN_ASSERT(definition->operand_reference != 0xFFFF);
|
||||
ZYAN_ASSERT(definition->operand_reference != 0x7FFF);
|
||||
return &OPERAND_DEFINITIONS[definition->operand_reference];
|
||||
}
|
||||
|
||||
const ZyanU16 *ZydisGetOperandSizes(const ZydisOperandDefinition *definition)
|
||||
{
|
||||
return OPERAND_SIZES[definition->size_reference];
|
||||
}
|
||||
|
||||
const ZydisOperandDetails *ZydisGetOperandDetails(const ZydisOperandDefinition *definition)
|
||||
{
|
||||
return &OPERAND_DETAILS[definition->details_reference];
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
@@ -132,7 +143,7 @@ void ZydisGetElementInfo(ZydisInternalElementType element, ZydisElementType* typ
|
||||
{
|
||||
ZydisElementType type;
|
||||
ZydisElementSize size;
|
||||
} lookup[ZYDIS_IELEMENT_TYPE_MAX_VALUE + 1] =
|
||||
} lookup[] =
|
||||
{
|
||||
{ ZYDIS_ELEMENT_TYPE_INVALID , 0 },
|
||||
{ ZYDIS_ELEMENT_TYPE_INVALID , 0 },
|
||||
@@ -146,6 +157,7 @@ void ZydisGetElementInfo(ZydisInternalElementType element, ZydisElementType* typ
|
||||
{ ZYDIS_ELEMENT_TYPE_INT , 32 }, // TODO: Should indicate 2 INT16 elements
|
||||
{ ZYDIS_ELEMENT_TYPE_INT , 32 },
|
||||
{ ZYDIS_ELEMENT_TYPE_INT , 64 },
|
||||
{ ZYDIS_ELEMENT_TYPE_INT , 128 },
|
||||
{ ZYDIS_ELEMENT_TYPE_UINT , 8 },
|
||||
{ ZYDIS_ELEMENT_TYPE_UINT , 32 }, // TODO: Should indicate 4 UINT8 elements
|
||||
{ ZYDIS_ELEMENT_TYPE_UINT , 16 },
|
||||
@@ -158,13 +170,13 @@ void ZydisGetElementInfo(ZydisInternalElementType element, ZydisElementType* typ
|
||||
{ ZYDIS_ELEMENT_TYPE_FLOAT16 , 32 }, // TODO: Should indicate 2 FLOAT16 elements
|
||||
{ ZYDIS_ELEMENT_TYPE_FLOAT32 , 32 },
|
||||
{ ZYDIS_ELEMENT_TYPE_FLOAT64 , 64 },
|
||||
{ ZYDIS_ELEMENT_TYPE_BFLOAT16 , 32 }, // TODO: Should indicate 2 BFLOAT16 elements
|
||||
{ ZYDIS_ELEMENT_TYPE_FLOAT80 , 80 },
|
||||
{ ZYDIS_ELEMENT_TYPE_BFLOAT16 , 32 }, // TODO: Should indicate 2 BFLOAT16 elements
|
||||
{ ZYDIS_ELEMENT_TYPE_LONGBCD , 80 },
|
||||
{ ZYDIS_ELEMENT_TYPE_CC , 3 },
|
||||
{ ZYDIS_ELEMENT_TYPE_CC , 5 }
|
||||
};
|
||||
|
||||
ZYAN_STATIC_ASSERT(ZYAN_ARRAY_LENGTH(lookup) == ZYDIS_IELEMENT_TYPE_MAX_VALUE + 1);
|
||||
ZYAN_ASSERT((ZyanUSize)element < ZYAN_ARRAY_LENGTH(lookup));
|
||||
|
||||
*type = lookup[element].type;
|
||||
|
||||
+4
-4
@@ -65,7 +65,7 @@ static const char* const DECIMAL_LOOKUP =
|
||||
/* Decimal */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#if defined(ZYAN_X86) || defined(ZYAN_ARM) || defined(ZYAN_EMSCRIPTEN) || defined(ZYAN_WASM) || defined(ZYAN_PPC)
|
||||
#if ZYAN_ARCHITECTURE_WIDTH != 64
|
||||
static ZyanStatus ZydisStringAppendDecU32(ZyanString* string, ZyanU32 value, ZyanU8 padding_length)
|
||||
{
|
||||
ZYAN_ASSERT(string);
|
||||
@@ -157,7 +157,7 @@ static ZyanStatus ZydisStringAppendDecU64(ZyanString* string, ZyanU64 value, Zya
|
||||
/* Hexadecimal */
|
||||
/* ---------------------------------------------------------------------------------------------- */
|
||||
|
||||
#if defined(ZYAN_X86) || defined(ZYAN_ARM) || defined(ZYAN_EMSCRIPTEN) || defined(ZYAN_WASM) || defined(ZYAN_PPC)
|
||||
#if ZYAN_ARCHITECTURE_WIDTH != 64
|
||||
static ZyanStatus ZydisStringAppendHexU32(ZyanString* string, ZyanU32 value, ZyanU8 padding_length,
|
||||
ZyanBool force_leading_number, ZyanBool uppercase)
|
||||
{
|
||||
@@ -322,7 +322,7 @@ ZyanStatus ZydisStringAppendDecU(ZyanString* string, ZyanU64 value, ZyanU8 paddi
|
||||
ZYAN_CHECK(ZydisStringAppend(string, prefix));
|
||||
}
|
||||
|
||||
#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64) || defined(ZYAN_RISCV64) || defined(ZYAN_LOONGARCH)
|
||||
#if ZYAN_ARCHITECTURE_WIDTH == 64
|
||||
ZYAN_CHECK(ZydisStringAppendDecU64(string, value, padding_length));
|
||||
#else
|
||||
if (value & 0xFFFFFFFF00000000)
|
||||
@@ -348,7 +348,7 @@ ZyanStatus ZydisStringAppendHexU(ZyanString* string, ZyanU64 value, ZyanU8 paddi
|
||||
ZYAN_CHECK(ZydisStringAppend(string, prefix));
|
||||
}
|
||||
|
||||
#if defined(ZYAN_X64) || defined(ZYAN_AARCH64) || defined(ZYAN_PPC64) || defined(ZYAN_RISCV64) || defined(ZYAN_LOONGARCH)
|
||||
#if ZYAN_ARCHITECTURE_WIDTH == 64
|
||||
ZYAN_CHECK(ZydisStringAppendHexU64(string, value, padding_length, force_leading_number,
|
||||
uppercase));
|
||||
#else
|
||||
|
||||
+32
-8
@@ -49,7 +49,7 @@ ZyanStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
|
||||
switch (operand->type)
|
||||
{
|
||||
case ZYDIS_OPERAND_TYPE_MEMORY:
|
||||
if (!operand->mem.disp.has_displacement)
|
||||
if (!operand->mem.disp.size)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
@@ -85,6 +85,11 @@ ZyanStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
|
||||
}
|
||||
break;
|
||||
case ZYDIS_OPERAND_TYPE_IMMEDIATE:
|
||||
if (!operand->imm.is_address)
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (operand->imm.is_signed && operand->imm.is_relative)
|
||||
{
|
||||
*result_address = (ZyanU64)((ZyanI64)runtime_address + instruction->length +
|
||||
@@ -113,6 +118,12 @@ ZyanStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
|
||||
}
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
else if (!operand->imm.is_signed && !operand->imm.is_relative &&
|
||||
(instruction->machine_mode == ZYDIS_MACHINE_MODE_LONG_64))
|
||||
{
|
||||
*result_address = operand->imm.value.u;
|
||||
return ZYAN_STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -133,23 +144,36 @@ ZyanStatus ZydisCalcAbsoluteAddressEx(const ZydisDecodedInstruction* instruction
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if ((operand->type != ZYDIS_OPERAND_TYPE_MEMORY) ||
|
||||
if ((operand->type != ZYDIS_OPERAND_TYPE_REGISTER) &&
|
||||
((operand->type != ZYDIS_OPERAND_TYPE_MEMORY) ||
|
||||
((operand->mem.base == ZYDIS_REGISTER_NONE) &&
|
||||
(operand->mem.index == ZYDIS_REGISTER_NONE)) ||
|
||||
(operand->mem.base == ZYDIS_REGISTER_EIP) ||
|
||||
(operand->mem.base == ZYDIS_REGISTER_RIP))
|
||||
(operand->mem.base == ZYDIS_REGISTER_RIP)))
|
||||
{
|
||||
return ZydisCalcAbsoluteAddress(instruction, operand, runtime_address, result_address);
|
||||
}
|
||||
|
||||
ZyanU64 value = operand->mem.disp.value;
|
||||
if (operand->mem.base)
|
||||
ZyanU64 value;
|
||||
if (operand->type == ZYDIS_OPERAND_TYPE_REGISTER)
|
||||
{
|
||||
value += register_context->values[operand->mem.base];
|
||||
value = register_context->values[operand->reg.value];
|
||||
}
|
||||
if (operand->mem.index)
|
||||
else if (operand->type == ZYDIS_OPERAND_TYPE_MEMORY)
|
||||
{
|
||||
value += register_context->values[operand->mem.index] * operand->mem.scale;
|
||||
value = operand->mem.disp.value;
|
||||
if (operand->mem.base)
|
||||
{
|
||||
value += register_context->values[operand->mem.base];
|
||||
}
|
||||
if (operand->mem.index)
|
||||
{
|
||||
value += register_context->values[operand->mem.index] * operand->mem.scale;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return ZYAN_STATUS_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
switch (instruction->address_width)
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
[wrap-git]
|
||||
# This is a fallback for plain clone (no submodules available).
|
||||
url = https://github.com/zyantific/zycore-c.git
|
||||
# Sync revision to `git submodule status zycore`.
|
||||
# If doing a release for Zydis, sync both to a tagged commit.
|
||||
revision = 7ad36e52110b39cfb62b47bfdb6def94ac531309
|
||||
depth = 1
|
||||
|
||||
[provide]
|
||||
dependency_names = zycore
|
||||
+1
-1
@@ -1 +1 @@
|
||||
-64 3eff10
|
||||
-64 3eff10
|
||||
+1
-1
@@ -1 +1 @@
|
||||
-64 3e2eff10
|
||||
-64 3e2eff10
|
||||
+1
-1
@@ -1 +1 @@
|
||||
-64 2e3eff10
|
||||
-64 2e3eff10
|
||||
+1
-1
@@ -1 +1 @@
|
||||
-32 3eff10
|
||||
-32 3eff10
|
||||
+1
-1
@@ -1 +1 @@
|
||||
-32 3e2eff10
|
||||
-32 3e2eff10
|
||||
+1
-1
@@ -1 +1 @@
|
||||
-32 2e3eff10
|
||||
-32 2e3eff10
|
||||
+1
@@ -0,0 +1 @@
|
||||
-64 67418A0C25D8E98800
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
== [ BASIC ] ============================================================================================
|
||||
MNEMONIC: mov [ENC: DEFAULT, MAP: DEFAULT, OPC: 0x8A]
|
||||
LENGTH: 9
|
||||
SSZ: 64
|
||||
EOSZ: 8
|
||||
EASZ: 32
|
||||
CATEGORY: DATAXFER
|
||||
ISA-SET: I86
|
||||
ISA-EXT: BASE
|
||||
EXCEPTIONS: NONE
|
||||
ATTRIBUTES: HAS_MODRM HAS_SIB HAS_REX ACCEPTS_SEGMENT HAS_ADDRESSSIZE
|
||||
OPTIMIZED: 8A 0C 25 D8 E9 88 00
|
||||
|
||||
== [ OPERANDS ] ============================================================================================
|
||||
## TYPE VISIBILITY ACTION ENCODING SIZE NELEM ELEMSZ ELEMTYPE VALUE
|
||||
-- --------- ---------- ------ ------------ ---- ----- ------ -------- ---------------------------
|
||||
0 REGISTER EXPLICIT W MODRM_REG 8 1 8 INT cl
|
||||
1 MEMORY EXPLICIT R MODRM_RM 8 1 8 INT TYPE = MEM
|
||||
SEG = ds
|
||||
BASE = none
|
||||
INDEX = none
|
||||
SCALE = 0
|
||||
DISP = 0x000000000088E9D8
|
||||
-- --------- ---------- ------ ------------ ---- ----- ------ -------- ---------------------------
|
||||
|
||||
== [ ATT ] ============================================================================================
|
||||
ABSOLUTE: mov 0x0088E9D8, %cl
|
||||
RELATIVE: mov 0x0088E9D8, %cl
|
||||
|
||||
== [ INTEL ] ============================================================================================
|
||||
ABSOLUTE: mov cl, byte ptr ds:[0x0088E9D8]
|
||||
RELATIVE: mov cl, byte ptr ds:[0x0088E9D8]
|
||||
|
||||
== [ SEGMENTS ] ============================================================================================
|
||||
67 41 8A 0C 25 D8 E9 88 00
|
||||
: : : : : :..DISP
|
||||
: : : : :..SIB
|
||||
: : : :..MODRM
|
||||
: : :..OPCODE
|
||||
: :..REX
|
||||
:..PREFIXES
|
||||
+1
@@ -0,0 +1 @@
|
||||
-64 67450FAC3CC50000E94110
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
== [ BASIC ] ============================================================================================
|
||||
MNEMONIC: shrd [ENC: DEFAULT, MAP: 0F, OPC: 0xAC]
|
||||
LENGTH: 11
|
||||
SSZ: 64
|
||||
EOSZ: 32
|
||||
EASZ: 32
|
||||
CATEGORY: SHIFT
|
||||
ISA-SET: I386
|
||||
ISA-EXT: BASE
|
||||
EXCEPTIONS: NONE
|
||||
ATTRIBUTES: HAS_MODRM HAS_SIB HAS_REX CPUFLAG_ACCESS ACCEPTS_SEGMENT HAS_ADDRESSSIZE
|
||||
OPTIMIZED: 67 44 0F AC 3C C5 00 00 E9 41 10
|
||||
|
||||
== [ OPERANDS ] ============================================================================================
|
||||
## TYPE VISIBILITY ACTION ENCODING SIZE NELEM ELEMSZ ELEMTYPE VALUE
|
||||
-- --------- ---------- ------ ------------ ---- ----- ------ -------- ---------------------------
|
||||
0 MEMORY EXPLICIT RCW MODRM_RM 32 1 32 UINT TYPE = MEM
|
||||
SEG = ds
|
||||
BASE = none
|
||||
INDEX = eax
|
||||
SCALE = 8
|
||||
DISP = 0x0000000041E90000
|
||||
1 REGISTER EXPLICIT R MODRM_REG 32 1 32 UINT r15d
|
||||
2 IMMEDIATE EXPLICIT R UIMM8 8 1 8 UINT [U A 8] 0x0000000000000010
|
||||
3 REGISTER HIDDEN W NONE 64 64 1 INT rflags
|
||||
-- --------- ---------- ------ ------------ ---- ----- ------ -------- ---------------------------
|
||||
|
||||
== [ FLAGS ] ============================================================================================
|
||||
ACTIONS: [CF : M ] [PF : M ] [AF : U ] [ZF : M ] [SF : M ] [OF : U ]
|
||||
READ: 0x00000000
|
||||
WRITTEN: 0x000008D5
|
||||
|
||||
== [ ATT ] ============================================================================================
|
||||
ABSOLUTE: shrd $0x10, %r15d, 0x41E90000(,%eax,8)
|
||||
RELATIVE: shrd $0x10, %r15d, 0x41E90000(,%eax,8)
|
||||
|
||||
== [ INTEL ] ============================================================================================
|
||||
ABSOLUTE: shrd dword ptr ds:[eax*8+0x41E90000], r15d, 0x10
|
||||
RELATIVE: shrd dword ptr ds:[eax*8+0x41E90000], r15d, 0x10
|
||||
|
||||
== [ SEGMENTS ] ============================================================================================
|
||||
67 45 0F AC 3C C5 00 00 E9 41 10
|
||||
: : : : : : :..IMM
|
||||
: : : : : :..DISP
|
||||
: : : : :..SIB
|
||||
: : : :..MODRM
|
||||
: : :..OPCODE
|
||||
: :..REX
|
||||
:..PREFIXES
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user