mirror of
https://github.com/hedge-dev/XenonRecomp.git
synced 2025-07-22 04:47:13 +00:00
Initial Commit
This commit is contained in:
399
.gitignore
vendored
Normal file
399
.gitignore
vendored
Normal file
@@ -0,0 +1,399 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
[Oo]ut/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.tlog
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
|
||||
*.vbp
|
||||
|
||||
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
||||
*.dsw
|
||||
*.dsp
|
||||
|
||||
# Visual Studio 6 technical files
|
||||
*.ncb
|
||||
*.aps
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# Visual Studio History (VSHistory) files
|
||||
.vshistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
|
||||
# VS Code files for those working on multiple tools
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Windows Installer files from build outputs
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
20
CMakeLists.txt
Normal file
20
CMakeLists.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
cmake_minimum_required (VERSION 3.20)
|
||||
set(THIRDPARTY_ROOT ${CMAKE_SOURCE_DIR}/thirdparty)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
# Enable Hot Reload for MSVC compilers if supported.
|
||||
if (POLICY CMP0141)
|
||||
cmake_policy(SET CMP0141 NEW)
|
||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
|
||||
endif()
|
||||
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
|
||||
add_subdirectory(${THIRDPARTY_ROOT}/capstone)
|
||||
include_directories(${THIRDPARTY_ROOT}/capstone/include)
|
||||
|
||||
project ("PowerRecomp-ALL")
|
||||
|
||||
add_subdirectory(PowerAnalyse)
|
||||
add_subdirectory(PowerRecomp)
|
||||
add_subdirectory(PowerUtils)
|
61
CMakePresets.json
Normal file
61
CMakePresets.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"version": 3,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "windows-base",
|
||||
"hidden": true,
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/out/build/${presetName}",
|
||||
"installDir": "${sourceDir}/out/install/${presetName}",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "cl.exe",
|
||||
"CMAKE_CXX_COMPILER": "cl.exe"
|
||||
},
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x64-debug",
|
||||
"displayName": "x64 Debug",
|
||||
"inherits": "windows-base",
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x64-release",
|
||||
"displayName": "x64 Release",
|
||||
"inherits": "x64-debug",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x86-debug",
|
||||
"displayName": "x86 Debug",
|
||||
"inherits": "windows-base",
|
||||
"architecture": {
|
||||
"value": "x86",
|
||||
"strategy": "external"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x86-release",
|
||||
"displayName": "x86 Release",
|
||||
"inherits": "x86-debug",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
6
PowerAnalyse/CMakeLists.txt
Normal file
6
PowerAnalyse/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
# cmake_minimum_required (VERSION 3.16)
|
||||
|
||||
project("PowerAnalyse")
|
||||
|
||||
add_executable(PowerAnalyse "main.cpp")
|
||||
target_link_libraries(PowerAnalyse PRIVATE PowerUtils)
|
41
PowerAnalyse/main.cpp
Normal file
41
PowerAnalyse/main.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include <windows.h>
|
||||
#include <xex.h>
|
||||
#include <file.h>
|
||||
#include <disasm.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
// TODO: ELFs, symbols, sections, a lot
|
||||
const auto file = LoadFile("default.xex");
|
||||
const auto image = Xex2LoadImage(file.data());
|
||||
|
||||
auto* headers = (IMAGE_NT_HEADERS32*)(image.get() + ((IMAGE_DOS_HEADER*)image.get())->e_lfanew);
|
||||
auto numSections = headers->FileHeader.NumberOfSections;
|
||||
auto* sections = (IMAGE_SECTION_HEADER*)(headers + 1);
|
||||
auto base = headers->OptionalHeader.ImageBase;
|
||||
|
||||
for (size_t i = 0; i < numSections; i++)
|
||||
{
|
||||
const auto& section = sections[i];
|
||||
std::printf("Section %.8s\n", reinterpret_cast<const char*>(section.Name));
|
||||
std::printf("\t%X-%X\n", base + section.VirtualAddress, base + section.VirtualAddress + section.Misc.VirtualSize);
|
||||
|
||||
auto* data = image.get() + section.VirtualAddress; // XEX is weird
|
||||
ppc::SetDetail(true);
|
||||
|
||||
if (section.Characteristics & IMAGE_SCN_CNT_CODE)
|
||||
{
|
||||
cs_insn* instructions;
|
||||
size_t n = ppc::Disassemble(data, section.SizeOfRawData, base + section.VirtualAddress, 0, &instructions);
|
||||
|
||||
for(size_t i = 0; i < n; i++)
|
||||
{
|
||||
printf("\t%s\n", instructions[i].mnemonic);
|
||||
}
|
||||
|
||||
cs_free(instructions, n);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
6
PowerRecomp/CMakeLists.txt
Normal file
6
PowerRecomp/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
cmake_minimum_required (VERSION 3.8)
|
||||
|
||||
project("PowerRecomp")
|
||||
add_executable(PowerRecomp "main.cpp")
|
||||
|
||||
set_property(TARGET PowerRecomp PROPERTY CXX_STANDARD 20)
|
4
PowerRecomp/main.cpp
Normal file
4
PowerRecomp/main.cpp
Normal file
@@ -0,0 +1,4 @@
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
5
PowerUtils/CMakeLists.txt
Normal file
5
PowerUtils/CMakeLists.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
project("PowerUtils")
|
||||
add_library(PowerUtils "disasm.h" "disasm.cpp" "file.h" "xex.cpp")
|
||||
|
||||
target_include_directories(PowerUtils PUBLIC .)
|
||||
target_link_libraries(PowerUtils PUBLIC capstone)
|
23
PowerUtils/disasm.cpp
Normal file
23
PowerUtils/disasm.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "disasm.h"
|
||||
|
||||
DisassemblerEngine ppc::gPPCBigEndianDisassembler{ CS_ARCH_PPC, CS_MODE_BIG_ENDIAN };
|
||||
|
||||
DisassemblerEngine::DisassemblerEngine(cs_arch arch, cs_mode mode)
|
||||
{
|
||||
cs_open(arch, mode, &handle);
|
||||
}
|
||||
|
||||
size_t DisassemblerEngine::Disassemble(const uint8_t* code, size_t size, uint64_t base, size_t count, cs_insn** instructions) const
|
||||
{
|
||||
return cs_disasm(handle, code, size, base, count, instructions);
|
||||
}
|
||||
|
||||
void DisassemblerEngine::SetOption(cs_opt_type option, size_t value)
|
||||
{
|
||||
cs_option(handle, option, value);
|
||||
}
|
||||
|
||||
DisassemblerEngine::~DisassemblerEngine()
|
||||
{
|
||||
cs_close(&handle);
|
||||
}
|
34
PowerUtils/disasm.h
Normal file
34
PowerUtils/disasm.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
#include <capstone/capstone.h>
|
||||
|
||||
struct DisassemblerEngine
|
||||
{
|
||||
csh handle{};
|
||||
|
||||
DisassemblerEngine(const DisassemblerEngine&) = default;
|
||||
DisassemblerEngine& operator=(const DisassemblerEngine&) = delete;
|
||||
|
||||
DisassemblerEngine(cs_arch arch, cs_mode mode);
|
||||
~DisassemblerEngine();
|
||||
size_t Disassemble(const uint8_t* code, size_t size, uint64_t base, size_t count, cs_insn** instructions) const;
|
||||
void SetOption(cs_opt_type option, size_t value);
|
||||
|
||||
void SetDetail(bool value)
|
||||
{
|
||||
SetOption(CS_OPT_DETAIL, value);
|
||||
}
|
||||
};
|
||||
|
||||
namespace ppc
|
||||
{
|
||||
extern DisassemblerEngine gPPCBigEndianDisassembler;
|
||||
static size_t Disassemble(const uint8_t* code, size_t size, uint64_t base, size_t count, cs_insn** instructions)
|
||||
{
|
||||
return gPPCBigEndianDisassembler.Disassemble(code, size, base, count, instructions);
|
||||
}
|
||||
|
||||
static void SetDetail(bool value)
|
||||
{
|
||||
gPPCBigEndianDisassembler.SetDetail(value);
|
||||
}
|
||||
}
|
25
PowerUtils/file.h
Normal file
25
PowerUtils/file.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
inline static std::vector<uint8_t> LoadFile(const char* path)
|
||||
{
|
||||
std::vector<uint8_t> data{};
|
||||
auto* stream = fopen(path, "rb");
|
||||
if (stream == nullptr)
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
fseek(stream, 0, SEEK_END);
|
||||
|
||||
const auto size = ftell(stream);
|
||||
|
||||
fseek(stream, 0, SEEK_SET);
|
||||
|
||||
data.resize(size);
|
||||
|
||||
fread(data.data(), 1, data.size(), stream);
|
||||
fclose(stream);
|
||||
|
||||
return data;
|
||||
}
|
288
PowerUtils/xbox.h
Normal file
288
PowerUtils/xbox.h
Normal file
@@ -0,0 +1,288 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <type_traits>
|
||||
#include <bit>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#define near
|
||||
#define far
|
||||
|
||||
typedef char CHAR;
|
||||
typedef wchar_t WCHAR;
|
||||
typedef unsigned long DWORD;
|
||||
typedef int BOOL;
|
||||
typedef unsigned char BYTE;
|
||||
typedef unsigned short WORD;
|
||||
typedef float FLOAT;
|
||||
typedef FLOAT* PFLOAT;
|
||||
typedef BOOL near* PBOOL;
|
||||
typedef BOOL far* LPBOOL;
|
||||
typedef BYTE near* PBYTE;
|
||||
typedef BYTE far* LPBYTE;
|
||||
typedef int near* PINT;
|
||||
typedef int far* LPINT;
|
||||
typedef WORD near* PWORD;
|
||||
typedef WORD far* LPWORD;
|
||||
typedef long far* LPLONG;
|
||||
typedef DWORD near* PDWORD;
|
||||
typedef DWORD far* LPDWORD;
|
||||
typedef void far* LPVOID;
|
||||
typedef const void far* LPCVOID;
|
||||
typedef unsigned long ULONG;
|
||||
typedef ULONG* PULONG;
|
||||
typedef signed long LONG;
|
||||
typedef LONG* PLONG;
|
||||
typedef unsigned long long ULONGLONG;
|
||||
typedef ULONGLONG* PULONGLONG;
|
||||
typedef unsigned short USHORT;
|
||||
typedef USHORT* PUSHORT;
|
||||
typedef unsigned char UCHAR;
|
||||
typedef UCHAR* PUCHAR;
|
||||
typedef char* PSZ;
|
||||
typedef int INT;
|
||||
typedef unsigned int UINT;
|
||||
typedef unsigned int* PUINT;
|
||||
#endif
|
||||
|
||||
// real win32 handles will never use the upper bits unless something goes really wrong
|
||||
#define CHECK_GUEST_HANDLE(HANDLE) (((HANDLE) & 0x80000000) == 0x80000000)
|
||||
#define GUEST_HANDLE(HANDLE) ((HANDLE) | 0x80000000)
|
||||
#define HOST_HANDLE(HANDLE) ((HANDLE) & ~0x80000000)
|
||||
|
||||
template<typename T>
|
||||
struct be
|
||||
{
|
||||
T value;
|
||||
|
||||
be() : value(0)
|
||||
{
|
||||
}
|
||||
|
||||
be(const T v)
|
||||
{
|
||||
set(v);
|
||||
}
|
||||
|
||||
static T byteswap(T value)
|
||||
{
|
||||
if constexpr (std::is_same_v<T, double>)
|
||||
{
|
||||
const uint64_t swapped = std::byteswap(*reinterpret_cast<uint64_t*>(&value));
|
||||
return *reinterpret_cast<const T*>(&swapped);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, float>)
|
||||
{
|
||||
const uint32_t swapped = std::byteswap(*reinterpret_cast<uint32_t*>(&value));
|
||||
return *reinterpret_cast<const T*>(&swapped);
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::byteswap(value);
|
||||
}
|
||||
}
|
||||
|
||||
void set(const T v)
|
||||
{
|
||||
value = byteswap(v);
|
||||
}
|
||||
|
||||
T get() const
|
||||
{
|
||||
return byteswap(value);
|
||||
}
|
||||
|
||||
be& operator| (T value)
|
||||
{
|
||||
set(get() | value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
be& operator& (T value)
|
||||
{
|
||||
set(get() & value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator T() const
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
be& operator=(T v)
|
||||
{
|
||||
set(v);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct xpointer
|
||||
{
|
||||
be<uint32_t> ptr;
|
||||
|
||||
xpointer(T* ptr) : ptr(ptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
T* get() const
|
||||
{
|
||||
if (!ptr.value)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return static_cast<T*>(ptr);
|
||||
}
|
||||
|
||||
operator T* () const
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
T* operator->() const
|
||||
{
|
||||
return get();
|
||||
}
|
||||
};
|
||||
|
||||
typedef BYTE XBYTE;
|
||||
typedef be<uint16_t> XWORD;
|
||||
typedef be<uint32_t> XDWORD;
|
||||
typedef be<uint64_t> XQWORD;
|
||||
|
||||
typedef XBYTE* XLPBYTE;
|
||||
typedef XWORD* XLPWORD;
|
||||
typedef XDWORD* XLPDWORD;
|
||||
typedef XQWORD* XLPQWORD;
|
||||
|
||||
struct _XLIST_ENTRY;
|
||||
typedef _XLIST_ENTRY XLIST_ENTRY;
|
||||
typedef xpointer<XLIST_ENTRY> PXLIST_ENTRY;
|
||||
|
||||
typedef struct _XLIST_ENTRY
|
||||
{
|
||||
XDWORD Flink;
|
||||
XDWORD Blink;
|
||||
} XLIST_ENTRY;
|
||||
|
||||
typedef struct _XDISPATCHER_HEADER
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
UCHAR Type;
|
||||
union
|
||||
{
|
||||
UCHAR Abandoned;
|
||||
UCHAR Absolute;
|
||||
UCHAR NpxIrql;
|
||||
UCHAR Signalling;
|
||||
};
|
||||
union
|
||||
{
|
||||
UCHAR Size;
|
||||
UCHAR Hand;
|
||||
};
|
||||
union
|
||||
{
|
||||
UCHAR Inserted;
|
||||
UCHAR DebugActive;
|
||||
UCHAR DpcActive;
|
||||
};
|
||||
};
|
||||
XDWORD Lock;
|
||||
};
|
||||
|
||||
XDWORD SignalState;
|
||||
XLIST_ENTRY WaitListHead;
|
||||
} XDISPATCHER_HEADER, * XPDISPATCHER_HEADER;
|
||||
|
||||
// These variables are never accessed in guest code, we can safely use them in little endian
|
||||
typedef struct _XRTL_CRITICAL_SECTION
|
||||
{
|
||||
XDISPATCHER_HEADER Header;
|
||||
long LockCount;
|
||||
int32_t RecursionCount;
|
||||
uint32_t OwningThread;
|
||||
} XRTL_CRITICAL_SECTION;
|
||||
|
||||
typedef struct _XANSI_STRING {
|
||||
XWORD Length;
|
||||
XWORD MaximumLength;
|
||||
xpointer<char> Buffer;
|
||||
} XANSI_STRING;
|
||||
|
||||
typedef struct _XOBJECT_ATTRIBUTES
|
||||
{
|
||||
XDWORD RootDirectory;
|
||||
xpointer<XANSI_STRING> Name;
|
||||
xpointer<void> Attributes;
|
||||
} XOBJECT_ATTRIBUTES;
|
||||
|
||||
typedef XDISPATCHER_HEADER XKEVENT;
|
||||
|
||||
typedef struct _XIO_STATUS_BLOCK
|
||||
{
|
||||
union {
|
||||
XDWORD Status;
|
||||
XDWORD Pointer;
|
||||
};
|
||||
be<uint32_t> Information;
|
||||
} XIO_STATUS_BLOCK;
|
||||
|
||||
typedef struct _XOVERLAPPED {
|
||||
XDWORD Internal;
|
||||
XDWORD InternalHigh;
|
||||
XDWORD Offset;
|
||||
XDWORD OffsetHigh;
|
||||
XDWORD hEvent;
|
||||
} XOVERLAPPED;
|
||||
|
||||
// this name is so dumb
|
||||
typedef struct _XXOVERLAPPED {
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
XDWORD Error;
|
||||
XDWORD Length;
|
||||
};
|
||||
|
||||
struct
|
||||
{
|
||||
uint32_t InternalLow;
|
||||
uint32_t InternalHigh;
|
||||
};
|
||||
};
|
||||
uint32_t InternalContext;
|
||||
XDWORD hEvent;
|
||||
XDWORD pCompletionRoutine;
|
||||
XDWORD dwCompletionContext;
|
||||
XDWORD dwExtendedError;
|
||||
} XXOVERLAPPED, *PXXOVERLAPPED;
|
||||
|
||||
static_assert(sizeof(_XXOVERLAPPED) == 0x1C);
|
||||
|
||||
typedef struct _XVIDEO_MODE
|
||||
{
|
||||
be<uint32_t> DisplayWidth;
|
||||
be<uint32_t> DisplayHeight;
|
||||
be<uint32_t> IsInterlaced;
|
||||
be<uint32_t> IsWidescreen;
|
||||
be<uint32_t> IsHighDefinition;
|
||||
be<uint32_t> RefreshRate;
|
||||
be<uint32_t> VideoStandard;
|
||||
be<uint32_t> Unknown4A;
|
||||
be<uint32_t> Unknown01;
|
||||
be<uint32_t> reserved[3];
|
||||
} XVIDEO_MODE;
|
||||
|
||||
typedef struct _XKSEMAPHORE
|
||||
{
|
||||
XDISPATCHER_HEADER Header;
|
||||
XDWORD Limit;
|
||||
} XKSEMAPHORE;
|
53
PowerUtils/xex.cpp
Normal file
53
PowerUtils/xex.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
#include "xex.h"
|
||||
#include <cassert>
|
||||
|
||||
std::unique_ptr<uint8_t[]> Xex2LoadImage(const uint8_t* data)
|
||||
{
|
||||
auto* header = reinterpret_cast<const XEX_HEADER*>(data);
|
||||
auto* security = reinterpret_cast<const XEX2_SECURITY_INFO*>(data + header->AddressOfSecurityInfo);
|
||||
|
||||
const auto* compressionInfo = Xex2FindOptionalHeader<XEX_FILE_FORMAT_INFO>(header, XEX_HEADER_FILE_FORMAT_INFO);
|
||||
|
||||
std::unique_ptr<uint8_t[]> result{};
|
||||
size_t imageSize = security->SizeOfImage;
|
||||
|
||||
if (compressionInfo != nullptr)
|
||||
{
|
||||
assert(compressionInfo->CompressionType >= XEX_COMPRESSION_BASIC);
|
||||
assert(compressionInfo->EncryptionType == XEX_ENCRYPTION_NONE);
|
||||
|
||||
if (compressionInfo->CompressionType == XEX_COMPRESSION_NONE)
|
||||
{
|
||||
result = std::make_unique<uint8_t[]>(imageSize);
|
||||
memcpy(result.get(), data + header->SizeOfHeader, imageSize);
|
||||
}
|
||||
else if (compressionInfo->CompressionType == XEX_COMPRESSION_BASIC)
|
||||
{
|
||||
auto* blocks = reinterpret_cast<const XEX_BASIC_FILE_COMPRESSION_INFO*>(compressionInfo + 1);
|
||||
const size_t numBlocks = (compressionInfo->SizeOfHeader / sizeof(XEX_BASIC_FILE_COMPRESSION_INFO)) - 1;
|
||||
|
||||
imageSize = 0;
|
||||
for (size_t i = 0; i < numBlocks; i++)
|
||||
{
|
||||
imageSize += blocks[i].SizeOfData + blocks[i].SizeOfPadding;
|
||||
}
|
||||
|
||||
result = std::make_unique<uint8_t[]>(imageSize);
|
||||
auto* srcData = data + header->SizeOfHeader;
|
||||
auto* destData = result.get();
|
||||
|
||||
for (size_t i = 0; i < numBlocks; i++)
|
||||
{
|
||||
memcpy(destData, srcData, blocks[i].SizeOfData);
|
||||
|
||||
srcData += blocks[i].SizeOfData;
|
||||
destData += blocks[i].SizeOfData;
|
||||
|
||||
memset(destData, 0, blocks[i].SizeOfPadding);
|
||||
destData += blocks[i].SizeOfPadding;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
126
PowerUtils/xex.h
Normal file
126
PowerUtils/xex.h
Normal file
@@ -0,0 +1,126 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include "xbox.h"
|
||||
|
||||
#define XEX_COMPRESSION_NONE 0
|
||||
#define XEX_COMPRESSION_BASIC 1
|
||||
|
||||
#define XEX_ENCRYPTION_NONE 0
|
||||
|
||||
enum _XEX_OPTIONAL_HEADER_TYPES
|
||||
{
|
||||
XEX_HEADER_RESOURCE_INFO = 0x000002FF,
|
||||
XEX_HEADER_FILE_FORMAT_INFO = 0x000003FF,
|
||||
XEX_HEADER_DELTA_PATCH_DESCRIPTOR = 0x000005FF,
|
||||
XEX_HEADER_BASE_REFERENCE = 0x00000405,
|
||||
XEX_HEADER_BOUNDING_PATH = 0x000080FF,
|
||||
XEX_HEADER_DEVICE_ID = 0x00008105,
|
||||
XEX_HEADER_ORIGINAL_BASE_ADDRESS = 0x00010001,
|
||||
XEX_HEADER_ENTRY_POINT = 0x00010100,
|
||||
XEX_HEADER_IMAGE_BASE_ADDRESS = 0x00010201,
|
||||
XEX_HEADER_IMPORT_LIBRARIES = 0x000103FF,
|
||||
XEX_HEADER_CHECKSUM_TIMESTAMP = 0x00018002,
|
||||
XEX_HEADER_ENABLED_FOR_CALLCAP = 0x00018102,
|
||||
XEX_HEADER_ENABLED_FOR_FASTCAP = 0x00018200,
|
||||
XEX_HEADER_ORIGINAL_PE_NAME = 0x000183FF,
|
||||
XEX_HEADER_STATIC_LIBRARIES = 0x000200FF,
|
||||
XEX_HEADER_TLS_INFO = 0x00020104,
|
||||
XEX_HEADER_DEFAULT_STACK_SIZE = 0x00020200,
|
||||
XEX_HEADER_DEFAULT_FILESYSTEM_CACHE_SIZE = 0x00020301,
|
||||
XEX_HEADER_DEFAULT_HEAP_SIZE = 0x00020401,
|
||||
XEX_HEADER_PAGE_HEAP_SIZE_AND_FLAGS = 0x00028002,
|
||||
XEX_HEADER_SYSTEM_FLAGS = 0x00030000,
|
||||
XEX_HEADER_EXECUTION_INFO = 0x00040006,
|
||||
XEX_HEADER_TITLE_WORKSPACE_SIZE = 0x00040201,
|
||||
XEX_HEADER_GAME_RATINGS = 0x00040310,
|
||||
XEX_HEADER_LAN_KEY = 0x00040404,
|
||||
XEX_HEADER_XBOX360_LOGO = 0x000405FF,
|
||||
XEX_HEADER_MULTIDISC_MEDIA_IDS = 0x000406FF,
|
||||
XEX_HEADER_ALTERNATE_TITLE_IDS = 0x000407FF,
|
||||
XEX_HEADER_ADDITIONAL_TITLE_MEMORY = 0x00040801,
|
||||
XEX_HEADER_EXPORTS_BY_NAME = 0x00E10402,
|
||||
};
|
||||
|
||||
typedef struct _XEX_FILE_FORMAT_INFO
|
||||
{
|
||||
be<uint32_t> SizeOfHeader;
|
||||
be<uint16_t> EncryptionType;
|
||||
be<uint16_t> CompressionType;
|
||||
} XEX_FILE_FORMAT_INFO;
|
||||
|
||||
typedef struct _XEX_BASIC_FILE_COMPRESSION_INFO
|
||||
{
|
||||
be<uint32_t> SizeOfData;
|
||||
be<uint32_t> SizeOfPadding;
|
||||
} XEX_BASIC_FILE_COMPRESSION_INFO;
|
||||
|
||||
typedef struct _XEX_OPTIONAL_HEADER
|
||||
{
|
||||
be<uint32_t> Type;
|
||||
be<uint32_t> Address;
|
||||
} XEX_OPTIONAL_HEADER;
|
||||
|
||||
typedef struct _XEX2_SECURITY_INFO
|
||||
{
|
||||
be<uint32_t> SizeOfHeader;
|
||||
be<uint32_t> SizeOfImage;
|
||||
char RsaSignature[0x100];
|
||||
be<uint32_t> Unknown108;
|
||||
be<uint32_t> ImageFlags;
|
||||
be<uint32_t> ImageBase;
|
||||
char SectionDigest[0x14];
|
||||
be<uint32_t> NumberOfImports;
|
||||
char ImportsDigest[0x14];
|
||||
char Xgd2MediaID[0x10];
|
||||
char AesKey[0x10];
|
||||
be<uint32_t> AddressOfExports;
|
||||
char HeaderDigest[0x14];
|
||||
be<uint32_t> Region;
|
||||
be<uint32_t> AllowedMediaTypes;
|
||||
be<uint32_t> NumberOfPageDescriptors;
|
||||
} XEX2_SECURITY_INFO;
|
||||
|
||||
typedef struct _XEX_HEADER
|
||||
{
|
||||
char Signature[4];
|
||||
be<uint32_t> Flags;
|
||||
be<uint32_t> SizeOfHeader;
|
||||
char Reserved[4];
|
||||
be<uint32_t> AddressOfSecurityInfo;
|
||||
be<uint32_t> NumberOfOptionalHeaders;
|
||||
} XEX_HEADER;
|
||||
|
||||
typedef struct _X_RUNTIME_FUNCTION
|
||||
{
|
||||
be<DWORD> BeginAddress;
|
||||
be<DWORD> Flags; // honestly, no idea
|
||||
} X_RUNTIME_FUNCTION;
|
||||
|
||||
template<typename T>
|
||||
inline static const T* Xex2FindOptionalHeader(const void* base, const XEX_OPTIONAL_HEADER* headers, size_t n, _XEX_OPTIONAL_HEADER_TYPES type)
|
||||
{
|
||||
for (size_t i = 0; i < n; i++)
|
||||
{
|
||||
if (headers[i].Type == (uint32_t)type)
|
||||
{
|
||||
if ((type & 0xFF) == 1)
|
||||
{
|
||||
return reinterpret_cast<const T*>(&headers[i].Address);
|
||||
}
|
||||
else
|
||||
{
|
||||
return reinterpret_cast<const T*>(static_cast<const char*>(base) + headers[i].Address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline static const T* Xex2FindOptionalHeader(const XEX_HEADER* header, _XEX_OPTIONAL_HEADER_TYPES type)
|
||||
{
|
||||
return Xex2FindOptionalHeader<T>(header, (XEX_OPTIONAL_HEADER*)(header + 1), header->NumberOfOptionalHeaders, type);
|
||||
}
|
||||
|
||||
std::unique_ptr<uint8_t[]> Xex2LoadImage(const uint8_t* data);
|
14
thirdparty/capstone/.appveyor.yml
vendored
Normal file
14
thirdparty/capstone/.appveyor.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
version: 4.0-{build}
|
||||
|
||||
os:
|
||||
- Visual Studio 2015
|
||||
|
||||
before_build:
|
||||
- call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
|
||||
build_script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -DCMAKE_BUILD_TYPE=RELEASE -G "NMake Makefiles" ..
|
||||
- nmake
|
||||
|
120
thirdparty/capstone/.clang-format
vendored
Normal file
120
thirdparty/capstone/.clang-format
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
#
|
||||
# clang-format configuration file. Intended for clang-format >= 11.
|
||||
#
|
||||
# For more information, see:
|
||||
#
|
||||
# Documentation/process/clang-format.rst
|
||||
# https://clang.llvm.org/docs/ClangFormat.html
|
||||
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
||||
#
|
||||
---
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: DontAlign
|
||||
AlignOperands: true
|
||||
AlignTrailingComments:
|
||||
Kind: Always
|
||||
OverEmptyLines: 2
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: false
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakBeforeTernaryOperators: false
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: false
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 8
|
||||
ContinuationIndentWidth: 8
|
||||
Cpp11BracedListStyle: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: false
|
||||
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IndentCaseLabels: false
|
||||
IndentGotoLabels: false
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 8
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 8
|
||||
ObjCSpaceAfterProperty: true
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
|
||||
# Taken from git's rules
|
||||
PenaltyBreakAssignment: 10
|
||||
PenaltyBreakBeforeFirstCallParameter: 30
|
||||
PenaltyBreakComment: 10
|
||||
PenaltyBreakFirstLessLess: 0
|
||||
PenaltyBreakString: 10
|
||||
PenaltyExcessCharacter: 100
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
|
||||
PointerAlignment: Right
|
||||
ReflowComments: false
|
||||
SortIncludes: false
|
||||
SortUsingDeclarations: false
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatementsExceptForEachMacros
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp03
|
||||
TabWidth: 8
|
||||
UseTab: Always
|
22
thirdparty/capstone/.editorconfig
vendored
Normal file
22
thirdparty/capstone/.editorconfig
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{py,pyx,pxd}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
# Follow Linux kernel coding style
|
||||
[*.{c,h,cpp,hpp,inc}]
|
||||
indent_style = tab
|
||||
indent_size = 8
|
||||
|
||||
# OCaml bindings
|
||||
[*.ml]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
1
thirdparty/capstone/.gitattributes
vendored
Normal file
1
thirdparty/capstone/.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/arch/**/*.inc linguist-language=C
|
58
thirdparty/capstone/.github/ISSUE_TEMPLATE/bug_report_asm.md
vendored
Normal file
58
thirdparty/capstone/.github/ISSUE_TEMPLATE/bug_report_asm.md
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
---
|
||||
name: Bug report - Incorrect disassembly
|
||||
about: Create a report about incorrect disassembly.
|
||||
---
|
||||
|
||||
<!-- This template is meant for disassembly related bug reports, please be as descriptive as possible -->
|
||||
|
||||
### Work environment
|
||||
|
||||
<!-- Filling this table is mandatory -->
|
||||
|
||||
| Questions | Answers
|
||||
|------------------------------------------|--------------------
|
||||
| OS/arch/bits | Debian arm 64, MacOS AArch64, MacOS x86, Windows x86 etc.
|
||||
| Architecture | ppc, x86, cortexm, armv8 etc.
|
||||
| Source of Capstone | `git clone`, brew, pip, release binaries etc.
|
||||
| Version/git commit | v5.0.1, <commit hash>
|
||||
|
||||
<!-- INCORRECT DISASSEMBLY BUGS -->
|
||||
|
||||
### Instruction bytes giving faulty results
|
||||
|
||||
```
|
||||
0x00,0x00,0x00,0x00
|
||||
```
|
||||
|
||||
### Expected results
|
||||
|
||||
It should be:
|
||||
```
|
||||
<this or that>
|
||||
```
|
||||
|
||||
### Steps to get the wrong result
|
||||
|
||||
With `cstool`:
|
||||
|
||||
```sh
|
||||
cstool arm -d 0x00,0x00,0x00,0x00
|
||||
```
|
||||
|
||||
or with `Python`
|
||||
|
||||
```python
|
||||
CODE = b'\x90\x90\x90\x90'
|
||||
|
||||
md = Cs(CS_ARCH_ARM, CS_MODE_THUMB)
|
||||
md.detail = True
|
||||
for insn in md.disasm(CODE, 0x1000):
|
||||
# Print the faulty disassembly
|
||||
```
|
||||
|
||||
<!-- ADDITIONAL CONTEXT -->
|
||||
|
||||
### Additional Logs, screenshots, source code, configuration dump, ...
|
||||
|
||||
Drag and drop zip archives containing the Additional info here, don't use external services or link.
|
||||
Screenshots can be directly dropped here.
|
40
thirdparty/capstone/.github/ISSUE_TEMPLATE/bug_report_general.md
vendored
Normal file
40
thirdparty/capstone/.github/ISSUE_TEMPLATE/bug_report_general.md
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
name: Bug report - Other bugs
|
||||
about: Create a report to help us improve
|
||||
|
||||
---
|
||||
|
||||
<!-- This template is meant for GENERAL bug reports.
|
||||
For bugs regarding incorrect disassembly,
|
||||
please use the "Bug report - Incorrect disassembly" template.
|
||||
|
||||
Please be as descriptive as possible
|
||||
-->
|
||||
|
||||
### Work environment
|
||||
|
||||
<!-- Filling this table is mandatory -->
|
||||
|
||||
| Questions | Answers
|
||||
|------------------------------------------|--------------------
|
||||
| OS/arch/bits | Debian arm 64, MacOS AArch64, MacOS x86, Windows x86 etc.
|
||||
| Architecture | ppc, x86, cortexm, armv8 etc.
|
||||
| Source of Capstone | `git clone`, brew, pip, release binaries etc.
|
||||
| Version/git commit | v5.0.1, <commit hash>
|
||||
|
||||
<!-- OTHER BUGS -->
|
||||
|
||||
### Expected behavior
|
||||
|
||||
### Actual behavior
|
||||
|
||||
### Steps to reproduce the behavior
|
||||
|
||||
- Use code markdown `CODE` to make your code visible
|
||||
|
||||
<!-- ADDITIONAL CONTEXT -->
|
||||
|
||||
### Additional Logs, screenshots, source code, configuration dump, ...
|
||||
|
||||
Drag and drop zip archives containing the Additional info here, don't use external services or link.
|
||||
Screenshots can be directly dropped here.
|
19
thirdparty/capstone/.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
19
thirdparty/capstone/.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
|
||||
---
|
||||
|
||||
### Feature
|
||||
|
||||
- [ ] New architecture module
|
||||
- [ ] Support for processor extension
|
||||
- [ ] Add more instruction details (elaborated below)
|
||||
- [ ] Binding support for: `language`
|
||||
- [ ] Other (elaborated below)
|
||||
|
||||
**Describe the feature you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the feature request here.
|
23
thirdparty/capstone/.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
23
thirdparty/capstone/.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<!-- Filling this template is mandatory -->
|
||||
|
||||
**Your checklist for this pull request**
|
||||
- [ ] I've documented or updated the documentation of every API function and struct this PR changes.
|
||||
- [ ] I've added tests that prove my fix is effective or that my feature works (if possible)
|
||||
|
||||
**Detailed description**
|
||||
|
||||
<!-- Explain the **details** for making this change. Is a new feature implemented? What existing problem does the pull request solve? How does the pull request solve these issues? Please provide enough information so that others can review your pull request. -->
|
||||
|
||||
...
|
||||
|
||||
**Test plan**
|
||||
|
||||
<!-- What steps should the reviewer take to test your pull request? Demonstrate the code is solid. Or what test cases you added. Disassembly tests should be added in suite/cs_test/issues.cs -->
|
||||
|
||||
...
|
||||
|
||||
**Closing issues**
|
||||
|
||||
<!-- put "closes #XXXX" in your comment to auto-close the issue that your PR fixes (if any). -->
|
||||
|
||||
...
|
175
thirdparty/capstone/.github/labeler.yml
vendored
Normal file
175
thirdparty/capstone/.github/labeler.yml
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
Auto-Sync-files:
|
||||
- suite/auto-sync/**
|
||||
|
||||
LLVM-core-files:
|
||||
- MC*.[ch]
|
||||
|
||||
LLVM-generated-files:
|
||||
- arch/*/*.inc
|
||||
|
||||
Documentation:
|
||||
- '**/*.md'
|
||||
|
||||
CS-core-files:
|
||||
- cs*.[ch]
|
||||
- SStream.[ch]
|
||||
- utis.[ch]
|
||||
- MathExtras.h
|
||||
- Mapping.[ch]
|
||||
- LEB128.h
|
||||
- cstool/cstool.[ch]
|
||||
- cstool/getopt.[ch]
|
||||
- include/capstone/capstone.h
|
||||
- include/capstone/cs_operand.h
|
||||
- include/capstone/platform.h
|
||||
|
||||
ARM:
|
||||
- arch/ARM/**
|
||||
- cstool/cstool_arm.c
|
||||
- include/capstone/arm.h
|
||||
- suite/MC/ARM/**
|
||||
- tests/test_arm.c
|
||||
|
||||
AArch64:
|
||||
- arch/AArch64/**
|
||||
- cstool/cstool_aarch64.c
|
||||
- include/capstone/aarch64.h
|
||||
- suite/MC/AArch64/**
|
||||
- tests/test_aarch64.c
|
||||
|
||||
Alpha:
|
||||
- arch/Alpha/**
|
||||
- cstool/cstool_alpha.c
|
||||
- include/capstone/alpha.h
|
||||
- suite/MC/Alpha/**
|
||||
- tests/test_alpha.c
|
||||
|
||||
BPF:
|
||||
- arch/BPF/**
|
||||
- cstool/cstool_bpf.c
|
||||
- include/capstone/bpf.h
|
||||
- suite/MC/BPF/**
|
||||
- tests/test_bpf.c
|
||||
|
||||
EVM:
|
||||
- arch/EVM/**
|
||||
- cstool/cstool_evm.c
|
||||
- include/capstone/evm.h
|
||||
- tests/test_evm.c
|
||||
|
||||
HPPA:
|
||||
- arch/HPPA/**
|
||||
- cstool/cstool_hppa.c
|
||||
- include/capstone/hppa.h
|
||||
- suite/MC/HPPA/**
|
||||
- tests/test_hppa.c
|
||||
|
||||
LoongArch:
|
||||
- arch/LoongArch/**
|
||||
- cstool/cstool_loongarch.c
|
||||
- include/capstone/loongarch.h
|
||||
- suite/MC/LoongArch/**
|
||||
- tests/test_loongarch.c
|
||||
|
||||
M680X:
|
||||
- arch/M680X/**
|
||||
- cstool/cstool_m680x.c
|
||||
- include/capstone/m680x.h
|
||||
- tests/test_m680x.c
|
||||
|
||||
M68K:
|
||||
- arch/M68K/**
|
||||
- cstool/cstool_m68k.c
|
||||
- include/capstone/m68k.h
|
||||
- tests/test_m68k.c
|
||||
|
||||
MOS65XX:
|
||||
- arch/MOS65XX/**
|
||||
- cstool/cstool_mos65xx.c
|
||||
- include/capstone/mos65xx.h
|
||||
- tests/test_mos65xx.c
|
||||
|
||||
Mips:
|
||||
- arch/Mips/**
|
||||
- cstool/cstool_mips.c
|
||||
- include/capstone/mips.h
|
||||
- suite/MC/Mips/**
|
||||
- tests/test_mips.c
|
||||
|
||||
PowerPC:
|
||||
- arch/PowerPC/**
|
||||
- cstool/cstool_powerpc.c
|
||||
- include/capstone/ppc.h
|
||||
- suite/MC/PowerPC/**
|
||||
- tests/test_powerpc.c
|
||||
|
||||
RISCV:
|
||||
- arch/RISCV/**
|
||||
- cstool/cstool_riscv.c
|
||||
- include/capstone/riscv.h
|
||||
- suite/MC/RISCV/**
|
||||
- tests/test_riscv.c
|
||||
|
||||
SH:
|
||||
- arch/SH/**
|
||||
- cstool/cstool_sh.c
|
||||
- include/capstone/sh.h
|
||||
- tests/test_sh.c
|
||||
|
||||
Sparc:
|
||||
- arch/Sparc/**
|
||||
- cstool/cstool_sparc.c
|
||||
- include/capstone/sparc.h
|
||||
- suite/MC/Sparc/**
|
||||
- tests/test_sparc.c
|
||||
|
||||
SystemZ:
|
||||
- arch/SystemZ/**
|
||||
- cstool/cstool_systemz.c
|
||||
- include/capstone/systemz.h
|
||||
- suite/MC/SystemZ/**
|
||||
- tests/test_systemz.c
|
||||
|
||||
TMS320C64x:
|
||||
- arch/TMS320C6x/**
|
||||
- cstool/cstool_tms320c64x.c
|
||||
- include/capstone/tms320x64x.h
|
||||
- tests/test_tms320c64x.c
|
||||
|
||||
TriCore:
|
||||
- arch/TriCore/**
|
||||
- cstool/cstool_tricore.c
|
||||
- include/capstone/tricore.h
|
||||
- suite/MC/Tricore/**
|
||||
- tests/test_tricore.c
|
||||
|
||||
WASM:
|
||||
- arch/WASM/**
|
||||
- cstool/cstool_wasm.c
|
||||
- include/capstone/wasm.h
|
||||
- tests/test_wasm.c
|
||||
|
||||
X86:
|
||||
- arch/X86/**
|
||||
- cstool/cstool_x86.c
|
||||
- include/capstone/x86.h
|
||||
- suite/MC/X86/**
|
||||
- tests/test_x86.c
|
||||
|
||||
XCore:
|
||||
- arch/XCore/**
|
||||
- cstool/cstool_xcore.c
|
||||
- include/capstone/xcore.h
|
||||
- tests/test_xcore.c
|
||||
|
||||
python:
|
||||
- bindings/python/**
|
||||
|
||||
ocaml:
|
||||
- bindings/ocaml/**
|
||||
|
||||
java:
|
||||
- bindings/java/**
|
||||
|
||||
Github-files:
|
||||
- .github/**
|
172
thirdparty/capstone/.github/workflows/CITest.yml
vendored
Normal file
172
thirdparty/capstone/.github/workflows/CITest.yml
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
name: Run Test
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- ".gitignore"
|
||||
- "docs/**"
|
||||
- "ChangeLog"
|
||||
- "CREDITS.TXT"
|
||||
- "COMPILE_MAKE.TXT"
|
||||
- "COMPILE_MSVC.TXT"
|
||||
- "COMPILE_CMAKE.TXT"
|
||||
- "HACK.TXT"
|
||||
- "LICENSE.TXT"
|
||||
- "LICENSE_LLVM.TXT"
|
||||
- "README.md"
|
||||
- "RELEASE_NOTES"
|
||||
- "SPONSORS.TXT"
|
||||
- "TODO"
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
CI: true
|
||||
|
||||
jobs:
|
||||
Linux:
|
||||
runs-on: ${{ matrix.config.os }}
|
||||
name: ${{ matrix.config.name }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- {
|
||||
name: 'ubuntu-22.04 x64 make',
|
||||
os: ubuntu-22.04,
|
||||
arch: x64,
|
||||
build-system: 'make',
|
||||
diet-build: 'OFF',
|
||||
enable-asan: 'OFF'
|
||||
}
|
||||
- {
|
||||
name: 'ubuntu-22.04 x64 cmake',
|
||||
os: ubuntu-22.04,
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
enable-asan: 'OFF'
|
||||
}
|
||||
- {
|
||||
name: 'ubuntu-24.04 x64 ASAN',
|
||||
os: ubuntu-24.04,
|
||||
arch: x64,
|
||||
build-system: 'cmake',
|
||||
diet-build: 'OFF',
|
||||
enable-asan: 'ON'
|
||||
}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.config.python-version }}
|
||||
|
||||
- name: Prepare fuzzing
|
||||
run: |
|
||||
export LD_LIBRARY_PATH=`pwd`/tests/:$LD_LIBRARY_PATH
|
||||
wget https://github.com/groundx/capstonefuzz/raw/master/corpus/corpus-libFuzzer-capstone_fuzz_disasmnext-latest.zip
|
||||
unzip -q corpus-libFuzzer-capstone_fuzz_disasmnext-latest.zip -d suite/fuzz
|
||||
|
||||
- name: make
|
||||
if: startsWith(matrix.config.build-system, 'make')
|
||||
run: |
|
||||
./make.sh
|
||||
sudo make install
|
||||
|
||||
- name: cmake
|
||||
if: startsWith(matrix.config.build-system, 'cmake')
|
||||
env:
|
||||
asan: ${{ matrix.config.enable-asan }}
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
# build static library
|
||||
cmake -DCAPSTONE_INSTALL=1 -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_ASAN=${asan} -DCAPSTONE_BUILD_DIET=${diet_build} ..
|
||||
cmake --build . --config Release
|
||||
# build shared library
|
||||
cmake -DCAPSTONE_INSTALL=1 -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX=/usr -DCAPSTONE_BUILD_CSTEST=ON -DENABLE_ASAN=${asan} ..
|
||||
sudo cmake --build . --config Release --target install
|
||||
|
||||
- name: Lower number of KASL randomized address bits
|
||||
run: |
|
||||
# Work-around ASAN bug https://github.com/google/sanitizers/issues/1716
|
||||
sudo sysctl vm.mmap_rnd_bits=28
|
||||
|
||||
- name: "Compatibility header test"
|
||||
if: startsWith(matrix.config.build-system, 'cmake') && matrix.config.diet-build == 'OFF'
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R ASCompatibilityHeaderTest
|
||||
|
||||
- name: cstool - reaches disassembler engine
|
||||
run: |
|
||||
sh suite/run_invalid_cstool.sh
|
||||
|
||||
- name: cstest unit tests
|
||||
if: startsWith(matrix.config.build-system, 'cmake')
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R UnitCSTest
|
||||
|
||||
- name: cstest integration tests
|
||||
if: startsWith(matrix.config.build-system, 'cmake')
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R IntegrationCSTest
|
||||
|
||||
- name: cstest MC
|
||||
if: startsWith(matrix.config.build-system, 'cmake')
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R MCTests
|
||||
|
||||
- name: cstest details
|
||||
if: startsWith(matrix.config.build-system, 'cmake')
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R DetailTests
|
||||
|
||||
- name: cstest issues
|
||||
if: startsWith(matrix.config.build-system, 'cmake')
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R IssueTests
|
||||
|
||||
- name: cstest features
|
||||
if: startsWith(matrix.config.build-system, 'cmake')
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R FeaturesTests
|
||||
|
||||
- name: Legacy integration tests
|
||||
if: startsWith(matrix.config.build-system, 'cmake')
|
||||
run: |
|
||||
ctest --test-dir build --output-on-failure -R legacy*
|
||||
|
||||
Windows:
|
||||
runs-on: ${{ matrix.config.os }}
|
||||
name: ${{ matrix.config.name }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- name: 'windows x64 MSVC 64bit'
|
||||
os: windows-latest
|
||||
arch: x64
|
||||
platform: windows
|
||||
python-arch: x64
|
||||
python-version: '3.9'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: lukka/get-cmake@latest
|
||||
name: Get CMake
|
||||
|
||||
- name: '🛠️ Win MSVC 64 setup'
|
||||
if: contains(matrix.config.name, 'MSVC 64')
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: 'x64'
|
||||
|
||||
- name: '🚧 Win MSVC 64 build'
|
||||
if: contains(matrix.config.name, 'MSVC 64')
|
||||
shell: bash
|
||||
run: |
|
||||
cmake --version
|
||||
cmake --preset=${{ matrix.config.platform }}-x64
|
||||
cmake --build --preset build-${{ matrix.config.platform }}-release
|
||||
cmake --build --preset install-${{ matrix.config.platform }}-release
|
101
thirdparty/capstone/.github/workflows/auto-sync.yml
vendored
Normal file
101
thirdparty/capstone/.github/workflows/auto-sync.yml
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
name: Auto-Sync
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "suite/auto-sync/**"
|
||||
- ".github/workflows/auto-sync.yml"
|
||||
pull_request:
|
||||
|
||||
# Stop previous runs on the same branch on new push
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-24.04
|
||||
defaults:
|
||||
run:
|
||||
working-directory: suite/auto-sync/
|
||||
steps:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Install auto-sync package
|
||||
run: |
|
||||
pip install .
|
||||
|
||||
- name: Check formatting
|
||||
run: |
|
||||
python3.11 -m black --check src/autosync
|
||||
|
||||
- name: Install llvm-mc
|
||||
run: |
|
||||
sudo apt install llvm-18
|
||||
llvm-mc-18 --version
|
||||
FileCheck-18 --version
|
||||
sudo ln -s $(whereis -b llvm-mc-18 | grep -Eo "/.*") /usr/local/bin/llvm-mc
|
||||
sudo ln -s $(whereis -b FileCheck-18 | grep -Eo "/.*") /usr/local/bin/FileCheck
|
||||
llvm-mc --version
|
||||
FileCheck --version
|
||||
|
||||
- name: Clone llvm-capstone
|
||||
run: |
|
||||
git clone https://github.com/capstone-engine/llvm-capstone.git vendor/llvm_root
|
||||
|
||||
- name: Build llvm-tblgen
|
||||
run: |
|
||||
cd vendor/llvm_root
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ../llvm
|
||||
cmake --build . --target llvm-tblgen --config Debug
|
||||
cd ../../../
|
||||
|
||||
- name: Test Header patcher
|
||||
run: |
|
||||
python -m unittest src/autosync/Tests/test_header_patcher.py
|
||||
python -m unittest src/autosync/Tests/test_mcupdater.py
|
||||
|
||||
- name: Remove llvm-mc
|
||||
run: |
|
||||
sudo apt remove llvm-18
|
||||
sudo rm /usr/local/bin/llvm-mc
|
||||
sudo rm /usr/local/bin/FileCheck
|
||||
|
||||
- name: Test generation of inc files
|
||||
run: |
|
||||
./src/autosync/ASUpdater.py -d -a AArch64 -s IncGen
|
||||
./src/autosync/ASUpdater.py -d -a Alpha -s IncGen
|
||||
./src/autosync/ASUpdater.py -d -a ARM -s IncGen
|
||||
./src/autosync/ASUpdater.py -d -a PPC -s IncGen
|
||||
./src/autosync/ASUpdater.py -d -a LoongArch -s IncGen
|
||||
|
||||
- name: CppTranslator - Patch tests
|
||||
run: |
|
||||
python -m unittest src/autosync/cpptranslator/Tests/test_patches.py
|
||||
|
||||
- name: CppTranslator - Differ tests
|
||||
run: |
|
||||
python -m unittest src/autosync/cpptranslator/Tests/test_differ.py
|
||||
|
||||
- name: CppTranslator - Test translation
|
||||
run: |
|
||||
./src/autosync/ASUpdater.py --ci -d -a AArch64 -s Translate
|
||||
./src/autosync/ASUpdater.py --ci -d -a ARM -s Translate
|
||||
./src/autosync/ASUpdater.py --ci -d -a PPC -s Translate
|
||||
./src/autosync/ASUpdater.py --ci -d -a LoongArch -s Translate
|
||||
|
||||
- name: Differ - Test save file is up-to-date
|
||||
run: |
|
||||
./src/autosync/cpptranslator/Differ.py -a AArch64 --check_saved
|
||||
./src/autosync/cpptranslator/Differ.py -a ARM --check_saved
|
||||
./src/autosync/cpptranslator/Differ.py -a PPC --check_saved
|
||||
./src/autosync/cpptranslator/Differ.py -a LoongArch --check_saved
|
50
thirdparty/capstone/.github/workflows/build_release.yml
vendored
Normal file
50
thirdparty/capstone/.github/workflows/build_release.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
name: Build Source Release
|
||||
|
||||
# Trigger whenever a release is created
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- created
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: archive
|
||||
id: archive
|
||||
run: |
|
||||
VERSION=${{ github.event.release.tag_name }}
|
||||
PKGNAME="capstone-$VERSION"
|
||||
SHASUM=$PKGNAME.tar.xz.sha256
|
||||
mkdir -p /tmp/$PKGNAME
|
||||
mv * /tmp/$PKGNAME
|
||||
mv /tmp/$PKGNAME .
|
||||
TARBALL=$PKGNAME.tar.xz
|
||||
tar cJf $TARBALL $PKGNAME
|
||||
sha256sum $TARBALL > $SHASUM
|
||||
echo "::set-output name=tarball::$TARBALL"
|
||||
echo "::set-output name=shasum::$SHASUM"
|
||||
- name: upload tarball
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: ./${{ steps.archive.outputs.tarball }}
|
||||
asset_name: ${{ steps.archive.outputs.tarball }}
|
||||
asset_content_type: application/gzip
|
||||
|
||||
- name: upload shasum
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: ./${{ steps.archive.outputs.shasum }}
|
||||
asset_name: ${{ steps.archive.outputs.shasum }}
|
||||
asset_content_type: text/plain
|
43
thirdparty/capstone/.github/workflows/clang-tidy.yml
vendored
Normal file
43
thirdparty/capstone/.github/workflows/clang-tidy.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
name: Run clang-tidy
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
name: clang-tidy
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install clang-tidy
|
||||
run: |
|
||||
sudo apt install clang-tidy
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
CC=clang cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_SHARED_LIBS=1 ..
|
||||
CC=clang sudo cmake --build . --config Release
|
||||
cd ..
|
||||
|
||||
- name: Install clang-tidy-18
|
||||
run: |
|
||||
sudo apt install clang-tidy-18
|
||||
|
||||
- name: Check for warnings
|
||||
env:
|
||||
base_sha: ${{ github.event.pull_request.base.sha }}
|
||||
head_sha: ${{ github.event.pull_request.head.sha }}
|
||||
run: |
|
||||
./run-clang-tidy.sh build
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ failure() }}
|
||||
with:
|
||||
path: ct-warnings.txt
|
60
thirdparty/capstone/.github/workflows/coverity.yml
vendored
Normal file
60
thirdparty/capstone/.github/workflows/coverity.yml
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
name: Coverity Scan
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 0 01 * *' # On the 1st every month at midnight UTC
|
||||
|
||||
|
||||
# Automatically cancel any previous workflow on new push.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
latest:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Determine current repository
|
||||
id: "determine-repo"
|
||||
run: echo "repo=${GITHUB_REPOSITORY}" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- name: Download Coverity Build Tool
|
||||
run: |
|
||||
wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=capstone-next" -O cov-analysis-linux64.tar.gz
|
||||
mkdir cov-analysis-linux64
|
||||
tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64
|
||||
env:
|
||||
TOKEN: ${{ secrets.COVERITY_TOKEN }}
|
||||
|
||||
- name: Installing build dependencies
|
||||
run: |
|
||||
sudo apt-get --assume-yes install cmake
|
||||
|
||||
- name: Setup
|
||||
run: |
|
||||
cmake . -B build -DCAPSTONE_BUILD_CSTEST=ON
|
||||
|
||||
- name: Build with cov-build
|
||||
run: |
|
||||
export PATH=`pwd`/cov-analysis-linux64/bin:$PATH
|
||||
cov-build --dir cov-int cmake --build build
|
||||
tar czvf capstone.tgz cov-int
|
||||
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: capstone.tgz
|
||||
|
||||
- name: Submit the result to Coverity Scan
|
||||
run: |
|
||||
curl \
|
||||
--form token=$TOKEN \
|
||||
--form email=capstone.engine@gmail.com \
|
||||
--form file=@capstone.tgz \
|
||||
--form version=trunk \
|
||||
--form description="capstone" \
|
||||
https://scan.coverity.com/builds?project=capstone-next
|
||||
env:
|
||||
TOKEN: ${{ secrets.COVERITY_TOKEN }}
|
||||
if: steps.determine-repo.outputs.repo == 'capstone-engine/capstone'
|
23
thirdparty/capstone/.github/workflows/fuzz.yml
vendored
Normal file
23
thirdparty/capstone/.github/workflows/fuzz.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
name: CIFuzz
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
Fuzzing:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build Fuzzers
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'capstone'
|
||||
dry-run: false
|
||||
- name: Run Fuzzers
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'capstone'
|
||||
fuzz-seconds: 600
|
||||
dry-run: false
|
||||
- name: Upload Crash
|
||||
uses: actions/upload-artifact@v3
|
||||
if: failure()
|
||||
with:
|
||||
name: artifacts
|
||||
path: ./out/artifacts
|
20
thirdparty/capstone/.github/workflows/labeler.yml
vendored
Normal file
20
thirdparty/capstone/.github/workflows/labeler.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
name: "Pull Request Labeler"
|
||||
on:
|
||||
- pull_request_target
|
||||
|
||||
# Automatically cancel any previous workflow on new push.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
triage:
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/labeler@v4
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
90
thirdparty/capstone/.github/workflows/python-publish-release.yml
vendored
Normal file
90
thirdparty/capstone/.github/workflows/python-publish-release.yml
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
name: RELEASE BUILD - PyPI 📦 Distribution
|
||||
|
||||
on: [push, pull_request, release, workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
build_wheels:
|
||||
name: Build wheels on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up MSVC x64
|
||||
if: matrix.os == 'windows-latest'
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Set up QEMU
|
||||
if: runner.os == 'Linux'
|
||||
uses: docker/setup-qemu-action@v3
|
||||
with:
|
||||
platforms: all
|
||||
|
||||
- name: Build wheels
|
||||
uses: pypa/cibuildwheel@v2.20.0
|
||||
env:
|
||||
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
|
||||
CIBW_ARCHS_LINUX: "x86_64 i686 aarch64" # ppc64le s390x really slow
|
||||
CIBW_ARCHS_WINDOWS: "AMD64" # ARM64 Seems ARM64 will rebuild amd64 wheel for unknow reason.
|
||||
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*"
|
||||
CIBW_SKIP: ""
|
||||
with:
|
||||
package-dir: bindings/python
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: ./wheelhouse/*.whl
|
||||
name: artifacts-${{ matrix.os }}
|
||||
|
||||
- name: Check binaries (Windows)
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: |
|
||||
python3.exe suite/check_wheel_bin_arch.py ./wheelhouse/
|
||||
|
||||
- name: Check binaries (Unix)
|
||||
if: matrix.os != 'windows-latest'
|
||||
run: |
|
||||
./suite/check_wheel_bin_arch.py ./wheelhouse/
|
||||
|
||||
make_sdist:
|
||||
name: Make SDist
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Optional, use if you use setuptools_scm
|
||||
submodules: true # Optional, use if you have submodules
|
||||
|
||||
- name: Build SDist
|
||||
run: |
|
||||
cd bindings/python
|
||||
pipx run build --sdist
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: bindings/python/dist/*.tar.gz
|
||||
|
||||
publish:
|
||||
needs: [build_wheels]
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'release' && github.event.prerelease == false && github.event.action == 'published'
|
||||
permissions:
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
merge-multiple: true
|
||||
path: dist
|
||||
|
||||
- name: Show downloaded artifacts
|
||||
run: ls -laR dist
|
||||
|
||||
- name: Publish distribution 📦 to PyPI
|
||||
if: ${{ success() }}
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
verbose: true
|
||||
user: __token__
|
||||
password: ${{ secrets.pypi_pass }}
|
57
thirdparty/capstone/.github/workflows/python-tests.yml
vendored
Normal file
57
thirdparty/capstone/.github/workflows/python-tests.yml
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
name: Python Package CI
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-24.04, windows-2022, macOS-14]
|
||||
python-version: ["3.8", "3.12"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Setup MSVC
|
||||
if: runner.os == 'Windows'
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Build and install capstone
|
||||
run: pip install ./bindings/python
|
||||
|
||||
- name: Install cstest_py
|
||||
run: pip install ./bindings/python/cstest_py
|
||||
|
||||
- name: Run legacy tests
|
||||
run: python ./bindings/python/tests/test_all.py
|
||||
|
||||
- name: cstest_py integration tests
|
||||
run: |
|
||||
cd suite/cstest/test/
|
||||
python3 ./integration_tests.py cstest_py
|
||||
cd ../../../
|
||||
|
||||
- name: cstest_py MC
|
||||
run: |
|
||||
cstest_py tests/MC/
|
||||
|
||||
- name: cstest_py details
|
||||
run: |
|
||||
cstest_py tests/details/
|
||||
|
||||
- name: cstest_py issues
|
||||
run: |
|
||||
cstest_py tests/issues/
|
||||
|
||||
- name: cstest_py features
|
||||
run: |
|
||||
cstest_py tests/features/
|
152
thirdparty/capstone/.gitignore
vendored
Normal file
152
thirdparty/capstone/.gitignore
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
.DS_Store
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
|
||||
# Gcc dependency-tracking files
|
||||
*.d
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
# python
|
||||
bindings/python/build/
|
||||
bindings/python/capstone.egg-info/
|
||||
bindings/python/cstest_py/src/cstest_py.egg**
|
||||
bindings/cython/capstone.egg-info/
|
||||
*.pyc
|
||||
|
||||
# java
|
||||
bindings/java/capstone.jar
|
||||
|
||||
# ocaml
|
||||
bindings/ocaml/*.cmi
|
||||
bindings/ocaml/*.cmx
|
||||
bindings/ocaml/*.cmxa
|
||||
bindings/ocaml/*.mli
|
||||
bindings/ocaml/test
|
||||
bindings/ocaml/test_arm
|
||||
bindings/ocaml/test_aarch64
|
||||
bindings/ocaml/test_basic
|
||||
bindings/ocaml/test_mips
|
||||
bindings/ocaml/test_x86
|
||||
bindings/ocaml/test_detail
|
||||
bindings/ocaml/test_ppc
|
||||
bindings/ocaml/test_sparc
|
||||
bindings/ocaml/test_systemz
|
||||
bindings/ocaml/test_xcore
|
||||
bindings/ocaml/test_m680x
|
||||
|
||||
|
||||
# test binaries
|
||||
tests/test_basic
|
||||
tests/test_detail
|
||||
tests/test_iter
|
||||
tests/test_arm
|
||||
tests/test_aarch64
|
||||
tests/test_mips
|
||||
tests/test_x86
|
||||
tests/test_ppc
|
||||
tests/test_skipdata
|
||||
tests/test_sparc
|
||||
tests/test_systemz
|
||||
tests/test_xcore
|
||||
tests/test_tricore
|
||||
tests/*.static
|
||||
tests/test_customized_mnem
|
||||
tests/test_m68k
|
||||
tests/test_tms320c64x
|
||||
tests/test_m680x
|
||||
tests/test_evm
|
||||
tests/test_wasm
|
||||
tests/test_mos65xx
|
||||
tests/test_bpf
|
||||
tests/test_sh
|
||||
tests/test_riscv
|
||||
tests/test_sh
|
||||
tests/test_alpha
|
||||
tests/test_hppa
|
||||
|
||||
# regress binaries
|
||||
suite/regress/invalid_read_in_print_operand
|
||||
|
||||
# vim tmp file
|
||||
*.swp
|
||||
*~
|
||||
|
||||
capstone.pc
|
||||
|
||||
# local files
|
||||
_*
|
||||
|
||||
# freebsd ports: generated file with "make makesum" command
|
||||
packages/freebsd/ports/devel/capstone/distinfo
|
||||
|
||||
# VisualStudio
|
||||
ProjectUpgradeLog.log
|
||||
Debug/
|
||||
Release/
|
||||
ipch/
|
||||
build*/
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.suo
|
||||
*.user
|
||||
*.backup
|
||||
*.VC.db
|
||||
*.VC.opendb
|
||||
.vscode/
|
||||
|
||||
# CMake build directories
|
||||
build*/
|
||||
/build
|
||||
/out
|
||||
|
||||
# Xcode
|
||||
xcode/Capstone.xcodeproj/xcuserdata
|
||||
xcode/Capstone.xcodeproj/project.xcworkspace/xcuserdata
|
||||
|
||||
# IntelliJ IDEs
|
||||
.idea/
|
||||
|
||||
# suite/
|
||||
corpus-libFuzzer-capstone_fuzz_disasmnext-latest.zip
|
||||
test_arm_regression
|
||||
test_arm_regression.o
|
||||
fuzz_harness
|
||||
test_iter_benchmark
|
||||
test_file_benchmark
|
||||
fuzz_bindisasm
|
||||
fuzz_disasm
|
||||
fuzz_decode_platform
|
||||
capstone_get_setup
|
||||
suite/fuzz/corpus
|
||||
|
||||
*.s
|
||||
|
||||
cstool/cstool
|
||||
|
||||
# android
|
||||
android-ndk-*
|
||||
|
||||
# python virtual env
|
||||
.venv/
|
||||
|
||||
# Auto-sync files
|
||||
suite/auto-sync/src/autosync.egg-info
|
||||
|
||||
# clangd cache
|
||||
/.cache
|
3
thirdparty/capstone/.gitmodules
vendored
Normal file
3
thirdparty/capstone/.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "suite/auto-sync/vendor/tree-sitter-cpp"]
|
||||
path = suite/auto-sync/vendor/tree-sitter-cpp
|
||||
url = https://github.com/tree-sitter/tree-sitter-cpp.git
|
20
thirdparty/capstone/.reuse/dep5
vendored
Normal file
20
thirdparty/capstone/.reuse/dep5
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: CapstoneEngine
|
||||
Source: https://github.com/capstone-engine/capstone
|
||||
|
||||
Files: src/autosync/cpptranslator/Tests/test_config.json
|
||||
Copyright: 2022 Rot127 <unisono@quyllur.org>
|
||||
License: BSD-3
|
||||
|
||||
Files: src/autosync/cpptranslator/arch_config.json
|
||||
Copyright: 2022 Rot127 <unisono@quyllur.org>
|
||||
License: BSD-3
|
||||
|
||||
Files: src/autosync/cpptranslator/saved_patches.json
|
||||
Copyright: 2022 Rot127 <unisono@quyllur.org>
|
||||
License: BSD-3
|
||||
|
||||
Files: src/autosync/path_vars.json
|
||||
Copyright: 2022 Rot127 <unisono@quyllur.org>
|
||||
License: BSD-3
|
||||
|
9
thirdparty/capstone/.reuse/templates/license-template.jinja2
vendored
Normal file
9
thirdparty/capstone/.reuse/templates/license-template.jinja2
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{% for copyright_line in copyright_lines %}
|
||||
{{ copyright_line }}
|
||||
{% endfor %}
|
||||
{% for contributor_line in contributor_lines %}
|
||||
SPDX-FileContributor: {{ contributor_line }}
|
||||
{% endfor %}
|
||||
{% for expression in spdx_expressions %}
|
||||
SPDX-License-Identifier: {{ expression }}
|
||||
{% endfor %}
|
66
thirdparty/capstone/.travis.yml
vendored
Normal file
66
thirdparty/capstone/.travis.yml
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
language: cpp
|
||||
sudo: false
|
||||
before_install:
|
||||
- export LD_LIBRARY_PATH=`pwd`/tests/:$LD_LIBRARY_PATH
|
||||
before_script:
|
||||
- wget https://github.com/groundx/capstonefuzz/raw/master/corpus/corpus-libFuzzer-capstone_fuzz_disasmnext-latest.zip
|
||||
- unzip -q corpus-libFuzzer-capstone_fuzz_disasmnext-latest.zip -d suite/fuzz
|
||||
# TODO remove built in cmocka compile and use system cmocka (including brewfile) once xenial is default
|
||||
- git clone https://git.cryptomilk.org/projects/cmocka.git suite/cstest/cmocka
|
||||
- chmod +x suite/cstest/build_cstest.sh
|
||||
- if [[ ${TRAVIS_OS_NAME} = linux ]]; then export PATH="/usr/lib/llvm-9/bin:${PATH}"; fi
|
||||
script:
|
||||
- ./make.sh
|
||||
- make check
|
||||
- sudo make install
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp libcapstone.so.* bindings/python/libcapstone.so; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cp libcapstone.*.dylib bindings/python/libcapstone.dylib; fi
|
||||
- if [[ "$NOPYTEST" != "true" ]]; then cd bindings/python && make check; cd ../..; fi
|
||||
- if [[ "$NOPYTEST" != "true" ]]; then cd suite/cstest && ./build_cstest.sh; fi
|
||||
- if [[ "$NOPYTEST" != "true" ]]; then python cstest_report.py -D -t build/cstest -d ../MC; fi
|
||||
- if [[ "$NOPYTEST" != "true" ]]; then python cstest_report.py -D -t build/cstest -f issues.cs; fi
|
||||
- if [ -n "$QA_FUZZIT" ]; then suite/fuzz/fuzzit.sh; fi
|
||||
compiler:
|
||||
- clang
|
||||
- gcc
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
matrix:
|
||||
include:
|
||||
- name: xenial gcc
|
||||
os: linux
|
||||
dist: xenial
|
||||
compiler: gcc
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libcmocka-dev
|
||||
- name: xenial clang
|
||||
os: linux
|
||||
dist: xenial
|
||||
compiler: clang
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libcmocka-dev
|
||||
- name: fuzza
|
||||
env: ASAN_OPTIONS=detect_leaks=0 CXXFLAGS="-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize=fuzzer-no-link" CFLAGS="-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize=fuzzer-no-link" LDFLAGS="-fsanitize=address" NOPYTEST=true QA_FUZZIT=asan
|
||||
compiler: clang
|
||||
os: linux
|
||||
- name: fuzzm
|
||||
env: CXXFLAGS="-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=memory -fsanitize=fuzzer-no-link" CFLAGS="-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=memory -fsanitize=fuzzer-no-link" LDFLAGS="-fsanitize=memory" NOPYTEST=true QA_FUZZIT=msan
|
||||
compiler: clang
|
||||
os: linux
|
||||
- name: fuzzu
|
||||
env: CXXFLAGS="-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=undefined -fsanitize=fuzzer-no-link" CFLAGS="-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=undefined -fno-sanitize-recover=undefined,integer -fsanitize=fuzzer-no-link" LDFLAGS="-fsanitize=undefined" NOPYTEST=true QA_FUZZIT=ubsan
|
||||
compiler: clang
|
||||
os: linux
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- llvm-toolchain-trusty
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- clang-9
|
905
thirdparty/capstone/CMakeLists.txt
vendored
Normal file
905
thirdparty/capstone/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,905 @@
|
||||
# For MSVC_RUNTIME_LIBRARY
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
|
||||
message(FATAL_ERROR "In-tree builds are not supported. Run CMake from a separate directory: cmake -B build")
|
||||
endif()
|
||||
|
||||
# Detect whether capstone is compiled as top-level or a subdirectory
|
||||
set(PROJECT_IS_TOP_LEVEL OFF)
|
||||
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||
set(PROJECT_IS_TOP_LEVEL ON)
|
||||
|
||||
# Enable folder support
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
endif()
|
||||
|
||||
# https://cmake.org/cmake/help/latest/policy/CMP0042.html
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
|
||||
# https://cmake.org/cmake/help/latest/policy/CMP0091.html
|
||||
# Enable support for MSVC_RUNTIME_LIBRARY
|
||||
cmake_policy(SET CMP0091 NEW)
|
||||
|
||||
project(capstone
|
||||
VERSION 5.0
|
||||
)
|
||||
|
||||
set(UNIX_COMPILER_OPTIONS -Werror -Wall -Warray-bounds -Wshift-negative-value -Wreturn-type -Wformat -Wmissing-braces -Wunused-function -Warray-bounds -Wunused-variable -Wparentheses -Wint-in-bool-context -Wmisleading-indentation)
|
||||
|
||||
# maybe-uninitialized is only supported by newer versions of GCC.
|
||||
# Unfortunately, it is pretty unreliable and reports wrong results.
|
||||
# So we disable it for all compilers versions which support it.
|
||||
include(CheckCCompilerFlag)
|
||||
check_c_compiler_flag("-Wno-maybe-uninitialized" SUPPORTS_MU)
|
||||
check_c_compiler_flag("-Wshadow=local" SUPPORTS_SHADOWING)
|
||||
check_c_compiler_flag("-Wsometimes-uninitialized" SUPPORTS_SUNINIT)
|
||||
|
||||
if (SUPPORTS_MU)
|
||||
set(UNIX_COMPILER_OPTIONS ${UNIX_COMPILER_OPTIONS} -Wno-maybe-uninitialized)
|
||||
endif()
|
||||
|
||||
if (SUPPORTS_SHADOWING)
|
||||
set(UNIX_COMPILER_OPTIONS ${UNIX_COMPILER_OPTIONS} -Wshadow=local)
|
||||
endif()
|
||||
|
||||
if (SUPPORTS_SUNINIT)
|
||||
set(UNIX_COMPILER_OPTIONS ${UNIX_COMPILER_OPTIONS} -Wsometimes-uninitialized)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
add_compile_options(/W1 /w14189)
|
||||
else()
|
||||
add_compile_options(${UNIX_COMPILER_OPTIONS})
|
||||
endif()
|
||||
|
||||
|
||||
# to configure the options specify them in the command line or change them in the cmake UI.
|
||||
# Don't edit the makefile!
|
||||
option(BUILD_SHARED_LIBS "Build shared library" OFF)
|
||||
option(CAPSTONE_BUILD_STATIC_RUNTIME "Embed static runtime" ${BUILD_SHARED_LIBS})
|
||||
option(CAPSTONE_BUILD_MACOS_THIN "Disable universal2 builds on macOS" OFF)
|
||||
option(CAPSTONE_BUILD_DIET "Build diet library" OFF)
|
||||
option(CAPSTONE_BUILD_LEGACY_TESTS "Build legacy tests" ${PROJECT_IS_TOP_LEVEL})
|
||||
option(CAPSTONE_BUILD_CSTOOL "Build cstool" ${PROJECT_IS_TOP_LEVEL})
|
||||
option(CAPSTONE_BUILD_CSTEST "Build cstest" OFF)
|
||||
option(CAPSTONE_USE_DEFAULT_ALLOC "Use default memory allocation functions" ON)
|
||||
option(CAPSTONE_USE_ARCH_REGISTRATION "Use explicit architecture registration" OFF)
|
||||
option(CAPSTONE_ARCHITECTURE_DEFAULT "Whether architectures are enabled by default" ON)
|
||||
option(CAPSTONE_DEBUG "Whether to enable extra debug assertions" OFF)
|
||||
option(CAPSTONE_INSTALL "Generate install target" ${PROJECT_IS_TOP_LEVEL})
|
||||
option(ENABLE_ASAN "Enable address sanitizer" OFF)
|
||||
option(ENABLE_COVERAGE "Enable test coverage" OFF)
|
||||
|
||||
if (ENABLE_ASAN)
|
||||
message("Enabling ASAN")
|
||||
add_definitions(-DASAN_ENABLED)
|
||||
add_compile_options(-fsanitize=address)
|
||||
add_link_options(-fsanitize=address)
|
||||
endif()
|
||||
|
||||
if (ENABLE_COVERAGE)
|
||||
message("Enabling COVERAGE")
|
||||
add_compile_options(--coverage)
|
||||
add_link_options(--coverage)
|
||||
endif()
|
||||
|
||||
# If building for OSX it's best to allow CMake to handle building both architectures
|
||||
if(APPLE AND NOT CAPSTONE_BUILD_MACOS_THIN)
|
||||
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
|
||||
endif()
|
||||
|
||||
set(SUPPORTED_ARCHITECTURES ARM AARCH64 M68K MIPS PPC SPARC SYSZ XCORE X86 TMS320C64X M680X EVM MOS65XX WASM BPF RISCV SH TRICORE ALPHA HPPA LOONGARCH)
|
||||
set(SUPPORTED_ARCHITECTURE_LABELS ARM AARCH64 M68K MIPS PowerPC Sparc SystemZ XCore x86 TMS320C64x M680x EVM MOS65XX WASM BPF RISCV SH TriCore Alpha HPPA LoongArch)
|
||||
|
||||
# If building for OSX it's best to allow CMake to handle building both architectures
|
||||
if(APPLE AND NOT CAPSTONE_BUILD_MACOS_THIN)
|
||||
# The cibuildwheel on Github Actions sets this env variable
|
||||
# with the architecture flags it wants to build for.
|
||||
if(DEFINED ENV{ARCHFLAGS})
|
||||
if("$ENV{ARCHFLAGS}" STREQUAL "-arch arm64 -arch x86_64")
|
||||
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
|
||||
elseif("$ENV{ARCHFLAGS}" STREQUAL "-arch arm64")
|
||||
set(CMAKE_OSX_ARCHITECTURES "arm64")
|
||||
elseif("$ENV{ARCHFLAGS}" STREQUAL "-arch x86_64")
|
||||
set(CMAKE_OSX_ARCHITECTURES "x86_64")
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(LENGTH SUPPORTED_ARCHITECTURES count)
|
||||
math(EXPR count "${count}-1")
|
||||
# create options controlling whether support for a particular architecture is needed
|
||||
foreach(i RANGE ${count})
|
||||
list(GET SUPPORTED_ARCHITECTURES ${i} supported_architecture)
|
||||
list(GET SUPPORTED_ARCHITECTURE_LABELS ${i} supported_architecture_label)
|
||||
option("CAPSTONE_${supported_architecture}_SUPPORT" "${supported_architecture_label} support" ${CAPSTONE_ARCHITECTURE_DEFAULT})
|
||||
endforeach()
|
||||
|
||||
option(CAPSTONE_X86_REDUCE "x86 with reduce instruction sets to minimize library" OFF)
|
||||
option(CAPSTONE_X86_ATT_DISABLE "Disable x86 AT&T syntax" OFF)
|
||||
option(CAPSTONE_OSXKERNEL_SUPPORT "Support to embed Capstone into OS X Kernel extensions" OFF)
|
||||
|
||||
if(CAPSTONE_BUILD_DIET)
|
||||
add_definitions(-DCAPSTONE_DIET)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_USE_DEFAULT_ALLOC)
|
||||
add_definitions(-DCAPSTONE_USE_SYS_DYN_MEM)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_USE_ARCH_REGISTRATION)
|
||||
add_definitions(-DCAPSTONE_USE_ARCH_REGISTRATION)
|
||||
elseif(CAPSTONE_ARCHITECTURE_DEFAULT)
|
||||
# propagate architecture support variables to preprocessor
|
||||
foreach(supported_architecture ${SUPPORTED_ARCHITECTURES})
|
||||
set(option_name "CAPSTONE_${supported_architecture}_SUPPORT")
|
||||
if(${option_name})
|
||||
message("Enabling ${option_name}")
|
||||
add_definitions("-D${option_name}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_X86_REDUCE)
|
||||
add_definitions(-DCAPSTONE_X86_REDUCE)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_X86_ATT_DISABLE)
|
||||
add_definitions(-DCAPSTONE_X86_ATT_DISABLE)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_DEBUG)
|
||||
add_definitions(-DCAPSTONE_DEBUG)
|
||||
endif()
|
||||
|
||||
# Force static runtime libraries
|
||||
if(CAPSTONE_BUILD_STATIC_RUNTIME)
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
endif()
|
||||
|
||||
## sources
|
||||
set(SOURCES_ENGINE
|
||||
cs.c
|
||||
Mapping.c
|
||||
MCInst.c
|
||||
MCInstrDesc.c
|
||||
MCInstPrinter.c
|
||||
MCRegisterInfo.c
|
||||
SStream.c
|
||||
utils.c
|
||||
)
|
||||
set(HEADERS_ENGINE
|
||||
cs_simple_types.h
|
||||
cs_priv.h
|
||||
LEB128.h
|
||||
Mapping.h
|
||||
MathExtras.h
|
||||
MCDisassembler.h
|
||||
MCFixedLenDisassembler.h
|
||||
MCInst.h
|
||||
MCInstrDesc.h
|
||||
MCInstPrinter.h
|
||||
MCRegisterInfo.h
|
||||
SStream.h
|
||||
utils.h
|
||||
)
|
||||
|
||||
set(HEADERS_COMMON
|
||||
include/capstone/aarch64.h
|
||||
include/capstone/arm64.h
|
||||
include/capstone/arm.h
|
||||
include/capstone/capstone.h
|
||||
include/capstone/cs_operand.h
|
||||
include/capstone/evm.h
|
||||
include/capstone/wasm.h
|
||||
include/capstone/mips.h
|
||||
include/capstone/ppc.h
|
||||
include/capstone/x86.h
|
||||
include/capstone/sparc.h
|
||||
include/capstone/systemz.h
|
||||
include/capstone/xcore.h
|
||||
include/capstone/m68k.h
|
||||
include/capstone/tms320c64x.h
|
||||
include/capstone/m680x.h
|
||||
include/capstone/mos65xx.h
|
||||
include/capstone/bpf.h
|
||||
include/capstone/riscv.h
|
||||
include/capstone/sh.h
|
||||
include/capstone/tricore.h
|
||||
include/capstone/platform.h
|
||||
include/capstone/sh.h
|
||||
include/capstone/alpha.h
|
||||
include/capstone/hppa.h
|
||||
include/capstone/loongarch.h
|
||||
)
|
||||
|
||||
## architecture support
|
||||
if(CAPSTONE_ARM_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_ARM)
|
||||
set(SOURCES_ARM
|
||||
arch/ARM/ARMBaseInfo.c
|
||||
arch/ARM/ARMDisassembler.c
|
||||
arch/ARM/ARMDisassemblerExtension.c
|
||||
arch/ARM/ARMInstPrinter.c
|
||||
arch/ARM/ARMMapping.c
|
||||
arch/ARM/ARMModule.c
|
||||
)
|
||||
set(HEADERS_ARM
|
||||
arch/ARM/ARMAddressingModes.h
|
||||
arch/ARM/ARMBaseInfo.h
|
||||
arch/ARM/ARMDisassemblerExtension.h
|
||||
arch/ARM/ARMInstPrinter.h
|
||||
arch/ARM/ARMLinkage.h
|
||||
arch/ARM/ARMMapping.h
|
||||
arch/ARM/ARMGenAsmWriter.inc
|
||||
arch/ARM/ARMGenDisassemblerTables.inc
|
||||
arch/ARM/ARMGenInstrInfo.inc
|
||||
arch/ARM/ARMGenRegisterInfo.inc
|
||||
arch/ARM/ARMGenSubtargetInfo.inc
|
||||
arch/ARM/ARMGenCSFeatureName.inc
|
||||
arch/ARM/ARMGenCSMappingInsn.inc
|
||||
arch/ARM/ARMGenCSMappingInsnOp.inc
|
||||
arch/ARM/ARMGenCSMappingInsnName.inc
|
||||
arch/ARM/ARMGenSystemRegister.inc
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_AARCH64_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_AARCH64)
|
||||
set(SOURCES_AARCH64
|
||||
arch/AArch64/AArch64BaseInfo.c
|
||||
arch/AArch64/AArch64Disassembler.c
|
||||
arch/AArch64/AArch64DisassemblerExtension.c
|
||||
arch/AArch64/AArch64InstPrinter.c
|
||||
arch/AArch64/AArch64Mapping.c
|
||||
arch/AArch64/AArch64Module.c
|
||||
)
|
||||
set(HEADERS_AARCH64
|
||||
arch/AArch64/AArch64AddressingModes.h
|
||||
arch/AArch64/AArch64BaseInfo.h
|
||||
arch/AArch64/AArch64DisassemblerExtension.h
|
||||
arch/AArch64/AArch64InstPrinter.h
|
||||
arch/AArch64/AArch64Linkage.h
|
||||
arch/AArch64/AArch64Mapping.h
|
||||
arch/AArch64/AArch64GenAsmWriter.inc
|
||||
arch/AArch64/AArch64GenDisassemblerTables.inc
|
||||
arch/AArch64/AArch64GenInstrInfo.inc
|
||||
arch/AArch64/AArch64GenRegisterInfo.inc
|
||||
arch/AArch64/AArch64GenRegisterName.inc
|
||||
arch/AArch64/AArch64GenSubtargetInfo.inc
|
||||
arch/AArch64/AArch64GenSystemOperands.inc
|
||||
arch/AArch64/AArch64GenCSMappingInsn.inc
|
||||
arch/AArch64/AArch64GenCSMappingInsnName.inc
|
||||
arch/AArch64/AArch64GenCSMappingInsnOp.inc
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_MIPS_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_MIPS)
|
||||
set(SOURCES_MIPS
|
||||
arch/Mips/MipsDisassembler.c
|
||||
arch/Mips/MipsInstPrinter.c
|
||||
arch/Mips/MipsMapping.c
|
||||
arch/Mips/MipsModule.c
|
||||
)
|
||||
set(HEADERS_MIPS
|
||||
arch/Mips/MipsDisassembler.h
|
||||
arch/Mips/MipsGenAsmWriter.inc
|
||||
arch/Mips/MipsGenDisassemblerTables.inc
|
||||
arch/Mips/MipsGenInstrInfo.inc
|
||||
arch/Mips/MipsGenRegisterInfo.inc
|
||||
arch/Mips/MipsGenSubtargetInfo.inc
|
||||
arch/Mips/MipsInstPrinter.h
|
||||
arch/Mips/MipsMapping.h
|
||||
arch/Mips/MipsMappingInsn.inc
|
||||
)
|
||||
set(HEADERS_MIPS
|
||||
arch/Mips/MipsDisassembler.h
|
||||
arch/Mips/MipsGenAsmWriter.inc
|
||||
arch/Mips/MipsGenDisassemblerTables.inc
|
||||
arch/Mips/MipsGenInstrInfo.inc
|
||||
arch/Mips/MipsGenRegisterInfo.inc
|
||||
arch/Mips/MipsGenSubtargetInfo.inc
|
||||
arch/Mips/MipsInstPrinter.h
|
||||
arch/Mips/MipsMapping.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_PPC_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_POWERPC)
|
||||
set(SOURCES_PPC
|
||||
arch/PowerPC/PPCDisassembler.c
|
||||
arch/PowerPC/PPCInstPrinter.c
|
||||
arch/PowerPC/PPCMapping.c
|
||||
arch/PowerPC/PPCModule.c
|
||||
)
|
||||
set(HEADERS_PPC
|
||||
arch/PowerPC/PPCInstrInfo.h
|
||||
arch/PowerPC/PPCInstPrinter.h
|
||||
arch/PowerPC/PPCLinkage.h
|
||||
arch/PowerPC/PPCMapping.h
|
||||
arch/PowerPC/PPCMCTargetDesc.h
|
||||
arch/PowerPC/PPCPredicates.h
|
||||
arch/PowerPC/PPCRegisterInfo.h
|
||||
arch/PowerPC/PPCGenAsmWriter.inc
|
||||
arch/PowerPC/PPCGenCSFeatureName.inc
|
||||
arch/PowerPC/PPCGenCSMappingInsn.inc
|
||||
arch/PowerPC/PPCGenCSMappingInsnOp.inc
|
||||
arch/PowerPC/PPCGenCSMappingInsnName.inc
|
||||
arch/PowerPC/PPCGenCSOpGroup.inc
|
||||
arch/PowerPC/PPCGenDisassemblerTables.inc
|
||||
arch/PowerPC/PPCGenInstrInfo.inc
|
||||
arch/PowerPC/PPCGenSubtargetInfo.inc
|
||||
arch/PowerPC/PPCGenRegisterInfo.inc
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_X86_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_X86)
|
||||
set(SOURCES_X86
|
||||
arch/X86/X86Disassembler.c
|
||||
arch/X86/X86DisassemblerDecoder.c
|
||||
arch/X86/X86IntelInstPrinter.c
|
||||
arch/X86/X86InstPrinterCommon.c
|
||||
arch/X86/X86Mapping.c
|
||||
arch/X86/X86Module.c
|
||||
)
|
||||
set(HEADERS_X86
|
||||
arch/X86/X86BaseInfo.h
|
||||
arch/X86/X86Disassembler.h
|
||||
arch/X86/X86DisassemblerDecoder.h
|
||||
arch/X86/X86DisassemblerDecoderCommon.h
|
||||
arch/X86/X86GenAsmWriter.inc
|
||||
arch/X86/X86GenAsmWriter1.inc
|
||||
arch/X86/X86GenAsmWriter1_reduce.inc
|
||||
arch/X86/X86GenAsmWriter_reduce.inc
|
||||
arch/X86/X86GenDisassemblerTables.inc
|
||||
arch/X86/X86GenDisassemblerTables_reduce.inc
|
||||
arch/X86/X86GenInstrInfo.inc
|
||||
arch/X86/X86GenInstrInfo_reduce.inc
|
||||
arch/X86/X86GenRegisterInfo.inc
|
||||
arch/X86/X86InstPrinter.h
|
||||
arch/X86/X86Mapping.h
|
||||
arch/X86/X86MappingInsn.inc
|
||||
arch/X86/X86MappingInsnOp.inc
|
||||
arch/X86/X86MappingInsnOp_reduce.inc
|
||||
arch/X86/X86MappingInsn_reduce.inc
|
||||
)
|
||||
set(HEADERS_X86
|
||||
arch/X86/X86BaseInfo.h
|
||||
arch/X86/X86Disassembler.h
|
||||
arch/X86/X86DisassemblerDecoder.h
|
||||
arch/X86/X86DisassemblerDecoderCommon.h
|
||||
arch/X86/X86GenAsmWriter.inc
|
||||
arch/X86/X86GenAsmWriter1.inc
|
||||
arch/X86/X86GenAsmWriter1_reduce.inc
|
||||
arch/X86/X86GenAsmWriter_reduce.inc
|
||||
arch/X86/X86GenDisassemblerTables.inc
|
||||
arch/X86/X86GenDisassemblerTables_reduce.inc
|
||||
arch/X86/X86GenInstrInfo.inc
|
||||
arch/X86/X86GenInstrInfo_reduce.inc
|
||||
arch/X86/X86GenRegisterInfo.inc
|
||||
arch/X86/X86InstPrinter.h
|
||||
arch/X86/X86Mapping.h
|
||||
)
|
||||
if(NOT CAPSTONE_BUILD_DIET)
|
||||
set(SOURCES_X86 ${SOURCES_X86} arch/X86/X86ATTInstPrinter.c)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_SPARC_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_SPARC)
|
||||
set(SOURCES_SPARC
|
||||
arch/Sparc/SparcDisassembler.c
|
||||
arch/Sparc/SparcInstPrinter.c
|
||||
arch/Sparc/SparcMapping.c
|
||||
arch/Sparc/SparcModule.c
|
||||
)
|
||||
set(HEADERS_SPARC
|
||||
arch/Sparc/Sparc.h
|
||||
arch/Sparc/SparcDisassembler.h
|
||||
arch/Sparc/SparcGenAsmWriter.inc
|
||||
arch/Sparc/SparcGenDisassemblerTables.inc
|
||||
arch/Sparc/SparcGenInstrInfo.inc
|
||||
arch/Sparc/SparcGenRegisterInfo.inc
|
||||
arch/Sparc/SparcGenSubtargetInfo.inc
|
||||
arch/Sparc/SparcInstPrinter.h
|
||||
arch/Sparc/SparcMapping.h
|
||||
arch/Sparc/SparcMappingInsn.inc
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_SYSZ_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_SYSZ)
|
||||
set(SOURCES_SYSZ
|
||||
arch/SystemZ/SystemZDisassembler.c
|
||||
arch/SystemZ/SystemZInstPrinter.c
|
||||
arch/SystemZ/SystemZMapping.c
|
||||
arch/SystemZ/SystemZModule.c
|
||||
arch/SystemZ/SystemZMCTargetDesc.c
|
||||
)
|
||||
set(HEADERS_SYSZ
|
||||
arch/SystemZ/SystemZDisassembler.h
|
||||
arch/SystemZ/SystemZGenAsmWriter.inc
|
||||
arch/SystemZ/SystemZGenDisassemblerTables.inc
|
||||
arch/SystemZ/SystemZGenInsnNameMaps.inc
|
||||
arch/SystemZ/SystemZGenInstrInfo.inc
|
||||
arch/SystemZ/SystemZGenRegisterInfo.inc
|
||||
arch/SystemZ/SystemZGenSubtargetInfo.inc
|
||||
arch/SystemZ/SystemZInstPrinter.h
|
||||
arch/SystemZ/SystemZMapping.h
|
||||
arch/SystemZ/SystemZMappingInsn.inc
|
||||
arch/SystemZ/SystemZMCTargetDesc.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_XCORE_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_XCORE)
|
||||
set(SOURCES_XCORE
|
||||
arch/XCore/XCoreDisassembler.c
|
||||
arch/XCore/XCoreInstPrinter.c
|
||||
arch/XCore/XCoreMapping.c
|
||||
arch/XCore/XCoreModule.c
|
||||
)
|
||||
set(HEADERS_XCORE
|
||||
arch/XCore/XCoreDisassembler.h
|
||||
arch/XCore/XCoreGenAsmWriter.inc
|
||||
arch/XCore/XCoreGenDisassemblerTables.inc
|
||||
arch/XCore/XCoreGenInstrInfo.inc
|
||||
arch/XCore/XCoreGenRegisterInfo.inc
|
||||
arch/XCore/XCoreInstPrinter.h
|
||||
arch/XCore/XCoreMapping.h
|
||||
arch/XCore/XCoreMappingInsn.inc
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_M68K_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_M68K)
|
||||
set(SOURCES_M68K
|
||||
arch/M68K/M68KDisassembler.c
|
||||
arch/M68K/M68KInstPrinter.c
|
||||
arch/M68K/M68KModule.c
|
||||
)
|
||||
set(HEADERS_M68K
|
||||
arch/M68K/M68KDisassembler.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_TMS320C64X_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_TMS320C64X)
|
||||
set(SOURCES_TMS320C64X
|
||||
arch/TMS320C64x/TMS320C64xDisassembler.c
|
||||
arch/TMS320C64x/TMS320C64xInstPrinter.c
|
||||
arch/TMS320C64x/TMS320C64xMapping.c
|
||||
arch/TMS320C64x/TMS320C64xModule.c
|
||||
)
|
||||
set(HEADERS_TMS320C64X
|
||||
arch/TMS320C64x/TMS320C64xDisassembler.h
|
||||
arch/TMS320C64x/TMS320C64xGenAsmWriter.inc
|
||||
arch/TMS320C64x/TMS320C64xGenDisassemblerTables.inc
|
||||
arch/TMS320C64x/TMS320C64xGenInstrInfo.inc
|
||||
arch/TMS320C64x/TMS320C64xGenRegisterInfo.inc
|
||||
arch/TMS320C64x/TMS320C64xInstPrinter.h
|
||||
arch/TMS320C64x/TMS320C64xMapping.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_M680X_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_M680X)
|
||||
set(SOURCES_M680X
|
||||
arch/M680X/M680XDisassembler.c
|
||||
arch/M680X/M680XInstPrinter.c
|
||||
arch/M680X/M680XModule.c
|
||||
)
|
||||
set(HEADERS_M680X
|
||||
arch/M680X/M680XInstPrinter.h
|
||||
arch/M680X/M680XDisassembler.h
|
||||
arch/M680X/M680XDisassemblerInternals.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_EVM_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_EVM)
|
||||
set(SOURCES_EVM
|
||||
arch/EVM/EVMDisassembler.c
|
||||
arch/EVM/EVMInstPrinter.c
|
||||
arch/EVM/EVMMapping.c
|
||||
arch/EVM/EVMModule.c
|
||||
)
|
||||
set(HEADERS_EVM
|
||||
arch/EVM/EVMDisassembler.h
|
||||
arch/EVM/EVMInstPrinter.h
|
||||
arch/EVM/EVMMapping.h
|
||||
arch/EVM/EVMMappingInsn.inc
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_WASM_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_WASM)
|
||||
set(SOURCES_WASM
|
||||
arch/WASM/WASMDisassembler.c
|
||||
arch/WASM/WASMInstPrinter.c
|
||||
arch/WASM/WASMMapping.c
|
||||
arch/WASM/WASMModule.c
|
||||
)
|
||||
set(HEADERS_WASM
|
||||
arch/WASM/WASMDisassembler.h
|
||||
arch/WASM/WASMInstPrinter.h
|
||||
arch/WASM/WASMMapping.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_MOS65XX_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_MOS65XX)
|
||||
set(SOURCES_MOS65XX
|
||||
arch/MOS65XX/MOS65XXModule.c
|
||||
arch/MOS65XX/MOS65XXDisassembler.c)
|
||||
set(HEADERS_SOURCES_MOS65XX
|
||||
arch/MOS65XX/MOS65XXDisassembler.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_BPF_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_BPF)
|
||||
set(SOURCES_BPF
|
||||
arch/BPF/BPFDisassembler.c
|
||||
arch/BPF/BPFInstPrinter.c
|
||||
arch/BPF/BPFMapping.c
|
||||
arch/BPF/BPFModule.c
|
||||
)
|
||||
set(HEADERS_BPF
|
||||
arch/BPF/BPFConstants.h
|
||||
arch/BPF/BPFDisassembler.h
|
||||
arch/BPF/BPFInstPrinter.h
|
||||
arch/BPF/BPFMapping.h
|
||||
arch/BPF/BPFModule.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_RISCV_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_RISCV)
|
||||
set(SOURCES_RISCV
|
||||
arch/RISCV/RISCVDisassembler.c
|
||||
arch/RISCV/RISCVInstPrinter.c
|
||||
arch/RISCV/RISCVMapping.c
|
||||
arch/RISCV/RISCVModule.c
|
||||
)
|
||||
set(HEADERS_RISCV
|
||||
arch/RISCV/RISCVBaseInfo.h
|
||||
arch/RISCV/RISCVDisassembler.h
|
||||
arch/RISCV/RISCVInstPrinter.h
|
||||
arch/RISCV/RISCVMapping.h
|
||||
arch/RISCV/RISCVModule.h
|
||||
arch/RISCV/RISCVGenAsmWriter.inc
|
||||
arch/RISCV/RISCVGenDisassemblerTables.inc
|
||||
arch/RISCV/RISCVGenInsnNameMaps.inc
|
||||
arch/RISCV/RISCVGenInstrInfo.inc
|
||||
arch/RISCV/RISCVGenRegisterInfo.inc
|
||||
arch/RISCV/RISCVGenSubtargetInfo.inc
|
||||
arch/RISCV/RISCVMappingInsn.inc
|
||||
arch/RISCV/RISCVMappingInsnOp.inc
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_SH_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_SH)
|
||||
set(SOURCES_SH
|
||||
arch/SH/SHDisassembler.c
|
||||
arch/SH/SHInstPrinter.c
|
||||
arch/SH/SHModule.c
|
||||
)
|
||||
set(HEADERS_SH
|
||||
arch/SH/SHDisassembler.h
|
||||
arch/SH/SHInstPrinter.h
|
||||
arch/SH/SHModule.h
|
||||
arch/SH/SHInsnTable.inc
|
||||
)
|
||||
endif()
|
||||
|
||||
if (CAPSTONE_TRICORE_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_TRICORE)
|
||||
set(SOURCES_TRICORE
|
||||
arch/TriCore/TriCoreDisassembler.c
|
||||
arch/TriCore/TriCoreInstPrinter.c
|
||||
arch/TriCore/TriCoreMapping.c
|
||||
arch/TriCore/TriCoreModule.c
|
||||
)
|
||||
set(HEADERS_TRICORE
|
||||
arch/TriCore/TriCoreDisassembler.h
|
||||
arch/TriCore/TriCoreLinkage.h
|
||||
arch/TriCore/TriCoreGenAsmWriter.inc
|
||||
arch/TriCore/TriCoreGenDisassemblerTables.inc
|
||||
arch/TriCore/TriCoreGenInstrInfo.inc
|
||||
arch/TriCore/TriCoreGenRegisterInfo.inc
|
||||
arch/TriCore/TriCoreMapping.h
|
||||
arch/TriCore/TriCoreModule.h
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (CAPSTONE_ALPHA_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_ALPHA)
|
||||
set(SOURCES_ALPHA
|
||||
arch/Alpha/AlphaDisassembler.c
|
||||
arch/Alpha/AlphaInstPrinter.c
|
||||
arch/Alpha/AlphaMapping.c
|
||||
arch/Alpha/AlphaModule.c
|
||||
)
|
||||
set(HEADERS_ALPHA
|
||||
arch/Alpha/AlphaDisassembler.h
|
||||
arch/Alpha/AlphaGenAsmWriter.inc
|
||||
arch/Alpha/AlphaGenDisassemblerTables.inc
|
||||
arch/Alpha/AlphaGenInstrInfo.inc
|
||||
arch/Alpha/AlphaGenRegisterInfo.inc
|
||||
arch/Alpha/AlphaLinkage.h
|
||||
arch/Alpha/AlphaMapping.h
|
||||
arch/Alpha/AlphaModule.h
|
||||
arch/Alpha/AlphaGenCSMappingInsnOp.inc
|
||||
arch/Alpha/AlphaGenCSMappingInsn.inc
|
||||
arch/Alpha/AlphaGenCSMappingInsnName.inc
|
||||
)
|
||||
endif ()
|
||||
|
||||
if(CAPSTONE_HPPA_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_HPPA)
|
||||
set(SOURCES_HPPA
|
||||
arch/HPPA/HPPADisassembler.c
|
||||
arch/HPPA/HPPAInstPrinter.c
|
||||
arch/HPPA/HPPAMapping.c
|
||||
arch/HPPA/HPPAModule.c
|
||||
)
|
||||
set(HEADERS_HPPA
|
||||
arch/HPPA/HPPAConstants.h
|
||||
arch/HPPA/HPPADisassembler.h
|
||||
arch/HPPA/HPPAInstPrinter.h
|
||||
arch/HPPA/HPPAMapping.h
|
||||
arch/HPPA/HPPAModule.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if (CAPSTONE_LOONGARCH_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_LOONGARCH)
|
||||
set(SOURCES_LOONGARCH
|
||||
arch/LoongArch/LoongArchDisassembler.c
|
||||
arch/LoongArch/LoongArchDisassemblerExtension.c
|
||||
arch/LoongArch/LoongArchInstPrinter.c
|
||||
arch/LoongArch/LoongArchMapping.c
|
||||
arch/LoongArch/LoongArchModule.c
|
||||
)
|
||||
set(HEADERS_LOONGARCH
|
||||
arch/LoongArch/LoongArchInstPrinter.h
|
||||
arch/LoongArch/LoongArchMapping.h
|
||||
arch/LoongArch/LoongArchModule.h
|
||||
arch/LoongArch/LoongArchLinkage.h
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (CAPSTONE_OSXKERNEL_SUPPORT)
|
||||
add_definitions(-DCAPSTONE_HAS_OSXKERNEL)
|
||||
endif()
|
||||
|
||||
set(ALL_SOURCES
|
||||
${SOURCES_ENGINE}
|
||||
${SOURCES_ARM}
|
||||
${SOURCES_AARCH64}
|
||||
${SOURCES_MIPS}
|
||||
${SOURCES_PPC}
|
||||
${SOURCES_X86}
|
||||
${SOURCES_SPARC}
|
||||
${SOURCES_SYSZ}
|
||||
${SOURCES_XCORE}
|
||||
${SOURCES_M68K}
|
||||
${SOURCES_TMS320C64X}
|
||||
${SOURCES_M680X}
|
||||
${SOURCES_EVM}
|
||||
${SOURCES_WASM}
|
||||
${SOURCES_MOS65XX}
|
||||
${SOURCES_BPF}
|
||||
${SOURCES_RISCV}
|
||||
${SOURCES_SH}
|
||||
${SOURCES_TRICORE}
|
||||
${SOURCES_ALPHA}
|
||||
${SOURCES_HPPA}
|
||||
${SOURCES_LOONGARCH}
|
||||
)
|
||||
|
||||
set(ALL_HEADERS
|
||||
${HEADERS_COMMON}
|
||||
${HEADERS_ENGINE}
|
||||
${HEADERS_ARM}
|
||||
${HEADERS_AARCH64}
|
||||
${HEADERS_MIPS}
|
||||
${HEADERS_PPC}
|
||||
${HEADERS_X86}
|
||||
${HEADERS_SPARC}
|
||||
${HEADERS_SYSZ}
|
||||
${HEADERS_XCORE}
|
||||
${HEADERS_M68K}
|
||||
${HEADERS_TMS320C64X}
|
||||
${HEADERS_M680X}
|
||||
${HEADERS_EVM}
|
||||
${HEADERS_WASM}
|
||||
${HEADERS_MOS65XX}
|
||||
${HEADERS_BPF}
|
||||
${HEADERS_RISCV}
|
||||
${HEADERS_SH}
|
||||
${HEADERS_TRICORE}
|
||||
${HEADERS_ALPHA}
|
||||
${HEADERS_HPPA}
|
||||
${HEADERS_LOONGARCH}
|
||||
)
|
||||
|
||||
## properties
|
||||
# version info
|
||||
set_property(GLOBAL PROPERTY VERSION ${PROJECT_VERSION})
|
||||
|
||||
## targets
|
||||
add_library(capstone ${ALL_SOURCES} ${ALL_HEADERS})
|
||||
add_library(capstone::capstone ALIAS capstone)
|
||||
target_include_directories(capstone PUBLIC
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
)
|
||||
set_property(TARGET capstone PROPERTY C_STANDARD 99)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(capstone PUBLIC CAPSTONE_SHARED)
|
||||
set_target_properties(capstone PROPERTIES
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Fuzzer if this is moved to it's own CMakeLists.txt (as it should be)
|
||||
# the OSS fuzzer build fails. And must be fixed.
|
||||
# Simply because it builds the fuzzer there again with hard-coded paths.
|
||||
# See: https://github.com/google/oss-fuzz/blob/master/projects/capstone/build.sh
|
||||
# and: https://github.com/capstone-engine/capstone/issues/2454
|
||||
add_executable(fuzz_disasm ${PROJECT_SOURCE_DIR}/suite/fuzz/onefile.c ${PROJECT_SOURCE_DIR}/suite/fuzz/fuzz_disasm.c ${PROJECT_SOURCE_DIR}/suite/fuzz/platform.c)
|
||||
target_link_libraries(fuzz_disasm PRIVATE capstone)
|
||||
|
||||
source_group("Source\\Engine" FILES ${SOURCES_ENGINE})
|
||||
source_group("Source\\ARM" FILES ${SOURCES_ARM})
|
||||
source_group("Source\\AARCH64" FILES ${SOURCES_AARCH64})
|
||||
source_group("Source\\Mips" FILES ${SOURCES_MIPS})
|
||||
source_group("Source\\PowerPC" FILES ${SOURCES_PPC})
|
||||
source_group("Source\\Sparc" FILES ${SOURCES_SPARC})
|
||||
source_group("Source\\SystemZ" FILES ${SOURCES_SYSZ})
|
||||
source_group("Source\\X86" FILES ${SOURCES_X86})
|
||||
source_group("Source\\XCore" FILES ${SOURCES_XCORE})
|
||||
source_group("Source\\M68K" FILES ${SOURCES_M68K})
|
||||
source_group("Source\\TMS320C64x" FILES ${SOURCES_TMS320C64X})
|
||||
source_group("Source\\M680X" FILES ${SOURCES_M680X})
|
||||
source_group("Source\\EVM" FILES ${SOURCES_EVM})
|
||||
source_group("Source\\WASM" FILES ${SOURCES_WASM})
|
||||
source_group("Source\\MOS65XX" FILES ${SOURCES_MOS65XX})
|
||||
source_group("Source\\BPF" FILES ${SOURCES_BPF})
|
||||
source_group("Source\\RISCV" FILES ${SOURCES_RISCV})
|
||||
source_group("Source\\SH" FILES ${SOURCES_SH})
|
||||
source_group("Source\\TriCore" FILES ${SOURCES_TRICORE})
|
||||
source_group("Source\\Alpha" FILES ${SOURCES_ALPHA})
|
||||
source_group("Source\\HPPA" FILES ${SOURCES_HPPA})
|
||||
source_group("Source\\LoongArch" FILES ${SOURCES_LOONGARCH})
|
||||
|
||||
source_group("Include\\Common" FILES ${HEADERS_COMMON})
|
||||
source_group("Include\\Engine" FILES ${HEADERS_ENGINE})
|
||||
source_group("Include\\ARM" FILES ${HEADERS_ARM})
|
||||
source_group("Include\\AARCH64" FILES ${HEADERS_AARCH64})
|
||||
source_group("Include\\Mips" FILES ${HEADERS_MIPS})
|
||||
source_group("Include\\PowerPC" FILES ${HEADERS_PPC})
|
||||
source_group("Include\\Sparc" FILES ${HEADERS_SPARC})
|
||||
source_group("Include\\SystemZ" FILES ${HEADERS_SYSZ})
|
||||
source_group("Include\\X86" FILES ${HEADERS_X86})
|
||||
source_group("Include\\XCore" FILES ${HEADERS_XCORE})
|
||||
source_group("Include\\M68K" FILES ${HEADERS_M68K})
|
||||
source_group("Include\\TMS320C64x" FILES ${HEADERS_TMS320C64X})
|
||||
source_group("Include\\M680X" FILES ${HEADERS_MC680X})
|
||||
source_group("Include\\EVM" FILES ${HEADERS_EVM})
|
||||
source_group("Include\\WASM" FILES ${HEADERS_WASM})
|
||||
source_group("Include\\MOS65XX" FILES ${HEADERS_MOS65XX})
|
||||
source_group("Include\\BPF" FILES ${HEADERS_BPF})
|
||||
source_group("Include\\RISCV" FILES ${HEADERS_RISCV})
|
||||
source_group("Include\\SH" FILES ${HEADERS_SH})
|
||||
source_group("Include\\TriCore" FILES ${HEADERS_TRICORE})
|
||||
source_group("Include\\Alpha" FILES ${HEADERS_ALPHA})
|
||||
source_group("Include\\HPPA" FILES ${HEADERS_HPPA})
|
||||
source_group("Include\\LoongArch" FILES ${HEADERS_LOONGARCH})
|
||||
|
||||
## installation
|
||||
if(CAPSTONE_INSTALL)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
install(FILES ${HEADERS_COMMON} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/capstone)
|
||||
install(FILES ${HEADERS_INC} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/capstone/inc)
|
||||
|
||||
# Support absolute installation paths (discussion: https://github.com/NixOS/nixpkgs/issues/144170)
|
||||
if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
|
||||
set(CAPSTONE_PKGCONFIG_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
|
||||
set(CAPSTONE_CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
|
||||
else()
|
||||
set(CAPSTONE_PKGCONFIG_INSTALL_LIBDIR "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
|
||||
set(CAPSTONE_CMAKE_INSTALL_LIBDIR "\${PACKAGE_PREFIX_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
||||
endif()
|
||||
if(IS_ABSOLUTE ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
set(CAPSTONE_PKGCONFIG_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
set(CAPSTONE_CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
else()
|
||||
set(CAPSTONE_PKGCONFIG_INSTALL_INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
set(CAPSTONE_CMAKE_INSTALL_INCLUDEDIR "\${PACKAGE_PREFIX_DIR}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
endif()
|
||||
|
||||
configure_file(capstone.pc.in ${CMAKE_BINARY_DIR}/capstone.pc @ONLY)
|
||||
install(FILES ${CMAKE_BINARY_DIR}/capstone.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
set(CAPSTONE_CMAKE_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/capstone")
|
||||
configure_package_config_file(
|
||||
capstone-config.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/capstone-config.cmake
|
||||
INSTALL_DESTINATION ${CAPSTONE_CMAKE_CONFIG_INSTALL_DIR}
|
||||
)
|
||||
write_basic_package_version_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/capstone-config-version.cmake
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/capstone-config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/capstone-config-version.cmake"
|
||||
DESTINATION ${CAPSTONE_CMAKE_CONFIG_INSTALL_DIR}
|
||||
)
|
||||
|
||||
install(TARGETS capstone
|
||||
EXPORT capstone-targets
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
|
||||
install(EXPORT capstone-targets
|
||||
NAMESPACE capstone::
|
||||
DESTINATION ${CAPSTONE_CMAKE_CONFIG_INSTALL_DIR}
|
||||
)
|
||||
|
||||
# uninstall target
|
||||
if(NOT TARGET UNINSTALL)
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY
|
||||
)
|
||||
add_custom_target(UNINSTALL COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
set_target_properties(UNINSTALL PROPERTIES
|
||||
FOLDER CMakePredefinedTargets
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_BUILD_CSTOOL)
|
||||
file(GLOB CSTOOL_SRC cstool/*.c)
|
||||
add_executable(cstool ${CSTOOL_SRC})
|
||||
target_link_libraries(cstool PRIVATE capstone)
|
||||
|
||||
if(CAPSTONE_INSTALL)
|
||||
install(TARGETS cstool EXPORT capstone-targets DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CAPSTONE_BUILD_CSTEST)
|
||||
enable_testing()
|
||||
set(CSTEST_DIR ${PROJECT_SOURCE_DIR}/suite/cstest)
|
||||
add_subdirectory(${CSTEST_DIR})
|
||||
|
||||
# Integration and unit tests
|
||||
set(TESTS_INTEGRATION_DIR ${PROJECT_SOURCE_DIR}/tests/integration)
|
||||
add_subdirectory(${TESTS_INTEGRATION_DIR})
|
||||
set(TESTS_UNIT_DIR ${PROJECT_SOURCE_DIR}/tests/unit)
|
||||
add_subdirectory(${TESTS_UNIT_DIR})
|
||||
|
||||
# Unit tests for auto-sync
|
||||
set(AUTO_SYNC_C_TEST_DIR ${PROJECT_SOURCE_DIR}/suite/auto-sync/c_tests/)
|
||||
add_subdirectory(${AUTO_SYNC_C_TEST_DIR})
|
||||
endif()
|
133
thirdparty/capstone/CMakePresets.json
vendored
Normal file
133
thirdparty/capstone/CMakePresets.json
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
{
|
||||
"version": 3,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "locations-base",
|
||||
"hidden": true,
|
||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||
"installDir": "${sourceDir}/out/install/${presetName}"
|
||||
},
|
||||
{
|
||||
"name": "warnings-base",
|
||||
"hidden": true,
|
||||
"warnings": {
|
||||
"dev": true,
|
||||
"deprecated": true,
|
||||
"systemVars": true
|
||||
},
|
||||
"errors": {
|
||||
"dev": true,
|
||||
"deprecated": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ninja",
|
||||
"hidden": true,
|
||||
"displayName": "Ninja",
|
||||
"generator": "Ninja Multi-Config",
|
||||
"cacheVariables": {
|
||||
"CMAKE_DEFAULT_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "x64",
|
||||
"hidden": true,
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-x64",
|
||||
"inherits": [ "ninja", "x64", "locations-base", "warnings-base" ],
|
||||
"condition": {"type": "equals", "lhs": "${hostSystemName}", "rhs": "Linux"}
|
||||
},
|
||||
{
|
||||
"name": "macos-x64",
|
||||
"inherits": [ "ninja", "x64", "locations-base", "warnings-base" ],
|
||||
"condition": {"type": "equals", "lhs": "${hostSystemName}", "rhs": "Darwin"}
|
||||
},
|
||||
{
|
||||
"name": "windows-x64",
|
||||
"inherits": [ "ninja", "x64", "locations-base", "warnings-base" ],
|
||||
"condition": {"type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows"}
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "build-linux",
|
||||
"configurePreset": "linux-x64",
|
||||
"nativeToolOptions": [ "-v" ],
|
||||
"condition": {"type": "equals", "lhs": "${hostSystemName}", "rhs": "Linux"}
|
||||
},
|
||||
{
|
||||
"name": "build-macos",
|
||||
"configurePreset": "macos-x64",
|
||||
"nativeToolOptions": [ "-v" ],
|
||||
"condition": {"type": "equals", "lhs": "${hostSystemName}", "rhs": "Darwin"}
|
||||
},
|
||||
{
|
||||
"name": "build-windows",
|
||||
"configurePreset": "windows-x64",
|
||||
"nativeToolOptions": [ "-v" ],
|
||||
"condition": {"type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows"}
|
||||
},
|
||||
{
|
||||
"name": "build-linux-release",
|
||||
"inherits": "build-linux",
|
||||
"configuration": "Release",
|
||||
"condition": {"type": "equals", "lhs": "${hostSystemName}", "rhs": "Linux"}
|
||||
},
|
||||
{
|
||||
"name": "build-macos-release",
|
||||
"inherits": "build-macos",
|
||||
"configuration": "Release",
|
||||
"condition": {"type": "equals", "lhs": "${hostSystemName}", "rhs": "Darwin"}
|
||||
},
|
||||
{
|
||||
"name": "build-windows-release",
|
||||
"inherits": "build-windows",
|
||||
"configuration": "Release",
|
||||
"condition": {"type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows"}
|
||||
},
|
||||
{
|
||||
"name": "install-linux",
|
||||
"configurePreset": "linux-x64",
|
||||
"inherits": "build-linux",
|
||||
"targets": [ "install" ],
|
||||
"condition": {"type": "equals", "lhs": "${hostSystemName}", "rhs": "Linux"}
|
||||
},
|
||||
{
|
||||
"name": "install-macos",
|
||||
"configurePreset": "macos-x64",
|
||||
"inherits": "build-macos",
|
||||
"targets": [ "install" ],
|
||||
"condition": {"type": "equals", "lhs": "${hostSystemName}", "rhs": "Darwin"}
|
||||
},
|
||||
{
|
||||
"name": "install-windows",
|
||||
"configurePreset": "windows-x64",
|
||||
"inherits": "build-windows",
|
||||
"targets": [ "install" ],
|
||||
"condition": {"type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows"}
|
||||
},
|
||||
{
|
||||
"name": "install-linux-release",
|
||||
"inherits": "install-linux",
|
||||
"configuration": "Release",
|
||||
"condition": {"type": "equals", "lhs": "${hostSystemName}", "rhs": "Linux"}
|
||||
},
|
||||
{
|
||||
"name": "install-macos-release",
|
||||
"inherits": "install-macos",
|
||||
"configuration": "Release",
|
||||
"condition": {"type": "equals", "lhs": "${hostSystemName}", "rhs": "Darwin"}
|
||||
},
|
||||
{
|
||||
"name": "install-windows-release",
|
||||
"inherits": "install-windows",
|
||||
"configuration": "Release",
|
||||
"condition": {"type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows"}
|
||||
}
|
||||
]
|
||||
}
|
131
thirdparty/capstone/COMPILE_CMAKE.TXT
vendored
Normal file
131
thirdparty/capstone/COMPILE_CMAKE.TXT
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
This documentation explains how to compile Capstone with CMake, focus on
|
||||
using Microsoft Visual C as the compiler.
|
||||
|
||||
To compile Capstone on Windows using Visual Studio, see COMPILE_MSVC.TXT.
|
||||
|
||||
*-*-*-*-*-*
|
||||
|
||||
This documentation requires CMake & Windows SDK or MS Visual Studio installed on
|
||||
your machine.
|
||||
|
||||
Get CMake for free from http://www.cmake.org.
|
||||
|
||||
|
||||
|
||||
(0) Tailor Capstone to your need.
|
||||
|
||||
Out of architectures supported by Capstone, if you just need several selected archs,
|
||||
run "cmake" with the unwanted archs disabled (set to 0) as followings.
|
||||
|
||||
- CAPSTONE_ARM_SUPPORT: support ARM. Run cmake with -DCAPSTONE_ARM_SUPPORT=0 to remove ARM.
|
||||
- CAPSTONE_AARCH64_SUPPORT: support AARCH64. Run cmake with -DCAPSTONE_AARCH64_SUPPORT=0 to remove AARCH64.
|
||||
- CAPSTONE_ALPHA_SUPPORT: support Alpha. Run cmake with -DCAPSTONE_ALPHA_SUPPORT=0 to remove Alpha.
|
||||
- CAPSTONE_HPPA_SUPPORT: support HPPA. Run cmake with -DCAPSTONE_HPPA_SUPPORT=0 to remove HPPA.
|
||||
- CAPSTONE_LOONGARCH_SUPPORT: support LoongArch. Run cmake with -DCAPSTONE_LOONGARCH_SUPPORT=0 to remove LoongArch.
|
||||
- CAPSTONE_M680X_SUPPORT: support M680X. Run cmake with -DCAPSTONE_M680X_SUPPORT=0 to remove M680X.
|
||||
- CAPSTONE_M68K_SUPPORT: support M68K. Run cmake with -DCAPSTONE_M68K_SUPPORT=0 to remove M68K.
|
||||
- CAPSTONE_MIPS_SUPPORT: support Mips. Run cmake with -DCAPSTONE_MIPS_SUPPORT=0 to remove Mips.
|
||||
- CAPSTONE_MOS65XX_SUPPORT: support MOS65XX. Run cmake with -DCAPSTONE_MOS65XX_SUPPORT=0 to remove MOS65XX.
|
||||
- CAPSTONE_PPC_SUPPORT: support PPC. Run cmake with -DCAPSTONE_PPC_SUPPORT=0 to remove PPC.
|
||||
- CAPSTONE_SPARC_SUPPORT: support Sparc. Run cmake with -DCAPSTONE_SPARC_SUPPORT=0 to remove Sparc.
|
||||
- CAPSTONE_SYSZ_SUPPORT: support SystemZ. Run cmake with -DCAPSTONE_SYSZ_SUPPORT=0 to remove SystemZ.
|
||||
- CAPSTONE_XCORE_SUPPORT: support XCore. Run cmake with -DCAPSTONE_XCORE_SUPPORT=0 to remove XCore.
|
||||
- CAPSTONE_TRICORE_SUPPORT: support TriCore. Run cmake with -DCAPSTONE_TRICORE_SUPPORT=0 to remove TriCore.
|
||||
- CAPSTONE_X86_SUPPORT: support X86. Run cmake with -DCAPSTONE_X86_SUPPORT=0 to remove X86.
|
||||
- CAPSTONE_TMS320C64X_SUPPORT: support TMS320C64X. Run cmake with -DCAPSTONE_TMS320C64X_SUPPORT=0 to remove TMS320C64X.
|
||||
- CAPSTONE_M680X_SUPPORT: support M680X. Run cmake with -DCAPSTONE_M680X_SUPPORT=0 to remove M680X.
|
||||
- CAPSTONE_EVM_SUPPORT: support EVM. Run cmake with -DCAPSTONE_EVM_SUPPORT=0 to remove EVM.
|
||||
- CAPSTONE_WASM_SUPPORT: support Web Assembly. Run cmake with -DCAPSTONE_WASM_SUPPORT=0 to remove WASM.
|
||||
- CAPSTONE_BPF_SUPPORT: support BPF. Run cmake with -DCAPSTONE_BPF_SUPPORT=0 to remove BPF.
|
||||
- CAPSTONE_RISCV_SUPPORT: support RISCV. Run cmake with -DCAPSTONE_RISCV_SUPPORT=0 to remove RISCV.
|
||||
- CAPSTONE_ARCHITECTURE_DEFAULT: Whether architectures are enabled by default.
|
||||
Set this of OFF with -DCAPSTONE_ARCHITECTURE_DEFAULT=OFF to disable all architectures by default.
|
||||
You can then enable them again with one of the CAPSTONE_<ARCH>_SUPPORT options.
|
||||
|
||||
By default, all architectures are compiled in. If you're building a static library that you intend to link into
|
||||
multiple consumers, and they have differing architecture requirements, you may want -DCAPSTONE_USE_ARCH_REGISTRATION=1
|
||||
and call cs_arch_register_*() for the architectures you need in each particular consumer. In this way you only pay
|
||||
footprint size for the architectures you're actually using in each consumer, without having to compile Capstone
|
||||
multiple times.
|
||||
|
||||
Besides, Capstone also allows some more customization via following macros.
|
||||
|
||||
- CAPSTONE_USE_SYS_DYN_MEM: change this to OFF to use your own dynamic memory management.
|
||||
- CAPSTONE_BUILD_DIET: change this to ON to make the binaries more compact.
|
||||
- CAPSTONE_X86_REDUCE: change this to ON to make X86 binary smaller.
|
||||
- CAPSTONE_X86_ATT_DISABLE: change this to ON to disable AT&T syntax on x86.
|
||||
- CAPSTONE_DEBUG: change this to ON to enable extra debug assertions.
|
||||
- CAPSTONE_BUILD_CSTEST: Build `cstest` in `suite/cstest/`. `cstest` requires `libyaml` on your system.
|
||||
- ENABLE_ASAN: Compiles Capstone with the address sanitizer.
|
||||
|
||||
By default, Capstone use system dynamic memory management, and both DIET and X86_REDUCE
|
||||
modes are disabled. To use your own memory allocations, turn ON both DIET &
|
||||
X86_REDUCE, run "cmake" with: -DCAPSTONE_USE_SYS_DYN_MEM=0 -DCAPSTONE_BUILD_DIET=1 -DCAPSTONE_X86_REDUCE=1
|
||||
|
||||
|
||||
For each option, refer to docs/README for more details.
|
||||
|
||||
|
||||
|
||||
(1) CMake allows you to generate different generators to build Capstone. Below is
|
||||
some examples on how to build Capstone on Windows with CMake.
|
||||
|
||||
(*) You can let CMake select a generator for you. Do:
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
|
||||
This last command is also where you can pass additional CMake configuration flags
|
||||
using `-D<key>=<value>`.
|
||||
For a debug build add `-DCMAKE_BUILD_TYPE=Debug`.
|
||||
To export `compile_commands.json` add `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON`.
|
||||
|
||||
Then to build use:
|
||||
|
||||
cmake --build . --config [Release/Debug]
|
||||
|
||||
|
||||
(*) To build Capstone using Nmake of Windows SDK, do:
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
..\nmake.bat
|
||||
|
||||
After this, find the samples test*.exe, capstone.lib & capstone.dll
|
||||
in the same directory.
|
||||
|
||||
|
||||
|
||||
(*) To build Capstone using Visual Studio, choose the generator accordingly to the
|
||||
version of Visual Studio on your machine. For example, with Visual Studio 2013, do:
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G "Visual Studio 12" ..
|
||||
|
||||
After this, find capstone.sln in the same directory. Open it with Visual Studio
|
||||
and build the solution including libraries & all test as usual.
|
||||
|
||||
|
||||
|
||||
(2) You can make sure the prior steps successfully worked by launching one of the
|
||||
testing binary (test*.exe).
|
||||
|
||||
(3) You can also enable just one specific architecture by passing the architecture name
|
||||
to either the cmake.sh or nmake.bat scripts. e.g.:
|
||||
|
||||
../cmake.sh x86
|
||||
|
||||
Will just target the x86 architecture. The list of available architectures is: ARM,
|
||||
AARCH64, M68K, MIPS, PowerPC, Sparc, SystemZ, XCore, x86, TMS320C64x, M680x, EVM, MOS65XX,
|
||||
WASM, BPF, RISCV, Alpha, HPPA, LoongArch.
|
||||
|
||||
(4) You can also create an installation image with cmake, by using the 'install' target.
|
||||
Use:
|
||||
|
||||
cmake --build . --config Release --target install
|
||||
|
||||
This will normally install an image in a default location (`C:\Program Files` on Windows),
|
||||
so it's good to explicitly set this location when configuring CMake. Use: `-DCMAKE_INSTALL_PREFIX=image`
|
||||
for instance, to put the installation in the 'image' subdirectory of the build directory.
|
215
thirdparty/capstone/COMPILE_MAKE.TXT
vendored
Normal file
215
thirdparty/capstone/COMPILE_MAKE.TXT
vendored
Normal file
@@ -0,0 +1,215 @@
|
||||
|
||||
# NOTICE
|
||||
|
||||
> Please be aware that the Makefile build is deprecated.
|
||||
> Use cmake instead.
|
||||
|
||||
<hr>
|
||||
|
||||
This documentation explains how to compile, install & run Capstone on MacOSX,
|
||||
Linux, *BSD & Solaris. We also show steps to cross-compile for Microsoft Windows.
|
||||
|
||||
To natively compile for Windows using Microsoft Visual Studio, see COMPILE_MSVC.TXT.
|
||||
|
||||
To compile using CMake, see COMPILE_CMAKE.TXT.
|
||||
|
||||
To compile using XCode on MacOSX, see xcode/README.md.
|
||||
|
||||
To compile for Windows CE (a.k.a, Windows Embedded Compact), see windowsce/COMPILE.md.
|
||||
|
||||
*-*-*-*-*-*
|
||||
|
||||
Capstone requires no prerequisite packages, so it is easy to compile & install.
|
||||
|
||||
|
||||
|
||||
(0) Tailor Capstone to your need.
|
||||
|
||||
Out of all architectures supported by Capstone, if you just need several
|
||||
selected archs, choose the ones you want to compile in by editing "config.mk"
|
||||
before going to next steps.
|
||||
|
||||
By default, all architectures are compiled.
|
||||
|
||||
The other way of customize Capstone without having to edit config.mk is to
|
||||
pass the desired options on the commandline to ./make.sh. Currently,
|
||||
Capstone supports 8 options, as followings.
|
||||
|
||||
- CAPSTONE_ARCHS: specify list of architectures to compiled in.
|
||||
- CAPSTONE_USE_SYS_DYN_MEM: change this if you have your own dynamic memory management.
|
||||
- CAPSTONE_DIET: use this to make the output binaries more compact.
|
||||
- CAPSTONE_X86_REDUCE: another option to make X86 binary smaller.
|
||||
- CAPSTONE_X86_ATT_DISABLE: disables AT&T syntax on x86.
|
||||
- CAPSTONE_STATIC: build static library.
|
||||
- CAPSTONE_SHARED: build dynamic (shared) library.
|
||||
- CAPSTONE_DEBUG: enable debug build supporting assert().
|
||||
|
||||
By default, Capstone uses system dynamic memory management, both DIET and X86_REDUCE
|
||||
modes are disable, and builds all the static & shared libraries.
|
||||
|
||||
To avoid editing config.mk for these customization, we can pass their values to
|
||||
make.sh, as followings.
|
||||
|
||||
$ CAPSTONE_ARCHS="arm aarch64 x86" CAPSTONE_USE_SYS_DYN_MEM=no CAPSTONE_DIET=yes CAPSTONE_X86_REDUCE=yes ./make.sh
|
||||
|
||||
NOTE: on commandline, put these values in front of ./make.sh, not after it.
|
||||
|
||||
For each option, refer to docs/README for more details.
|
||||
|
||||
|
||||
|
||||
(1) Compile from source
|
||||
|
||||
On *nix (such as MacOSX, Linux, *BSD, Solaris):
|
||||
|
||||
- To compile for current platform, run:
|
||||
|
||||
$ ./make.sh
|
||||
|
||||
- On 64-bit OS, run the command below to cross-compile Capstone for 32-bit binary:
|
||||
|
||||
$ ./make.sh nix32
|
||||
|
||||
|
||||
|
||||
(2) Install Capstone on *nix
|
||||
|
||||
To install Capstone, run:
|
||||
|
||||
$ sudo ./make.sh install
|
||||
|
||||
For FreeBSD/OpenBSD, where sudo is unavailable, run:
|
||||
|
||||
$ su; ./make.sh install
|
||||
|
||||
Users are then required to enter root password to copy Capstone into machine
|
||||
system directories.
|
||||
|
||||
Afterwards, run ./tests/test* to see the tests disassembling sample code.
|
||||
|
||||
|
||||
NOTE: The core framework installed by "./make.sh install" consist of
|
||||
following files:
|
||||
|
||||
/usr/include/capstone/arm.h
|
||||
/usr/include/capstone/arm64.h
|
||||
/usr/include/capstone/alpha.h
|
||||
/usr/include/capstone/bpf.h
|
||||
/usr/include/capstone/capstone.h
|
||||
/usr/include/capstone/evm.h
|
||||
/usr/include/capstone/hppa.h
|
||||
/usr/include/capstone/loongarch.h
|
||||
/usr/include/capstone/m680x.h
|
||||
/usr/include/capstone/m68k.h
|
||||
/usr/include/capstone/mips.h
|
||||
/usr/include/capstone/mos65xx.h
|
||||
/usr/include/capstone/platform.h
|
||||
/usr/include/capstone/ppc.h
|
||||
/usr/include/capstone/sparc.h
|
||||
/usr/include/capstone/systemz.h
|
||||
/usr/include/capstone/tms320c64x.h
|
||||
/usr/include/capstone/wasm.h
|
||||
/usr/include/capstone/x86.h
|
||||
/usr/include/capstone/xcore.h
|
||||
/usr/include/capstone/tricore.h
|
||||
/usr/lib/libcapstone.a
|
||||
/usr/lib/libcapstone.so (for Linux/*nix), or /usr/lib/libcapstone.dylib (OSX)
|
||||
|
||||
|
||||
|
||||
(3) Cross-compile for Windows from *nix
|
||||
|
||||
To cross-compile for Windows, Linux & gcc-mingw-w64-i686 (and also gcc-mingw-w64-x86-64
|
||||
for 64-bit binaries) are required.
|
||||
|
||||
- To cross-compile Windows 32-bit binary, simply run:
|
||||
|
||||
$ ./make.sh cross-win32
|
||||
|
||||
- To cross-compile Windows 64-bit binary, run:
|
||||
|
||||
$ ./make.sh cross-win64
|
||||
|
||||
Resulted files libcapstone.dll, libcapstone.dll.a & tests/test*.exe can then
|
||||
be used on Windows machine.
|
||||
|
||||
|
||||
|
||||
(4) Cross-compile for iOS from Mac OSX.
|
||||
|
||||
To cross-compile for iOS (iPhone/iPad/iPod), Mac OSX with XCode installed is required.
|
||||
|
||||
- To cross-compile for ArmV7 (iPod 4, iPad 1/2/3, iPhone4, iPhone4S), run:
|
||||
$ ./make.sh ios_armv7
|
||||
|
||||
- To cross-compile for ArmV7s (iPad 4, iPhone 5C, iPad mini), run:
|
||||
$ ./make.sh ios_armv7s
|
||||
|
||||
- To cross-compile for Arm64 (iPhone 5S, iPad mini Retina, iPad Air), run:
|
||||
$ ./make.sh ios_arm64
|
||||
|
||||
- To cross-compile for all iDevices (armv7 + armv7s + arm64), run:
|
||||
$ ./make.sh ios
|
||||
|
||||
Resulted files libcapstone.dylib, libcapstone.a & tests/test* can then
|
||||
be used on iOS devices.
|
||||
|
||||
|
||||
|
||||
(5) Cross-compile for Android
|
||||
|
||||
To cross-compile for Android (smartphone/tablet), Android NDK is required.
|
||||
NOTE: Only ARM and AARCH64 are currently supported.
|
||||
|
||||
$ NDK=/android/android-ndk-r10e ./make.sh cross-android arm
|
||||
or
|
||||
$ NDK=/android/android-ndk-r10e ./make.sh cross-android arm64
|
||||
|
||||
Resulted files libcapstone.so, libcapstone.a & tests/test* can then
|
||||
be used on Android devices.
|
||||
|
||||
|
||||
|
||||
(6) Compile on Windows with Cygwin
|
||||
|
||||
To compile under Cygwin gcc-mingw-w64-i686 or x86_64-w64-mingw32 run:
|
||||
|
||||
- To compile Windows 32-bit binary under Cygwin, run:
|
||||
|
||||
$ ./make.sh cygwin-mingw32
|
||||
|
||||
- To compile Windows 64-bit binary under Cygwin, run:
|
||||
|
||||
$ ./make.sh cygwin-mingw64
|
||||
|
||||
Resulted files libcapstone.dll, libcapstone.dll.a & tests/test*.exe can then
|
||||
be used on Windows machine.
|
||||
|
||||
|
||||
|
||||
(7) By default, "cc" (default C compiler on the system) is used as compiler.
|
||||
|
||||
- To use "clang" compiler instead, run the command below:
|
||||
|
||||
$ ./make.sh clang
|
||||
|
||||
- To use "gcc" compiler instead, run:
|
||||
|
||||
$ ./make.sh gcc
|
||||
|
||||
|
||||
|
||||
(8) To uninstall Capstone, run the command below:
|
||||
|
||||
$ sudo ./make.sh uninstall
|
||||
|
||||
|
||||
|
||||
(9) Language bindings
|
||||
|
||||
So far, Python, Ocaml & Java are supported by bindings in the main code.
|
||||
Look for the bindings under directory bindings/, and refer to README file
|
||||
of corresponding languages.
|
||||
|
||||
Community also provide bindings for C#, Go, Ruby, NodeJS, C++ & Vala. Links to
|
||||
these can be found at address http://capstone-engine.org/download.html
|
125
thirdparty/capstone/COMPILE_MSVC.TXT
vendored
Normal file
125
thirdparty/capstone/COMPILE_MSVC.TXT
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
This documentation explains how to compile Capstone on Windows using
|
||||
Microsoft Visual Studio version 2010 or newer.
|
||||
|
||||
To compile Capstone on *nix, see COMPILE_CMAKE.TXT
|
||||
|
||||
To compile Capstone with CMake, see COMPILE_CMAKE.TXT
|
||||
|
||||
*-*-*-*-*-*
|
||||
|
||||
Capstone requires no prerequisite packages with default configurations, so it is
|
||||
easy to compile & install. Open the Visual Studio solution "msvc/capstone.sln"
|
||||
and follow the instructions below.
|
||||
|
||||
NOTE: This requires Visual Studio 2017 or newer versions.
|
||||
|
||||
If you wish to embed Capstone in a kernel driver Windows Driver Kit 8.1 Update 1
|
||||
or newer versions are required.
|
||||
|
||||
|
||||
(0) Tailor Capstone to your need.
|
||||
|
||||
Out of 9 architectures supported by Capstone (Arm, Arm64, M68K, Mips, PPC,
|
||||
Sparc, SystemZ, X86 & XCore), if you just need several selected archs, choose
|
||||
the ones you want to compile in by opening Visual Studio solution "msvc\capstone.sln",
|
||||
then directly editing the projects "capstone_static" & "capstone_dll" for static
|
||||
and dynamic libraries, respectively. This must be done before going to the next
|
||||
steps.
|
||||
|
||||
In VisualStudio interface, modify the preprocessor definitions via
|
||||
"Project Properties" -> "Configuration Properties" -> "C/C++" -> "Preprocessor"
|
||||
to customize Capstone library, as followings.
|
||||
|
||||
- CAPSTONE_HAS_ARM: support ARM. Delete this to remove ARM support.
|
||||
- CAPSTONE_HAS_AARCH64: support AARCH64. Delete this to remove AARCH64 support.
|
||||
- CAPSTONE_HAS_ALPHA: support Alpha. Delete this to remove Alpha support.
|
||||
- CAPSTONE_HAS_HPPA: support HPPA. Delete this to remove HPPA support.
|
||||
- CAPSTONE_HAS_M68K: support M68K. Delete this to remove M68K support.
|
||||
- CAPSTONE_HAS_MIPS: support Mips. Delete this to remove Mips support.
|
||||
- CAPSTONE_HAS_POWERPC: support PPC. Delete this to remove PPC support.
|
||||
- CAPSTONE_HAS_SPARC: support Sparc. Delete this to remove Sparc support.
|
||||
- CAPSTONE_HAS_SYSZ: support SystemZ. Delete this to remove SystemZ support.
|
||||
- CAPSTONE_HAS_X86: support X86. Delete this to remove X86 support.
|
||||
- CAPSTONE_HAS_XCORE: support XCore. Delete this to remove XCore support.
|
||||
- CAPSTONE_HAS_TRICORE: support TriCore. Delete this to remove TriCore support.
|
||||
|
||||
By default, all 11 architectures are compiled in.
|
||||
|
||||
|
||||
Besides, Capstone also allows some more customization via following macros.
|
||||
|
||||
- CAPSTONE_USE_SYS_DYN_MEM: delete this to use your own dynamic memory management.
|
||||
- CAPSTONE_DIET_NO: rename this to "CAPSTONE_DIET" to make the binaries more compact.
|
||||
- CAPSTONE_X86_REDUCE_NO: rename this to "CAPSTONE_X86_REDUCE" to make X86 binary smaller.
|
||||
- CAPSTONE_X86_ATT_DISABLE_NO: rename this to "CAPSTONE_X86_ATT_DISABLE" to disable
|
||||
AT&T syntax on x86.
|
||||
|
||||
By default, Capstone use system dynamic memory management, and both DIET and X86_REDUCE
|
||||
modes are disable.
|
||||
|
||||
|
||||
For each option, refer to docs/README for more details.
|
||||
|
||||
|
||||
|
||||
(1) Compile from source on Windows with Visual Studio
|
||||
|
||||
- Choose the configuration and the platform you want: Release/Debug & Win32/Win64.
|
||||
- Build only the libraries, or the libraries along with all the tests.
|
||||
- "capstone_static_winkernel" is for compiling Capstone for a driver and
|
||||
"test_winkernel" is a test for a driver, and those are excluded from build by
|
||||
default. To compile them, open the Configuration Manager through the [Build]
|
||||
menu and check "Build" check boxes for those project.
|
||||
|
||||
|
||||
|
||||
(2) You can make sure the prior steps successfully worked by launching one of the
|
||||
testing binary (test*.exe).
|
||||
|
||||
The testing binary for a driver "test_winkernel.sys" is made up of all tests for
|
||||
supported architectures configured with the step (0) along side its own tests.
|
||||
Below explains a procedure to run the test driver and check test results.
|
||||
|
||||
On the x64 platform, the test signing mode has to be enabled to install the test
|
||||
driver. To do it, open the command prompt with the administrator privileges and
|
||||
type the following command, and then restart the system to activate the change:
|
||||
|
||||
>bcdedit /set testsigning on
|
||||
|
||||
Test results from the test driver is sent to kernel debug buffer. In order to
|
||||
see those results, download DebugView and run it with the administrator
|
||||
privileges, then check [Capture Kernel] through the [Capture] menu.
|
||||
|
||||
DebugView: https://technet.microsoft.com/en-us/sysinternals/debugview.aspx
|
||||
|
||||
To install and uninstall the driver, use the 'sc' command. For installing and
|
||||
executing test_winkernel.sys, execute the following commands with the
|
||||
administrator privileges:
|
||||
|
||||
>sc create test_winkernel type= kernel binPath= <full path to test_winkernel.sys>
|
||||
[SC] CreateService SUCCESS
|
||||
|
||||
>sc start test_winkernel
|
||||
[SC] StartService FAILED 995:
|
||||
|
||||
The I/O operation has been aborted because of either a thread exit or an application request.
|
||||
|
||||
To uninstall the driver, execute the following commands with the administrator
|
||||
privileges:
|
||||
|
||||
>sc delete test_winkernel
|
||||
>bcdedit /deletevalue testsigning
|
||||
|
||||
|
||||
|
||||
(3) Installing and building capstone via vcpkg
|
||||
|
||||
You can download and install capstone using the vcpkg(https://github.com/Microsoft/vcpkg) dependency manager:
|
||||
|
||||
git clone https://github.com/Microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.sh
|
||||
./vcpkg integrate install
|
||||
vcpkg install capstone
|
||||
|
||||
The capstone port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository(https://github.com/Microsoft/vcpkg).
|
92
thirdparty/capstone/CREDITS.TXT
vendored
Normal file
92
thirdparty/capstone/CREDITS.TXT
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
This file credits all the contributors of the Capstone engine project.
|
||||
|
||||
Key developers
|
||||
==============
|
||||
Nguyen Anh Quynh <aquynh -at- gmail.com>
|
||||
Chenxu Wu (kabeor) kabeor@qiling.io
|
||||
|
||||
|
||||
Past key developers
|
||||
===================
|
||||
Tan Sheng Di <shengdi -at- coseinc.com>
|
||||
- Bindings: Ruby
|
||||
|
||||
Ben Nagy <ben -at- coseinc.com>
|
||||
- Bindings: Ruby, Go
|
||||
|
||||
Dang Hoang Vu <dang.hvu -at- gmail.com>
|
||||
- Bindings: Java
|
||||
|
||||
|
||||
Beta testers (in random order)
|
||||
==============================
|
||||
Pancake
|
||||
Van Hauser
|
||||
FX of Phenoelit
|
||||
The Grugq, The Grugq <-- our hero for submitting the first ever patch!
|
||||
Isaac Dawson, Veracode Inc
|
||||
Patroklos Argyroudis, Census Inc. (http://census-labs.com)
|
||||
Attila Suszter
|
||||
Le Dinh Long
|
||||
Nicolas Ruff
|
||||
Gunther
|
||||
Alex Ionescu, Winsider Seminars & Solutions Inc.
|
||||
Snare
|
||||
Daniel Godas-Lopez
|
||||
Joshua J. Drake
|
||||
Edgar Barbosa
|
||||
Ralf-Philipp Weinmann
|
||||
Hugo Fortier
|
||||
Joxean Koret
|
||||
Bruce Dang
|
||||
Andrew Dunham
|
||||
|
||||
|
||||
Contributors (in no particular order)
|
||||
=====================================
|
||||
(Please let us know if you want to have your name here)
|
||||
|
||||
Ole André Vadla Ravnås (author of the 100th Pull-Request in our Github repo, thanks!)
|
||||
Axel "0vercl0k" Souchet (@0vercl0k) & Alex Ionescu: port to MSVC.
|
||||
Daniel Pistelli: Cmake support.
|
||||
Peter Hlavaty: integrate Capstone for Windows kernel drivers.
|
||||
Guillaume Jeanne: Ocaml binding.
|
||||
Martin Tofall, Obsidium Software: Optimize X86 performance & size + x86 encoding features.
|
||||
David Martínez Moreno & Hilko Bengen: Debian package.
|
||||
Félix Cloutier: Xcode project.
|
||||
Benoit Lecocq: OpenBSD package.
|
||||
Christophe Avoinne (Hlide): Improve memory management for better performance.
|
||||
Michael Cohen & Nguyen Tan Cong: Python module installer.
|
||||
Adel Gadllah, Francisco Alonso & Stefan Cornelius: RPM package.
|
||||
Felix Gröbert (Google): fuzz testing harness.
|
||||
Xipiter LLC: Capstone logo redesigned.
|
||||
Satoshi Tanda: Support Windows kernel driver.
|
||||
Tang Yuhang: cstool.
|
||||
Andrew Dutcher: better Python setup.
|
||||
Ruben Boonen: PowerShell binding.
|
||||
David Zimmer: VB6 binding.
|
||||
Philippe Antoine: Integration with oss-fuzz and various fixes.
|
||||
Bui Dinh Cuong: Explicit registers accessed for Arm64.
|
||||
Vincent Bénony: Explicit registers accessed for X86.
|
||||
Adel Gadllah, Francisco Alonso & Stefan Cornelius: RPM package.
|
||||
Felix Gröbert (Google): fuzz testing harness.
|
||||
Daniel Collin & Nicolas Planel: M68K architecture.
|
||||
Pranith Kumar: Explicit registers accessed for Arm64.
|
||||
Xipiter LLC: Capstone logo redesigned.
|
||||
Satoshi Tanda: Support Windows kernel driver.
|
||||
Koutheir Attouchi: Support for Windows CE.
|
||||
Fotis Loukos: TMS320C64x architecture.
|
||||
Wolfgang Schwotzer: M680X architecture.
|
||||
Philippe Antoine: Integration with oss-fuzz and various fixes.
|
||||
Stephen Eckels (stevemk14ebr): x86 encoding features
|
||||
Tong Yu(Spike) & Kai Jern, Lau (xwings): WASM architecture.
|
||||
Sebastian Macke: MOS65XX architecture
|
||||
Ilya Leoshkevich: SystemZ architecture improvements.
|
||||
Do Minh Tuan: Regression testing tool (cstest)
|
||||
david942j: BPF (both classic and extended) architecture.
|
||||
fanfuqiang & citypw & porto703 : RISCV architecture.
|
||||
Josh "blacktop" Maine: Arm64 architecture improvements.
|
||||
Finn Wilkinson: AArch64 update to Armv9.2-a (SME + SVE2 support)
|
||||
Billow & Sidneyp : TriCore architecture.
|
||||
Dmitry Sibirtsev: Alpha & HPPA architecture.
|
||||
Jiajie Chen & Yanglin Xun: LoongArch architecture.
|
1031
thirdparty/capstone/ChangeLog
vendored
Normal file
1031
thirdparty/capstone/ChangeLog
vendored
Normal file
File diff suppressed because it is too large
Load Diff
135
thirdparty/capstone/HACK.TXT
vendored
Normal file
135
thirdparty/capstone/HACK.TXT
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
Code structure
|
||||
--------------
|
||||
|
||||
Capstone source is organized as followings.
|
||||
|
||||
. <- core engine + README + COMPILE_CMAKE.TXT etc
|
||||
├── arch <- code handling disasm engine for each arch
|
||||
│ ├── AArch64 <- AArch64 engine
|
||||
│ ├── Alpha <- Alpha engine
|
||||
│ ├── ARM <- ARM engine
|
||||
│ ├── BPF <- Berkeley Packet Filter engine
|
||||
│ ├── EVM <- Ethereum engine
|
||||
│ ├── HPPA <- HPPA engine
|
||||
│ ├── M680X <- M680X engine
|
||||
│ ├── M68K <- M68K engine
|
||||
│ ├── Mips <- Mips engine
|
||||
│ ├── MOS65XX <- MOS65XX engine
|
||||
│ ├── PowerPC <- PowerPC engine
|
||||
│ ├── RISCV <- RISCV engine
|
||||
│ ├── SH <- SH engine
|
||||
│ ├── Sparc <- Sparc engine
|
||||
│ ├── SystemZ <- SystemZ engine
|
||||
│ ├── TMS320C64x <- TMS320C64x engine
|
||||
│ ├── TriCore <- TriCore engine
|
||||
│ └── WASM <- WASM engine
|
||||
├── bindings <- all bindings are under this dir
|
||||
│ ├── java <- Java bindings + test code
|
||||
│ ├── ocaml <- Ocaml bindings + test code
|
||||
│ └── python <- Python bindings + test code
|
||||
├── contrib <- Code contributed by community to help Capstone integration
|
||||
├── cstool <- Cstool
|
||||
├── docs <- Documentation
|
||||
├── include <- API headers in C language (*.h)
|
||||
├── msvc <- Microsoft Visual Studio support (for Windows compile)
|
||||
├── packages <- Packages for Linux/OSX/BSD.
|
||||
├── windows <- Windows support (for Windows kernel driver compile)
|
||||
├── suite <- Development test tools - for Capstone developers only
|
||||
├── tests <- Test code (in C language)
|
||||
└── xcode <- Xcode support (for MacOSX compile)
|
||||
|
||||
|
||||
Follow the instructions in COMPILE_CMAKE.TXT for how to compile and run test code.
|
||||
|
||||
Note: if you find some strange bugs, it is recommended to firstly clean
|
||||
the code and try to recompile/reinstall again. This can be done with:
|
||||
|
||||
$ ./make.sh
|
||||
$ sudo ./make.sh install
|
||||
|
||||
Then test Capstone with cstool, for example:
|
||||
|
||||
$ cstool x32 "90 91"
|
||||
|
||||
At the same time, for Java/Ocaml/Python bindings, be sure to always use
|
||||
the bindings coming with the core to avoid potential incompatibility issue
|
||||
with older versions.
|
||||
See bindings/<language>/README for detail instructions on how to compile &
|
||||
install the bindings.
|
||||
|
||||
|
||||
Coding style
|
||||
------------
|
||||
- C code follows Linux kernel coding style, using tabs for indentation.
|
||||
- Python code uses 4 spaces for indentation.
|
||||
|
||||
Updating an Architecture
|
||||
------------------------
|
||||
|
||||
The update tool for Capstone is called `auto-sync` and can be found in `suite/auto-sync`.
|
||||
|
||||
Not all architectures are supported yet.
|
||||
Run `suite/auto-sync/Updater/ASUpdater.py -h` to get a list of currently supported architectures.
|
||||
|
||||
The documentation how to update with `auto-sync` or refactor an architecture module
|
||||
can be found in [docs/AutoSync.md](docs/AutoSync.md).
|
||||
|
||||
If a module does not support `auto-sync` yet, it is highly recommended to refactor it
|
||||
instead of attempting to update it manually.
|
||||
Refactoring will take less time and updates it during the procedure.
|
||||
|
||||
The one exception is `x86`. In LLVM we use several emitter backends to generate C code.
|
||||
One of those LLVM backends (the `DecoderEmitter`) has two versions.
|
||||
One for `x86` and another for all the other architectures.
|
||||
Until now it was not worth it to refactoring this unique `x86` backend. So `x86` is not
|
||||
supported currently.
|
||||
|
||||
Adding an architecture
|
||||
----------------------
|
||||
|
||||
If your architecture is supported in LLVM or one of its forks, you can use `auto-sync` to
|
||||
add the new module.
|
||||
|
||||
<!-- TODO: Move this info to the auto-sync docs -->
|
||||
|
||||
Obviously, you first need to write all the logic and put it in a new directory arch/newarch
|
||||
Then, you have to modify other files.
|
||||
(You can look for one architecture such as EVM in these files to get what you need to do)
|
||||
|
||||
Integrate:
|
||||
- cs.c
|
||||
- cstool/cstool.c
|
||||
- cstool/cstool_newarch.c: print the architecture specific details
|
||||
- include/capstone/capstone.h
|
||||
- include/capstone/newarch.h: create this file to export all specifics about the new architecture
|
||||
|
||||
Compile:
|
||||
- CMakeLists.txt
|
||||
- Makefile
|
||||
- config.mk
|
||||
|
||||
Tests:
|
||||
- tests/Makefile
|
||||
- tests/test_basic.c
|
||||
- tests/test_iter.c
|
||||
- tests/test_newarch.c
|
||||
- suite/fuzz/platform.c: add the architecture and its modes to the list of fuzzed platforms
|
||||
- suite/capstone_get_setup.c
|
||||
- suite/MC/newarch/mode.mc: samples
|
||||
- suite/test_corpus.py: correspondence between architecture and mode as text and architecture number for fuzzing
|
||||
- suite/cstest/
|
||||
|
||||
Bindings:
|
||||
- bindings/Makefile
|
||||
- bindings/const_generator.py: add the header file and the architecture
|
||||
- bindings/python/Makefile
|
||||
- bindings/python/capstone/__init__.py
|
||||
- bindings/python/capstone/newarch.py: define the python structures
|
||||
- bindings/python/capstone/newarch_const.py: generate this file
|
||||
- bindings/python/test_newarch.py: create a basic decoding test
|
||||
- bindings/python/test_all.py
|
||||
|
||||
Docs:
|
||||
- README.md
|
||||
- HACK.txt
|
||||
- CREDITS.txt: add your name
|
38
thirdparty/capstone/LEB128.h
vendored
Normal file
38
thirdparty/capstone/LEB128.h
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
//===- llvm/Support/LEB128.h - [SU]LEB128 utility functions -----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file declares some utility functions for encoding SLEB128 and
|
||||
// ULEB128 values.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
|
||||
#ifndef CS_LLVM_SUPPORT_LEB128_H
|
||||
#define CS_LLVM_SUPPORT_LEB128_H
|
||||
|
||||
#include "include/capstone/capstone.h"
|
||||
|
||||
/// Utility function to decode a ULEB128 value.
|
||||
static inline uint64_t decodeULEB128(const uint8_t *p, unsigned *n)
|
||||
{
|
||||
const uint8_t *orig_p = p;
|
||||
uint64_t Value = 0;
|
||||
unsigned Shift = 0;
|
||||
do {
|
||||
Value += (uint64_t)(*p & 0x7f) << Shift;
|
||||
Shift += 7;
|
||||
} while (*p++ >= 128);
|
||||
if (n)
|
||||
*n = (unsigned)(p - orig_p);
|
||||
return Value;
|
||||
}
|
||||
|
||||
#endif // LLVM_SYSTEM_LEB128_H
|
31
thirdparty/capstone/LICENSES/LICENSE.TXT
vendored
Normal file
31
thirdparty/capstone/LICENSES/LICENSE.TXT
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
This is the software license for Capstone disassembly framework.
|
||||
Capstone has been designed & implemented by Nguyen Anh Quynh <aquynh@gmail.com>
|
||||
|
||||
See http://www.capstone-engine.org for further information.
|
||||
|
||||
Copyright (c) 2013, COSEINC.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the developer(s) nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
11
thirdparty/capstone/LICENSES/LICENSE_BSD_3_CLAUSE.txt
vendored
Normal file
11
thirdparty/capstone/LICENSES/LICENSE_BSD_3_CLAUSE.txt
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
Copyright (c) <year> <owner>.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
71
thirdparty/capstone/LICENSES/LICENSE_LLVM.TXT
vendored
Normal file
71
thirdparty/capstone/LICENSES/LICENSE_LLVM.TXT
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
==============================================================================
|
||||
LLVM Release License
|
||||
==============================================================================
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 2003-2013 University of Illinois at Urbana-Champaign.
|
||||
All rights reserved.
|
||||
|
||||
Developed by:
|
||||
|
||||
LLVM Team
|
||||
|
||||
University of Illinois at Urbana-Champaign
|
||||
|
||||
http://llvm.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal with
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimers.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimers in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of the LLVM Team, University of Illinois at
|
||||
Urbana-Champaign, nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this Software without specific
|
||||
prior written permission.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
Copyrights and Licenses for Third Party Software Distributed with LLVM:
|
||||
==============================================================================
|
||||
The LLVM software contains code written by third parties. Such software will
|
||||
have its own individual LICENSE.TXT file in the directory in which it appears.
|
||||
This file will describe the copyrights, license, and restrictions which apply
|
||||
to that code.
|
||||
|
||||
The disclaimer of warranty in the University of Illinois Open Source License
|
||||
applies to all code in the LLVM Distribution, and nothing in any of the
|
||||
other licenses gives permission to use the names of the LLVM Team or the
|
||||
University of Illinois to endorse or promote products derived from this
|
||||
Software.
|
||||
|
||||
The following pieces of software have additional or alternate copyrights,
|
||||
licenses, and/or restrictions:
|
||||
|
||||
Program Directory
|
||||
------- ---------
|
||||
Autoconf llvm/autoconf
|
||||
llvm/projects/ModuleMaker/autoconf
|
||||
llvm/projects/sample/autoconf
|
||||
Google Test llvm/utils/unittest/googletest
|
||||
OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex}
|
||||
pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT}
|
||||
ARM contributions llvm/lib/Target/ARM/LICENSE.TXT
|
||||
md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h
|
14
thirdparty/capstone/MCDisassembler.h
vendored
Normal file
14
thirdparty/capstone/MCDisassembler.h
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
|
||||
#ifndef CS_MCDISASSEMBLER_H
|
||||
#define CS_MCDISASSEMBLER_H
|
||||
|
||||
typedef enum DecodeStatus {
|
||||
MCDisassembler_Fail = 0,
|
||||
MCDisassembler_SoftFail = 1,
|
||||
MCDisassembler_Success = 3,
|
||||
} DecodeStatus;
|
||||
|
||||
#endif
|
||||
|
32
thirdparty/capstone/MCFixedLenDisassembler.h
vendored
Normal file
32
thirdparty/capstone/MCFixedLenDisassembler.h
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
//===-- llvm/MC/MCFixedLenDisassembler.h - Decoder driver -------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Fixed length disassembler decoder state machine driver.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
|
||||
#ifndef CS_LLVM_MC_MCFIXEDLENDISASSEMBLER_H
|
||||
#define CS_LLVM_MC_MCFIXEDLENDISASSEMBLER_H
|
||||
|
||||
// Disassembler state machine opcodes.
|
||||
enum DecoderOps {
|
||||
MCD_OPC_ExtractField = 1, // OPC_ExtractField(uint8_t Start, uint8_t Len)
|
||||
MCD_OPC_FilterValue, // OPC_FilterValue(uleb128 Val, uint16_t NumToSkip)
|
||||
MCD_OPC_CheckField, // OPC_CheckField(uint8_t Start, uint8_t Len,
|
||||
// uleb128 Val, uint16_t NumToSkip)
|
||||
MCD_OPC_CheckPredicate, // OPC_CheckPredicate(uleb128 PIdx, uint16_t NumToSkip)
|
||||
MCD_OPC_Decode, // OPC_Decode(uleb128 Opcode, uleb128 DIdx)
|
||||
MCD_OPC_TryDecode, // OPC_TryDecode(uleb128 Opcode, uleb128 DIdx,
|
||||
// uint16_t NumToSkip)
|
||||
MCD_OPC_SoftFail, // OPC_SoftFail(uleb128 PMask, uleb128 NMask)
|
||||
MCD_OPC_Fail // OPC_Fail()
|
||||
};
|
||||
|
||||
#endif
|
313
thirdparty/capstone/MCInst.c
vendored
Normal file
313
thirdparty/capstone/MCInst.c
vendored
Normal file
@@ -0,0 +1,313 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
#if defined(CAPSTONE_HAS_OSXKERNEL)
|
||||
#include <Availability.h>
|
||||
#include <libkern/libkern.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "MCInstrDesc.h"
|
||||
#include "MCInst.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define MCINST_CACHE (ARR_SIZE(mcInst->Operands) - 1)
|
||||
|
||||
void MCInst_Init(MCInst *inst)
|
||||
{
|
||||
// unnecessary to initialize in loop . its expensive and inst->size should be honored
|
||||
inst->Operands[0].Kind = kInvalid;
|
||||
inst->Operands[0].ImmVal = 0;
|
||||
|
||||
inst->Opcode = 0;
|
||||
inst->OpcodePub = 0;
|
||||
inst->size = 0;
|
||||
inst->has_imm = false;
|
||||
inst->op1_size = 0;
|
||||
inst->ac_idx = 0;
|
||||
inst->popcode_adjust = 0;
|
||||
inst->assembly[0] = '\0';
|
||||
inst->wasm_data.type = WASM_OP_INVALID;
|
||||
inst->xAcquireRelease = 0;
|
||||
for (int i = 0; i < MAX_MC_OPS; ++i)
|
||||
inst->tied_op_idx[i] = -1;
|
||||
inst->isAliasInstr = false;
|
||||
inst->fillDetailOps = false;
|
||||
memset(&inst->hppa_ext, 0, sizeof(inst->hppa_ext));
|
||||
}
|
||||
|
||||
void MCInst_clear(MCInst *inst)
|
||||
{
|
||||
inst->size = 0;
|
||||
}
|
||||
|
||||
// does not free @Op
|
||||
void MCInst_insert0(MCInst *inst, int index, MCOperand *Op)
|
||||
{
|
||||
assert(index < MAX_MC_OPS);
|
||||
int i;
|
||||
|
||||
for(i = inst->size; i > index; i--)
|
||||
//memcpy(&(inst->Operands[i]), &(inst->Operands[i-1]), sizeof(MCOperand));
|
||||
inst->Operands[i] = inst->Operands[i-1];
|
||||
|
||||
inst->Operands[index] = *Op;
|
||||
inst->size++;
|
||||
}
|
||||
|
||||
void MCInst_setOpcode(MCInst *inst, unsigned Op)
|
||||
{
|
||||
inst->Opcode = Op;
|
||||
}
|
||||
|
||||
void MCInst_setOpcodePub(MCInst *inst, unsigned Op)
|
||||
{
|
||||
inst->OpcodePub = Op;
|
||||
}
|
||||
|
||||
unsigned MCInst_getOpcode(const MCInst *inst)
|
||||
{
|
||||
return inst->Opcode;
|
||||
}
|
||||
|
||||
unsigned MCInst_getOpcodePub(const MCInst *inst)
|
||||
{
|
||||
return inst->OpcodePub;
|
||||
}
|
||||
|
||||
MCOperand *MCInst_getOperand(MCInst *inst, unsigned i)
|
||||
{
|
||||
assert(i < MAX_MC_OPS);
|
||||
return &inst->Operands[i];
|
||||
}
|
||||
|
||||
unsigned MCInst_getNumOperands(const MCInst *inst)
|
||||
{
|
||||
return inst->size;
|
||||
}
|
||||
|
||||
// This addOperand2 function doesn't free Op
|
||||
void MCInst_addOperand2(MCInst *inst, MCOperand *Op)
|
||||
{
|
||||
assert(inst->size < MAX_MC_OPS);
|
||||
inst->Operands[inst->size] = *Op;
|
||||
|
||||
inst->size++;
|
||||
}
|
||||
|
||||
bool MCOperand_isValid(const MCOperand *op)
|
||||
{
|
||||
return op->Kind != kInvalid;
|
||||
}
|
||||
|
||||
bool MCOperand_isReg(const MCOperand *op)
|
||||
{
|
||||
return op->Kind == kRegister || op->MachineOperandType == kRegister;
|
||||
}
|
||||
|
||||
bool MCOperand_isImm(const MCOperand *op)
|
||||
{
|
||||
return op->Kind == kImmediate || op->MachineOperandType == kImmediate;
|
||||
}
|
||||
|
||||
bool MCOperand_isFPImm(const MCOperand *op)
|
||||
{
|
||||
return op->Kind == kFPImmediate;
|
||||
}
|
||||
|
||||
bool MCOperand_isDFPImm(const MCOperand *op)
|
||||
{
|
||||
return op->Kind == kDFPImmediate;
|
||||
}
|
||||
|
||||
bool MCOperand_isExpr(const MCOperand *op)
|
||||
{
|
||||
return op->Kind == kExpr;
|
||||
}
|
||||
|
||||
bool MCOperand_isInst(const MCOperand *op)
|
||||
{
|
||||
return op->Kind == kInst;
|
||||
}
|
||||
|
||||
/// getReg - Returns the register number.
|
||||
unsigned MCOperand_getReg(const MCOperand *op)
|
||||
{
|
||||
return op->RegVal;
|
||||
}
|
||||
|
||||
/// setReg - Set the register number.
|
||||
void MCOperand_setReg(MCOperand *op, unsigned Reg)
|
||||
{
|
||||
op->RegVal = Reg;
|
||||
}
|
||||
|
||||
int64_t MCOperand_getImm(const MCOperand *op)
|
||||
{
|
||||
return op->ImmVal;
|
||||
}
|
||||
|
||||
void MCOperand_setImm(MCOperand *op, int64_t Val)
|
||||
{
|
||||
op->ImmVal = Val;
|
||||
}
|
||||
|
||||
double MCOperand_getFPImm(const MCOperand *op)
|
||||
{
|
||||
return op->FPImmVal;
|
||||
}
|
||||
|
||||
void MCOperand_setFPImm(MCOperand *op, double Val)
|
||||
{
|
||||
op->FPImmVal = Val;
|
||||
}
|
||||
|
||||
MCOperand *MCOperand_CreateReg1(MCInst *mcInst, unsigned Reg)
|
||||
{
|
||||
MCOperand *op = &(mcInst->Operands[MCINST_CACHE]);
|
||||
|
||||
op->MachineOperandType = kRegister;
|
||||
op->Kind = kRegister;
|
||||
op->RegVal = Reg;
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
void MCOperand_CreateReg0(MCInst *mcInst, unsigned Reg)
|
||||
{
|
||||
MCOperand *op = &(mcInst->Operands[mcInst->size]);
|
||||
mcInst->size++;
|
||||
|
||||
op->MachineOperandType = kRegister;
|
||||
op->Kind = kRegister;
|
||||
op->RegVal = Reg;
|
||||
}
|
||||
|
||||
MCOperand *MCOperand_CreateImm1(MCInst *mcInst, int64_t Val)
|
||||
{
|
||||
MCOperand *op = &(mcInst->Operands[MCINST_CACHE]);
|
||||
|
||||
op->MachineOperandType = kImmediate;
|
||||
op->Kind = kImmediate;
|
||||
op->ImmVal = Val;
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
void MCOperand_CreateImm0(MCInst *mcInst, int64_t Val)
|
||||
{
|
||||
assert(mcInst->size < MAX_MC_OPS);
|
||||
MCOperand *op = &(mcInst->Operands[mcInst->size]);
|
||||
mcInst->size++;
|
||||
|
||||
op->MachineOperandType = kImmediate;
|
||||
op->Kind = kImmediate;
|
||||
op->ImmVal = Val;
|
||||
}
|
||||
|
||||
/// Check if any operand of the MCInstrDesc is predicable
|
||||
bool MCInst_isPredicable(const MCInstrDesc *MIDesc)
|
||||
{
|
||||
const MCOperandInfo *OpInfo = MIDesc->OpInfo;
|
||||
unsigned NumOps = MIDesc->NumOperands;
|
||||
for (unsigned i = 0; i < NumOps; ++i) {
|
||||
if (MCOperandInfo_isPredicate(&OpInfo[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Checks if tied operands exist in the instruction and sets
|
||||
/// - The writeback flag in detail
|
||||
/// - Saves the indices of the tied destination operands.
|
||||
void MCInst_handleWriteback(MCInst *MI, const MCInstrDesc *InstDescTable, unsigned tbl_size)
|
||||
{
|
||||
const MCInstrDesc *InstDesc = NULL;
|
||||
const MCOperandInfo *OpInfo = NULL;
|
||||
unsigned short NumOps = 0;
|
||||
if (MI->csh->arch == CS_ARCH_ARM) {
|
||||
// Uses old (pre LLVM 18) indexing method.
|
||||
InstDesc = &InstDescTable[MCInst_getOpcode(MI)];
|
||||
OpInfo = InstDescTable[MCInst_getOpcode(MI)].OpInfo;
|
||||
NumOps = InstDescTable[MCInst_getOpcode(MI)].NumOperands;
|
||||
} else {
|
||||
InstDesc = MCInstrDesc_get(MCInst_getOpcode(MI), InstDescTable, tbl_size);
|
||||
OpInfo = MCInstrDesc_get(MCInst_getOpcode(MI), InstDescTable, tbl_size)->OpInfo;
|
||||
NumOps = MCInstrDesc_get(MCInst_getOpcode(MI), InstDescTable, tbl_size)->NumOperands;
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < NumOps; ++i) {
|
||||
if (MCOperandInfo_isTiedToOp(&OpInfo[i])) {
|
||||
int idx = MCOperandInfo_getOperandConstraint(
|
||||
InstDesc, i,
|
||||
MCOI_TIED_TO);
|
||||
|
||||
if (idx == -1)
|
||||
continue;
|
||||
|
||||
if (i >= MAX_MC_OPS) {
|
||||
assert(0 &&
|
||||
"Maximum number of MC operands reached.");
|
||||
}
|
||||
MI->tied_op_idx[i] = idx;
|
||||
|
||||
if (MI->flat_insn->detail)
|
||||
MI->flat_insn->detail->writeback = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if operand with OpNum is tied by another operand
|
||||
/// (operand is tying destination).
|
||||
bool MCInst_opIsTied(const MCInst *MI, unsigned OpNum)
|
||||
{
|
||||
assert(OpNum < MAX_MC_OPS && "Maximum number of MC operands exceeded.");
|
||||
for (int i = 0; i < MAX_MC_OPS; ++i) {
|
||||
if (MI->tied_op_idx[i] == OpNum)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Check if operand with OpNum is tying another operand
|
||||
/// (operand is tying src).
|
||||
bool MCInst_opIsTying(const MCInst *MI, unsigned OpNum)
|
||||
{
|
||||
assert(OpNum < MAX_MC_OPS && "Maximum number of MC operands exceeded.");
|
||||
return MI->tied_op_idx[OpNum] != -1;
|
||||
}
|
||||
|
||||
/// Returns the value of the @MCInst operand at index @OpNum.
|
||||
uint64_t MCInst_getOpVal(MCInst *MI, unsigned OpNum)
|
||||
{
|
||||
assert(OpNum < MAX_MC_OPS);
|
||||
MCOperand *op = MCInst_getOperand(MI, OpNum);
|
||||
if (MCOperand_isReg(op))
|
||||
return MCOperand_getReg(op);
|
||||
else if (MCOperand_isImm(op))
|
||||
return MCOperand_getImm(op);
|
||||
else
|
||||
assert(0 && "Operand type not handled in this getter.");
|
||||
return MCOperand_getImm(op);
|
||||
}
|
||||
|
||||
void MCInst_setIsAlias(MCInst *MI, bool Flag) {
|
||||
assert(MI);
|
||||
MI->isAliasInstr = Flag;
|
||||
MI->flat_insn->is_alias = Flag;
|
||||
}
|
||||
|
||||
/// @brief Copies the relevant members of a temporary MCInst to
|
||||
/// the main MCInst. This is used if TryDecode was run on a temporary MCInst.
|
||||
/// @param MI The main MCInst
|
||||
/// @param TmpMI The temporary MCInst.
|
||||
void MCInst_updateWithTmpMI(MCInst *MI, MCInst *TmpMI) {
|
||||
MI->size = TmpMI->size;
|
||||
MI->Opcode = TmpMI->Opcode;
|
||||
assert(MI->size < MAX_MC_OPS);
|
||||
memcpy(MI->Operands, TmpMI->Operands, sizeof(MI->Operands[0]) * MI->size);
|
||||
}
|
178
thirdparty/capstone/MCInst.h
vendored
Normal file
178
thirdparty/capstone/MCInst.h
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
//===-- llvm/MC/MCInst.h - MCInst class -------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains the declaration of the MCInst and MCOperand classes, which
|
||||
// is the basic representation used to represent low-level machine code
|
||||
// instructions.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
|
||||
#ifndef CS_MCINST_H
|
||||
#define CS_MCINST_H
|
||||
|
||||
#include "include/capstone/capstone.h"
|
||||
#include "MCInstrDesc.h"
|
||||
#include "MCRegisterInfo.h"
|
||||
|
||||
typedef struct MCInst MCInst;
|
||||
typedef struct cs_struct cs_struct;
|
||||
typedef struct MCOperand MCOperand;
|
||||
typedef unsigned MCRegister;
|
||||
|
||||
/// MCOperand - Instances of this class represent operands of the MCInst class.
|
||||
/// This is a simple discriminated union.
|
||||
struct MCOperand {
|
||||
enum {
|
||||
kInvalid = 0, ///< Uninitialized.
|
||||
kRegister, ///< Register operand.
|
||||
kImmediate, ///< Immediate operand.
|
||||
kFPImmediate, ///< Floating-point immediate operand.
|
||||
kDFPImmediate, ///< Double-Floating-point immediate operand.
|
||||
kExpr, ///< Relocatable immediate operand.
|
||||
kInst ///< Sub-instruction operand.
|
||||
} MachineOperandType;
|
||||
unsigned char Kind;
|
||||
|
||||
union {
|
||||
uint64_t RegVal;
|
||||
int64_t ImmVal;
|
||||
double FPImmVal;
|
||||
};
|
||||
};
|
||||
|
||||
bool MCOperand_isValid(const MCOperand *op);
|
||||
|
||||
bool MCOperand_isReg(const MCOperand *op);
|
||||
|
||||
bool MCOperand_isImm(const MCOperand *op);
|
||||
|
||||
bool MCOperand_isFPImm(const MCOperand *op);
|
||||
|
||||
bool MCOperand_isDFPImm(const MCOperand *op);
|
||||
|
||||
bool MCOperand_isExpr(const MCOperand *op);
|
||||
|
||||
bool MCOperand_isInst(const MCOperand *op);
|
||||
|
||||
/// getReg - Returns the register number.
|
||||
unsigned MCOperand_getReg(const MCOperand *op);
|
||||
|
||||
/// setReg - Set the register number.
|
||||
void MCOperand_setReg(MCOperand *op, unsigned Reg);
|
||||
|
||||
int64_t MCOperand_getImm(const MCOperand *op);
|
||||
|
||||
void MCOperand_setImm(MCOperand *op, int64_t Val);
|
||||
|
||||
double MCOperand_getFPImm(const MCOperand *op);
|
||||
|
||||
void MCOperand_setFPImm(MCOperand *op, double Val);
|
||||
|
||||
const MCInst *MCOperand_getInst(const MCOperand *op);
|
||||
|
||||
void MCOperand_setInst(MCOperand *op, const MCInst *Val);
|
||||
|
||||
// create Reg operand in the next slot
|
||||
void MCOperand_CreateReg0(MCInst *inst, unsigned Reg);
|
||||
|
||||
// create Reg operand use the last-unused slot
|
||||
MCOperand *MCOperand_CreateReg1(MCInst *inst, unsigned Reg);
|
||||
|
||||
// create Imm operand in the next slot
|
||||
void MCOperand_CreateImm0(MCInst *inst, int64_t Val);
|
||||
|
||||
// create Imm operand in the last-unused slot
|
||||
MCOperand *MCOperand_CreateImm1(MCInst *inst, int64_t Val);
|
||||
|
||||
#define MAX_MC_OPS 48
|
||||
|
||||
/// MCInst - Instances of this class represent a single low-level machine
|
||||
/// instruction.
|
||||
struct MCInst {
|
||||
unsigned OpcodePub; // public opcode (<arch>_INS_yyy in header files <arch>.h)
|
||||
uint8_t size; // number of operands
|
||||
bool has_imm; // indicate this instruction has an X86_OP_IMM operand - used for ATT syntax
|
||||
uint8_t op1_size; // size of 1st operand - for X86 Intel syntax
|
||||
unsigned Opcode; // private opcode
|
||||
MCOperand Operands[MAX_MC_OPS];
|
||||
cs_insn *flat_insn; // insn to be exposed to public
|
||||
uint64_t address; // address of this insn
|
||||
cs_struct *csh; // save the main csh
|
||||
uint8_t x86opsize; // opsize for [mem] operand
|
||||
|
||||
// These flags could be used to pass some info from one target subcomponent
|
||||
// to another, for example, from disassembler to asm printer. The values of
|
||||
// the flags have any sense on target level only (e.g. prefixes on x86).
|
||||
unsigned flags;
|
||||
|
||||
// (Optional) instruction prefix, which can be up to 4 bytes.
|
||||
// A prefix byte gets value 0 when irrelevant.
|
||||
// This is copied from cs_x86 struct
|
||||
uint8_t x86_prefix[4];
|
||||
uint8_t imm_size; // immediate size for X86_OP_IMM operand
|
||||
bool writeback; // writeback for ARM
|
||||
int8_t tied_op_idx
|
||||
[MAX_MC_OPS]; ///< Tied operand indices. Index = Src op; Value: Dest op
|
||||
// operand access index for list of registers sharing the same access right (for ARM)
|
||||
uint8_t ac_idx;
|
||||
uint8_t popcode_adjust; // Pseudo X86 instruction adjust
|
||||
char assembly[8]; // for special instruction, so that we don't need printer
|
||||
unsigned char evm_data[32]; // for EVM PUSH operand
|
||||
cs_wasm_op wasm_data; // for WASM operand
|
||||
MCRegisterInfo *MRI;
|
||||
uint8_t xAcquireRelease; // X86 xacquire/xrelease
|
||||
bool isAliasInstr; // Flag if this MCInst is an alias.
|
||||
bool fillDetailOps; // If set, detail->operands gets filled.
|
||||
hppa_ext hppa_ext; ///< for HPPA operand. Contains info about modifiers and their effect on the instruction
|
||||
};
|
||||
|
||||
void MCInst_Init(MCInst *inst);
|
||||
|
||||
void MCInst_clear(MCInst *inst);
|
||||
|
||||
// do not free operand after inserting
|
||||
void MCInst_insert0(MCInst *inst, int index, MCOperand *Op);
|
||||
|
||||
void MCInst_setOpcode(MCInst *inst, unsigned Op);
|
||||
|
||||
unsigned MCInst_getOpcode(const MCInst*);
|
||||
|
||||
void MCInst_setOpcodePub(MCInst *inst, unsigned Op);
|
||||
|
||||
unsigned MCInst_getOpcodePub(const MCInst*);
|
||||
|
||||
MCOperand *MCInst_getOperand(MCInst *inst, unsigned i);
|
||||
|
||||
unsigned MCInst_getNumOperands(const MCInst *inst);
|
||||
|
||||
// This addOperand2 function doesn't free Op
|
||||
void MCInst_addOperand2(MCInst *inst, MCOperand *Op);
|
||||
|
||||
bool MCInst_isPredicable(const MCInstrDesc *MIDesc);
|
||||
|
||||
void MCInst_handleWriteback(MCInst *MI, const MCInstrDesc *InstDescTable, unsigned tbl_size);
|
||||
|
||||
bool MCInst_opIsTied(const MCInst *MI, unsigned OpNum);
|
||||
|
||||
bool MCInst_opIsTying(const MCInst *MI, unsigned OpNum);
|
||||
|
||||
uint64_t MCInst_getOpVal(MCInst *MI, unsigned OpNum);
|
||||
|
||||
void MCInst_setIsAlias(MCInst *MI, bool Flag);
|
||||
|
||||
static inline bool MCInst_isAlias(const MCInst *MI) {
|
||||
return MI->isAliasInstr;
|
||||
}
|
||||
|
||||
void MCInst_updateWithTmpMI(MCInst *MI, MCInst *TmpMI);
|
||||
|
||||
#endif
|
257
thirdparty/capstone/MCInstPrinter.c
vendored
Normal file
257
thirdparty/capstone/MCInstPrinter.c
vendored
Normal file
@@ -0,0 +1,257 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Rot127 <unisono@quyllur.org>, 2023 */
|
||||
|
||||
#include "MCInstPrinter.h"
|
||||
#include "cs_priv.h"
|
||||
#include <capstone/platform.h>
|
||||
|
||||
extern bool ARM_getFeatureBits(unsigned int mode, unsigned int feature);
|
||||
extern bool PPC_getFeatureBits(unsigned int mode, unsigned int feature);
|
||||
extern bool AArch64_getFeatureBits(unsigned int mode, unsigned int feature);
|
||||
extern bool TriCore_getFeatureBits(unsigned int mode, unsigned int feature);
|
||||
|
||||
static bool testFeatureBits(const MCInst *MI, uint32_t Value)
|
||||
{
|
||||
assert(MI && MI->csh);
|
||||
switch (MI->csh->arch) {
|
||||
default:
|
||||
assert(0 && "Not implemented for current arch.");
|
||||
return false;
|
||||
#ifdef CAPSTONE_HAS_ARM
|
||||
case CS_ARCH_ARM:
|
||||
return ARM_getFeatureBits(MI->csh->mode, Value);
|
||||
#endif
|
||||
#ifdef CAPSTONE_HAS_POWERPC
|
||||
case CS_ARCH_PPC:
|
||||
return PPC_getFeatureBits(MI->csh->mode, Value);
|
||||
#endif
|
||||
#ifdef CAPSTONE_HAS_AARCH64
|
||||
case CS_ARCH_AARCH64:
|
||||
return AArch64_getFeatureBits(MI->csh->mode, Value);
|
||||
#endif
|
||||
#ifdef CAPSTONE_HAS_TRICORE
|
||||
case CS_ARCH_TRICORE:
|
||||
return TriCore_getFeatureBits(MI->csh->mode, Value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static bool matchAliasCondition(MCInst *MI, const MCRegisterInfo *MRI,
|
||||
unsigned *OpIdx, const AliasMatchingData *M,
|
||||
const AliasPatternCond *C,
|
||||
bool *OrPredicateResult)
|
||||
{
|
||||
// Feature tests are special, they don't consume operands.
|
||||
if (C->Kind == AliasPatternCond_K_Feature)
|
||||
return testFeatureBits(MI, C->Value);
|
||||
if (C->Kind == AliasPatternCond_K_NegFeature)
|
||||
return !testFeatureBits(MI, C->Value);
|
||||
// For feature tests where just one feature is required in a list, set the
|
||||
// predicate result bit to whether the expression will return true, and only
|
||||
// return the real result at the end of list marker.
|
||||
if (C->Kind == AliasPatternCond_K_OrFeature) {
|
||||
*OrPredicateResult |= testFeatureBits(MI, C->Value);
|
||||
return true;
|
||||
}
|
||||
if (C->Kind == AliasPatternCond_K_OrNegFeature) {
|
||||
*OrPredicateResult |= !(testFeatureBits(MI, C->Value));
|
||||
return true;
|
||||
}
|
||||
if (C->Kind == AliasPatternCond_K_EndOrFeatures) {
|
||||
bool Res = *OrPredicateResult;
|
||||
*OrPredicateResult = false;
|
||||
return Res;
|
||||
}
|
||||
|
||||
// Get and consume an operand.
|
||||
MCOperand *Opnd = MCInst_getOperand(MI, *OpIdx);
|
||||
++(*OpIdx);
|
||||
|
||||
// Check the specific condition for the operand.
|
||||
switch (C->Kind) {
|
||||
default:
|
||||
assert(0 && "invalid kind");
|
||||
case AliasPatternCond_K_Imm:
|
||||
// Operand must be a specific immediate.
|
||||
return MCOperand_isImm(Opnd) &&
|
||||
MCOperand_getImm(Opnd) == (int32_t)C->Value;
|
||||
case AliasPatternCond_K_Reg:
|
||||
// Operand must be a specific register.
|
||||
return MCOperand_isReg(Opnd) && MCOperand_getReg(Opnd) == C->Value;
|
||||
case AliasPatternCond_K_TiedReg:
|
||||
// Operand must match the register of another operand.
|
||||
return MCOperand_isReg(Opnd) &&
|
||||
MCOperand_getReg(Opnd) ==
|
||||
MCOperand_getReg(MCInst_getOperand(MI, C->Value));
|
||||
case AliasPatternCond_K_RegClass:
|
||||
// Operand must be a register in this class. Value is a register class
|
||||
// id.
|
||||
return MCOperand_isReg(Opnd) &&
|
||||
MCRegisterClass_contains(
|
||||
MCRegisterInfo_getRegClass(MRI, C->Value),
|
||||
MCOperand_getReg(Opnd));
|
||||
case AliasPatternCond_K_Custom:
|
||||
// Operand must match some custom criteria.
|
||||
assert(M->ValidateMCOperand && "A custom validator should be set but isn't.");
|
||||
return M->ValidateMCOperand(Opnd, C->Value);
|
||||
case AliasPatternCond_K_Ignore:
|
||||
// Operand can be anything.
|
||||
return true;
|
||||
case AliasPatternCond_K_Feature:
|
||||
case AliasPatternCond_K_NegFeature:
|
||||
case AliasPatternCond_K_OrFeature:
|
||||
case AliasPatternCond_K_OrNegFeature:
|
||||
case AliasPatternCond_K_EndOrFeatures:
|
||||
assert(0 && "handled earlier");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Check if PatternsForOpcode is all zero.
|
||||
static inline bool validOpToPatter(const PatternsForOpcode *P)
|
||||
{
|
||||
return !(P->Opcode == 0 && P->PatternStart == 0 && P->NumPatterns == 0);
|
||||
}
|
||||
|
||||
const char *matchAliasPatterns(MCInst *MI, const AliasMatchingData *M)
|
||||
{
|
||||
// TODO Rewrite to C
|
||||
|
||||
// auto It = lower_bound(M.OpToPatterns, MI->getOpcode(),
|
||||
// [](const PatternsForOpcode &L, unsigned Opcode) {
|
||||
// return L.Opcode < Opcode;
|
||||
// });
|
||||
// if (It == M.OpToPatterns.end() || It->Opcode != MI->getOpcode())
|
||||
// return nullptr;
|
||||
|
||||
// Binary search by opcode. Return false if there are no aliases for this
|
||||
// opcode.
|
||||
unsigned MIOpcode = MI->Opcode;
|
||||
size_t i = 0;
|
||||
uint32_t PatternOpcode = M->OpToPatterns[i].Opcode;
|
||||
while (PatternOpcode < MIOpcode && validOpToPatter(&M->OpToPatterns[i]))
|
||||
PatternOpcode = M->OpToPatterns[++i].Opcode;
|
||||
if (PatternOpcode != MI->Opcode || !validOpToPatter(&M->OpToPatterns[i]))
|
||||
return NULL;
|
||||
|
||||
// // Try all patterns for this opcode.
|
||||
uint32_t AsmStrOffset = ~0U;
|
||||
const AliasPattern *Patterns = M->Patterns + M->OpToPatterns[i].PatternStart;
|
||||
for (const AliasPattern *P = Patterns;
|
||||
P != Patterns + M->OpToPatterns[i].NumPatterns; ++P) {
|
||||
// Check operand count first.
|
||||
if (MCInst_getNumOperands(MI) != P->NumOperands)
|
||||
return NULL;
|
||||
|
||||
// Test all conditions for this pattern.
|
||||
const AliasPatternCond *Conds = M->PatternConds + P->AliasCondStart;
|
||||
unsigned OpIdx = 0;
|
||||
bool OrPredicateResult = false;
|
||||
bool allMatch = true;
|
||||
for (const AliasPatternCond *C = Conds; C != Conds + P->NumConds; ++C) {
|
||||
if (!matchAliasCondition(MI, MI->MRI, &OpIdx, M, C, &OrPredicateResult)) {
|
||||
allMatch = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allMatch) {
|
||||
AsmStrOffset = P->AsmStrOffset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If no alias matched, don't print an alias.
|
||||
if (AsmStrOffset == ~0U)
|
||||
return NULL;
|
||||
|
||||
// Go to offset AsmStrOffset and use the null terminated string there. The
|
||||
// offset should point to the beginning of an alias string, so it should
|
||||
// either be zero or be preceded by a null byte.
|
||||
return M->AsmStrings + AsmStrOffset;
|
||||
}
|
||||
|
||||
// TODO Add functionality to toggle the flag.
|
||||
bool getUseMarkup(void) { return false; }
|
||||
|
||||
/// Utility functions to make adding mark ups simpler.
|
||||
const char *markup(const char *s)
|
||||
{
|
||||
static const char *no_markup = "";
|
||||
if (getUseMarkup())
|
||||
return s;
|
||||
else
|
||||
return no_markup;
|
||||
}
|
||||
|
||||
// binary search for encoding in IndexType array
|
||||
// return -1 if not found, or index if found
|
||||
unsigned int binsearch_IndexTypeEncoding(const struct IndexType *index, size_t size, uint16_t encoding)
|
||||
{
|
||||
// binary searching since the index is sorted in encoding order
|
||||
size_t left, right, m;
|
||||
|
||||
right = size - 1;
|
||||
|
||||
if (encoding < index[0].encoding || encoding > index[right].encoding)
|
||||
// not found
|
||||
return -1;
|
||||
|
||||
left = 0;
|
||||
|
||||
while(left <= right) {
|
||||
m = (left + right) / 2;
|
||||
if (encoding == index[m].encoding) {
|
||||
// LLVM actually uses lower_bound for the index table search
|
||||
// Here we need to check if a previous entry is of the same encoding
|
||||
// and return the first one.
|
||||
while (m > 0 && encoding == index[m - 1].encoding)
|
||||
--m;
|
||||
return m;
|
||||
}
|
||||
|
||||
if (encoding < index[m].encoding)
|
||||
right = m - 1;
|
||||
else
|
||||
left = m + 1;
|
||||
}
|
||||
|
||||
// not found
|
||||
return -1;
|
||||
}
|
||||
|
||||
// binary search for encoding in IndexTypeStr array
|
||||
// return -1 if not found, or index if found
|
||||
unsigned int binsearch_IndexTypeStrEncoding(const struct IndexTypeStr *index, size_t size, const char *name)
|
||||
{
|
||||
// binary searching since the index is sorted in encoding order
|
||||
size_t left, right, m;
|
||||
|
||||
right = size - 1;
|
||||
|
||||
size_t str_left_cmp = strcmp(name, index[0].name);
|
||||
size_t str_right_cmp = strcmp(name, index[right].name);
|
||||
if (str_left_cmp < 0 || str_right_cmp > 0)
|
||||
// not found
|
||||
return -1;
|
||||
|
||||
left = 0;
|
||||
|
||||
while(left <= right) {
|
||||
m = (left + right) / 2;
|
||||
if (strcmp(name, index[m].name) == 0) {
|
||||
// LLVM actually uses lower_bound for the index table search
|
||||
// Here we need to check if a previous entry is of the same encoding
|
||||
// and return the first one.
|
||||
while (m > 0 && (strcmp(name, index[m - 1].name) == 0))
|
||||
--m;
|
||||
return m;
|
||||
}
|
||||
|
||||
if (strcmp(name, index[m].name) < 0)
|
||||
right = m - 1;
|
||||
else
|
||||
left = m + 1;
|
||||
}
|
||||
|
||||
// not found
|
||||
return -1;
|
||||
}
|
84
thirdparty/capstone/MCInstPrinter.h
vendored
Normal file
84
thirdparty/capstone/MCInstPrinter.h
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Rot127 <unisono@quyllur.org>, 2023 */
|
||||
|
||||
#ifndef CS_MCINSTPRINTER_H
|
||||
#define CS_MCINSTPRINTER_H
|
||||
|
||||
#include "MCInst.h"
|
||||
#include <assert.h>
|
||||
#include <capstone/platform.h>
|
||||
|
||||
/// Returned by getMnemonic() of the AsmPrinters.
|
||||
typedef struct {
|
||||
const char *first; // Mnemonic
|
||||
uint64_t second; // Bits
|
||||
} MnemonicBitsInfo;
|
||||
|
||||
/// Map from opcode to pattern list by binary search.
|
||||
typedef struct {
|
||||
uint32_t Opcode;
|
||||
uint16_t PatternStart;
|
||||
uint16_t NumPatterns;
|
||||
} PatternsForOpcode;
|
||||
|
||||
/// Data for each alias pattern. Includes feature bits, string, number of
|
||||
/// operands, and a variadic list of conditions to check.
|
||||
typedef struct {
|
||||
uint32_t AsmStrOffset;
|
||||
uint32_t AliasCondStart;
|
||||
uint8_t NumOperands;
|
||||
uint8_t NumConds;
|
||||
} AliasPattern;
|
||||
|
||||
typedef enum {
|
||||
AliasPatternCond_K_Feature, // Match only if a feature is enabled.
|
||||
AliasPatternCond_K_NegFeature, // Match only if a feature is disabled.
|
||||
AliasPatternCond_K_OrFeature, // Match only if one of a set of features is
|
||||
// enabled.
|
||||
AliasPatternCond_K_OrNegFeature, // Match only if one of a set of features
|
||||
// is disabled.
|
||||
AliasPatternCond_K_EndOrFeatures, // Note end of list of K_Or(Neg)?Features.
|
||||
AliasPatternCond_K_Ignore, // Match any operand.
|
||||
AliasPatternCond_K_Reg, // Match a specific register.
|
||||
AliasPatternCond_K_TiedReg, // Match another already matched register.
|
||||
AliasPatternCond_K_Imm, // Match a specific immediate.
|
||||
AliasPatternCond_K_RegClass, // Match registers in a class.
|
||||
AliasPatternCond_K_Custom, // Call custom matcher by index.
|
||||
} AliasPatternCond_CondKind;
|
||||
|
||||
typedef struct {
|
||||
AliasPatternCond_CondKind Kind;
|
||||
uint32_t Value;
|
||||
} AliasPatternCond;
|
||||
|
||||
typedef bool (*ValidateMCOperandFunc)(const MCOperand *MCOp, unsigned PredicateIndex);
|
||||
|
||||
/// Tablegenerated data structures needed to match alias patterns.
|
||||
typedef struct {
|
||||
const PatternsForOpcode *OpToPatterns;
|
||||
const AliasPattern *Patterns;
|
||||
const AliasPatternCond *PatternConds;
|
||||
const char *AsmStrings;
|
||||
const ValidateMCOperandFunc ValidateMCOperand;
|
||||
} AliasMatchingData;
|
||||
|
||||
const char *matchAliasPatterns(MCInst *MI, const AliasMatchingData *M);
|
||||
bool getUseMarkup(void);
|
||||
const char *markup(const char *s);
|
||||
|
||||
struct IndexType {
|
||||
uint16_t encoding;
|
||||
unsigned index;
|
||||
};
|
||||
|
||||
struct IndexTypeStr {
|
||||
const char *name;
|
||||
unsigned index;
|
||||
};
|
||||
|
||||
// binary search for encoding in IndexType array
|
||||
// return -1 if not found, or index if found
|
||||
unsigned int binsearch_IndexTypeEncoding(const struct IndexType *index, size_t size, uint16_t encoding);
|
||||
unsigned int binsearch_IndexTypeStrEncoding(const struct IndexTypeStr *index, size_t size, const char *name);
|
||||
|
||||
#endif // CS_MCINSTPRINTER_H
|
48
thirdparty/capstone/MCInstrDesc.c
vendored
Normal file
48
thirdparty/capstone/MCInstrDesc.c
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
|
||||
#include "MCInstrDesc.h"
|
||||
|
||||
/// isPredicate - Set if this is one of the operands that made up of
|
||||
/// the predicate operand that controls an isPredicable() instruction.
|
||||
bool MCOperandInfo_isPredicate(const MCOperandInfo *m)
|
||||
{
|
||||
return m->Flags & (1 << MCOI_Predicate);
|
||||
}
|
||||
|
||||
/// isOptionalDef - Set if this operand is a optional def.
|
||||
///
|
||||
bool MCOperandInfo_isOptionalDef(const MCOperandInfo *m)
|
||||
{
|
||||
return m->Flags & (1 << MCOI_OptionalDef);
|
||||
}
|
||||
|
||||
/// Checks if operand is tied to another one.
|
||||
bool MCOperandInfo_isTiedToOp(const MCOperandInfo *m)
|
||||
{
|
||||
if (m->Constraints & (1 << MCOI_TIED_TO))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Returns the value of the specified operand constraint if
|
||||
/// it is present. Returns -1 if it is not present.
|
||||
int MCOperandInfo_getOperandConstraint(const MCInstrDesc *InstrDesc,
|
||||
unsigned OpNum,
|
||||
MCOI_OperandConstraint Constraint)
|
||||
{
|
||||
const MCOperandInfo OpInfo = InstrDesc->OpInfo[OpNum];
|
||||
if (OpNum < InstrDesc->NumOperands &&
|
||||
(OpInfo.Constraints & (1 << Constraint))) {
|
||||
unsigned ValuePos = 4 + Constraint * 4;
|
||||
return (OpInfo.Constraints >> ValuePos) & 0xf;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// Returns the instruction description for the given MCInst opcode.
|
||||
/// Function should be called like:
|
||||
/// MCInstrDesc_get(MCInst_getOpcode(MI), ARCHInstDesc, ARR_SIZE(ARCHInstDesc));
|
||||
const MCInstrDesc *MCInstrDesc_get(unsigned opcode, const MCInstrDesc *table, unsigned tbl_size) {
|
||||
return &table[tbl_size - 1 - opcode];
|
||||
}
|
171
thirdparty/capstone/MCInstrDesc.h
vendored
Normal file
171
thirdparty/capstone/MCInstrDesc.h
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
//===-- llvm/MC/MCInstrDesc.h - Instruction Descriptors -*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file defines the MCOperandInfo and MCInstrDesc classes, which
|
||||
// are used to describe target instructions and their operands.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
|
||||
#ifndef CS_LLVM_MC_MCINSTRDESC_H
|
||||
#define CS_LLVM_MC_MCINSTRDESC_H
|
||||
|
||||
#include "MCRegisterInfo.h"
|
||||
#include "capstone/platform.h"
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Machine Operand Flags and Description
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// Operand constraints. These are encoded in 16 bits with one of the
|
||||
/// low-order 3 bits specifying that a constraint is present and the
|
||||
/// corresponding high-order hex digit specifying the constraint value.
|
||||
/// This allows for a maximum of 3 constraints.
|
||||
typedef enum {
|
||||
MCOI_TIED_TO = 0, // Operand tied to another operand.
|
||||
MCOI_EARLY_CLOBBER // Operand is an early clobber register operand
|
||||
} MCOI_OperandConstraint;
|
||||
|
||||
// Define a macro to produce each constraint value.
|
||||
#define CONSTRAINT_MCOI_TIED_TO(op) \
|
||||
((1 << MCOI_TIED_TO) | ((op) << (4 + MCOI_TIED_TO * 4)))
|
||||
|
||||
#define CONSTRAINT_MCOI_EARLY_CLOBBER \
|
||||
(1 << MCOI_EARLY_CLOBBER)
|
||||
|
||||
/// OperandFlags - These are flags set on operands, but should be considered
|
||||
/// private, all access should go through the MCOperandInfo accessors.
|
||||
/// See the accessors for a description of what these are.
|
||||
enum MCOI_OperandFlags {
|
||||
MCOI_LookupPtrRegClass = 0,
|
||||
MCOI_Predicate,
|
||||
MCOI_OptionalDef
|
||||
};
|
||||
|
||||
/// Operand Type - Operands are tagged with one of the values of this enum.
|
||||
enum MCOI_OperandType {
|
||||
MCOI_OPERAND_UNKNOWN = 0,
|
||||
MCOI_OPERAND_IMMEDIATE = 1,
|
||||
MCOI_OPERAND_REGISTER = 2,
|
||||
MCOI_OPERAND_MEMORY = 3,
|
||||
MCOI_OPERAND_PCREL = 4,
|
||||
|
||||
MCOI_OPERAND_FIRST_GENERIC = 6,
|
||||
MCOI_OPERAND_GENERIC_0 = 6,
|
||||
MCOI_OPERAND_GENERIC_1 = 7,
|
||||
MCOI_OPERAND_GENERIC_2 = 8,
|
||||
MCOI_OPERAND_GENERIC_3 = 9,
|
||||
MCOI_OPERAND_GENERIC_4 = 10,
|
||||
MCOI_OPERAND_GENERIC_5 = 11,
|
||||
MCOI_OPERAND_LAST_GENERIC = 11,
|
||||
|
||||
MCOI_OPERAND_FIRST_GENERIC_IMM = 12,
|
||||
MCOI_OPERAND_GENERIC_IMM_0 = 12,
|
||||
MCOI_OPERAND_LAST_GENERIC_IMM = 12,
|
||||
|
||||
MCOI_OPERAND_FIRST_TARGET = 13,
|
||||
};
|
||||
|
||||
|
||||
/// MCOperandInfo - This holds information about one operand of a machine
|
||||
/// instruction, indicating the register class for register operands, etc.
|
||||
///
|
||||
typedef struct MCOperandInfo {
|
||||
/// This specifies the register class enumeration of the operand
|
||||
/// if the operand is a register. If isLookupPtrRegClass is set, then this is
|
||||
/// an index that is passed to TargetRegisterInfo::getPointerRegClass(x) to
|
||||
/// get a dynamic register class.
|
||||
int16_t RegClass;
|
||||
|
||||
/// These are flags from the MCOI::OperandFlags enum.
|
||||
uint8_t Flags;
|
||||
|
||||
/// Information about the type of the operand.
|
||||
uint8_t OperandType;
|
||||
|
||||
/// The lower 3 bits are used to specify which constraints are set.
|
||||
/// The higher 13 bits are used to specify the value of constraints (4 bits each).
|
||||
uint16_t Constraints;
|
||||
/// Currently no other information.
|
||||
} MCOperandInfo;
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Machine Instruction Flags and Description
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// MCInstrDesc flags - These should be considered private to the
|
||||
/// implementation of the MCInstrDesc class. Clients should use the predicate
|
||||
/// methods on MCInstrDesc, not use these directly. These all correspond to
|
||||
/// bitfields in the MCInstrDesc::Flags field.
|
||||
enum {
|
||||
MCID_Variadic = 0,
|
||||
MCID_HasOptionalDef,
|
||||
MCID_Pseudo,
|
||||
MCID_Return,
|
||||
MCID_Call,
|
||||
MCID_Barrier,
|
||||
MCID_Terminator,
|
||||
MCID_Branch,
|
||||
MCID_IndirectBranch,
|
||||
MCID_Compare,
|
||||
MCID_MoveImm,
|
||||
MCID_MoveReg,
|
||||
MCID_Bitcast,
|
||||
MCID_Select,
|
||||
MCID_DelaySlot,
|
||||
MCID_FoldableAsLoad,
|
||||
MCID_MayLoad,
|
||||
MCID_MayStore,
|
||||
MCID_Predicable,
|
||||
MCID_NotDuplicable,
|
||||
MCID_UnmodeledSideEffects,
|
||||
MCID_Commutable,
|
||||
MCID_ConvertibleTo3Addr,
|
||||
MCID_UsesCustomInserter,
|
||||
MCID_HasPostISelHook,
|
||||
MCID_Rematerializable,
|
||||
MCID_CheapAsAMove,
|
||||
MCID_ExtraSrcRegAllocReq,
|
||||
MCID_ExtraDefRegAllocReq,
|
||||
MCID_RegSequence,
|
||||
MCID_ExtractSubreg,
|
||||
MCID_InsertSubreg,
|
||||
MCID_Convergent,
|
||||
MCID_Add,
|
||||
MCID_Trap,
|
||||
};
|
||||
|
||||
/// MCInstrDesc - Describe properties that are true of each instruction in the
|
||||
/// target description file. This captures information about side effects,
|
||||
/// register use and many other things. There is one instance of this struct
|
||||
/// for each target instruction class, and the MachineInstr class points to
|
||||
/// this struct directly to describe itself.
|
||||
typedef struct MCInstrDesc {
|
||||
unsigned char NumOperands; // Num of args (may be more if variable_ops)
|
||||
const MCOperandInfo *OpInfo; // 'NumOperands' entries about operands
|
||||
} MCInstrDesc;
|
||||
|
||||
bool MCOperandInfo_isPredicate(const MCOperandInfo *m);
|
||||
|
||||
bool MCOperandInfo_isOptionalDef(const MCOperandInfo *m);
|
||||
|
||||
bool MCOperandInfo_isTiedToOp(const MCOperandInfo *m);
|
||||
|
||||
int MCOperandInfo_getOperandConstraint(const MCInstrDesc *OpInfo,
|
||||
unsigned OpNum,
|
||||
MCOI_OperandConstraint Constraint);
|
||||
const MCInstrDesc *MCInstrDesc_get(unsigned opcode,
|
||||
const MCInstrDesc *table,
|
||||
unsigned tbl_size);
|
||||
|
||||
|
||||
#endif
|
151
thirdparty/capstone/MCRegisterInfo.c
vendored
Normal file
151
thirdparty/capstone/MCRegisterInfo.c
vendored
Normal file
@@ -0,0 +1,151 @@
|
||||
//=== MC/MCRegisterInfo.cpp - Target Register Description -------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements MCRegisterInfo functions.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
|
||||
#include "MCRegisterInfo.h"
|
||||
|
||||
/// DiffListIterator - Base iterator class that can traverse the
|
||||
/// differentially encoded register and regunit lists in DiffLists.
|
||||
/// Don't use this class directly, use one of the specialized sub-classes
|
||||
/// defined below.
|
||||
typedef struct DiffListIterator {
|
||||
uint16_t Val;
|
||||
const MCPhysReg *List;
|
||||
} DiffListIterator;
|
||||
|
||||
void MCRegisterInfo_InitMCRegisterInfo(MCRegisterInfo *RI,
|
||||
const MCRegisterDesc *D, unsigned NR,
|
||||
unsigned RA, unsigned PC,
|
||||
const MCRegisterClass *C, unsigned NC,
|
||||
uint16_t (*RURoots)[2], unsigned NRU,
|
||||
const MCPhysReg *DL,
|
||||
const char *Strings,
|
||||
const uint16_t *SubIndices, unsigned NumIndices,
|
||||
const uint16_t *RET)
|
||||
{
|
||||
RI->Desc = D;
|
||||
RI->NumRegs = NR;
|
||||
RI->RAReg = RA;
|
||||
RI->PCReg = PC;
|
||||
RI->Classes = C;
|
||||
RI->DiffLists = DL;
|
||||
RI->RegStrings = Strings;
|
||||
RI->NumClasses = NC;
|
||||
RI->RegUnitRoots = RURoots;
|
||||
RI->NumRegUnits = NRU;
|
||||
RI->SubRegIndices = SubIndices;
|
||||
RI->NumSubRegIndices = NumIndices;
|
||||
RI->RegEncodingTable = RET;
|
||||
}
|
||||
|
||||
static void DiffListIterator_init(DiffListIterator *d, MCPhysReg InitVal, const MCPhysReg *DiffList)
|
||||
{
|
||||
d->Val = InitVal;
|
||||
d->List = DiffList;
|
||||
}
|
||||
|
||||
static uint16_t DiffListIterator_getVal(DiffListIterator *d)
|
||||
{
|
||||
return d->Val;
|
||||
}
|
||||
|
||||
static bool DiffListIterator_next(DiffListIterator *d)
|
||||
{
|
||||
MCPhysReg D;
|
||||
|
||||
if (d->List == 0)
|
||||
return false;
|
||||
|
||||
D = *d->List;
|
||||
d->List++;
|
||||
d->Val += D;
|
||||
|
||||
if (!D)
|
||||
d->List = 0;
|
||||
|
||||
return (D != 0);
|
||||
}
|
||||
|
||||
static bool DiffListIterator_isValid(DiffListIterator *d)
|
||||
{
|
||||
return (d->List != 0);
|
||||
}
|
||||
|
||||
unsigned MCRegisterInfo_getMatchingSuperReg(const MCRegisterInfo *RI, unsigned Reg, unsigned SubIdx, const MCRegisterClass *RC)
|
||||
{
|
||||
DiffListIterator iter;
|
||||
|
||||
if (Reg >= RI->NumRegs) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
DiffListIterator_init(&iter, (MCPhysReg)Reg, RI->DiffLists + RI->Desc[Reg].SuperRegs);
|
||||
DiffListIterator_next(&iter);
|
||||
|
||||
while(DiffListIterator_isValid(&iter)) {
|
||||
uint16_t val = DiffListIterator_getVal(&iter);
|
||||
if (MCRegisterClass_contains(RC, val) && Reg == MCRegisterInfo_getSubReg(RI, val, SubIdx))
|
||||
return val;
|
||||
|
||||
DiffListIterator_next(&iter);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned MCRegisterInfo_getSubReg(const MCRegisterInfo *RI, unsigned Reg, unsigned Idx)
|
||||
{
|
||||
DiffListIterator iter;
|
||||
const uint16_t *SRI = RI->SubRegIndices + RI->Desc[Reg].SubRegIndices;
|
||||
|
||||
DiffListIterator_init(&iter, (MCPhysReg)Reg, RI->DiffLists + RI->Desc[Reg].SubRegs);
|
||||
DiffListIterator_next(&iter);
|
||||
|
||||
while(DiffListIterator_isValid(&iter)) {
|
||||
if (*SRI == Idx)
|
||||
return DiffListIterator_getVal(&iter);
|
||||
DiffListIterator_next(&iter);
|
||||
++SRI;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const MCRegisterClass* MCRegisterInfo_getRegClass(const MCRegisterInfo *RI, unsigned i)
|
||||
{
|
||||
//assert(i < getNumRegClasses() && "Register Class ID out of range");
|
||||
if (i >= RI->NumClasses)
|
||||
return 0;
|
||||
return &(RI->Classes[i]);
|
||||
}
|
||||
|
||||
bool MCRegisterClass_contains(const MCRegisterClass *c, unsigned Reg)
|
||||
{
|
||||
unsigned InByte = 0;
|
||||
unsigned Byte = 0;
|
||||
|
||||
// Make sure that MCRegisterInfo_getRegClass didn't return 0
|
||||
// (for calls to GETREGCLASS_CONTAIN0)
|
||||
if(!c)
|
||||
return false;
|
||||
|
||||
InByte = Reg % 8;
|
||||
Byte = Reg / 8;
|
||||
|
||||
if (Byte >= c->RegSetSize)
|
||||
return false;
|
||||
|
||||
return (c->RegSet[Byte] & (1 << InByte)) != 0;
|
||||
}
|
116
thirdparty/capstone/MCRegisterInfo.h
vendored
Normal file
116
thirdparty/capstone/MCRegisterInfo.h
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
//=== MC/MCRegisterInfo.h - Target Register Description ---------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file describes an abstract interface used to get information about a
|
||||
// target machines register file. This information is used for a variety of
|
||||
// purposed, especially register allocation.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
|
||||
#ifndef CS_LLVM_MC_MCREGISTERINFO_H
|
||||
#define CS_LLVM_MC_MCREGISTERINFO_H
|
||||
|
||||
#include "capstone/platform.h"
|
||||
|
||||
/// An unsigned integer type large enough to represent all physical registers,
|
||||
/// but not necessarily virtual registers.
|
||||
typedef int16_t MCPhysReg;
|
||||
typedef const MCPhysReg* iterator;
|
||||
|
||||
typedef struct MCRegisterClass2 {
|
||||
iterator RegsBegin;
|
||||
const uint8_t *RegSet;
|
||||
uint8_t RegsSize;
|
||||
uint8_t RegSetSize;
|
||||
} MCRegisterClass2;
|
||||
|
||||
typedef struct MCRegisterClass {
|
||||
iterator RegsBegin;
|
||||
const uint8_t *RegSet;
|
||||
uint16_t RegSetSize;
|
||||
} MCRegisterClass;
|
||||
|
||||
/// MCRegisterDesc - This record contains information about a particular
|
||||
/// register. The SubRegs field is a zero terminated array of registers that
|
||||
/// are sub-registers of the specific register, e.g. AL, AH are sub-registers
|
||||
/// of AX. The SuperRegs field is a zero terminated array of registers that are
|
||||
/// super-registers of AX.
|
||||
typedef struct MCRegisterDesc {
|
||||
uint32_t Name; // Printable name for the reg (for debugging)
|
||||
uint32_t SubRegs; // Sub-register set, described above
|
||||
uint32_t SuperRegs; // Super-register set, described above
|
||||
|
||||
// Offset into MCRI::SubRegIndices of a list of sub-register indices for each
|
||||
// sub-register in SubRegs.
|
||||
uint32_t SubRegIndices;
|
||||
|
||||
// RegUnits - Points to the list of register units. The low 4 bits holds the
|
||||
// Scale, the high bits hold an offset into DiffLists. See MCRegUnitIterator.
|
||||
uint32_t RegUnits;
|
||||
|
||||
/// Index into list with lane mask sequences. The sequence contains a lanemask
|
||||
/// for every register unit.
|
||||
uint16_t RegUnitLaneMasks; // ???
|
||||
} MCRegisterDesc;
|
||||
|
||||
/// MCRegisterInfo base class - We assume that the target defines a static
|
||||
/// array of MCRegisterDesc objects that represent all of the machine
|
||||
/// registers that the target has. As such, we simply have to track a pointer
|
||||
/// to this array so that we can turn register number into a register
|
||||
/// descriptor.
|
||||
///
|
||||
/// Note this class is designed to be a base class of TargetRegisterInfo, which
|
||||
/// is the interface used by codegen. However, specific targets *should never*
|
||||
/// specialize this class. MCRegisterInfo should only contain getters to access
|
||||
/// TableGen generated physical register data. It must not be extended with
|
||||
/// virtual methods.
|
||||
typedef struct MCRegisterInfo {
|
||||
const MCRegisterDesc *Desc; // Pointer to the descriptor array
|
||||
unsigned NumRegs; // Number of entries in the array
|
||||
unsigned RAReg; // Return address register
|
||||
unsigned PCReg; // Program counter register
|
||||
const MCRegisterClass *Classes; // Pointer to the regclass array
|
||||
unsigned NumClasses; // Number of entries in the array
|
||||
unsigned NumRegUnits; // Number of regunits.
|
||||
uint16_t (*RegUnitRoots)[2]; // Pointer to regunit root table.
|
||||
const MCPhysReg *DiffLists; // Pointer to the difflists array
|
||||
// const LaneBitmask *RegUnitMaskSequences; // Pointer to lane mask sequences
|
||||
const char *RegStrings; // Pointer to the string table.
|
||||
// const char *RegClassStrings; // Pointer to the class strings.
|
||||
const uint16_t *SubRegIndices; // Pointer to the subreg lookup
|
||||
// array.
|
||||
unsigned NumSubRegIndices; // Number of subreg indices.
|
||||
const uint16_t *RegEncodingTable; // Pointer to array of register
|
||||
// encodings.
|
||||
} MCRegisterInfo;
|
||||
|
||||
void MCRegisterInfo_InitMCRegisterInfo(MCRegisterInfo *RI,
|
||||
const MCRegisterDesc *D, unsigned NR, unsigned RA,
|
||||
unsigned PC,
|
||||
const MCRegisterClass *C, unsigned NC,
|
||||
uint16_t (*RURoots)[2],
|
||||
unsigned NRU,
|
||||
const MCPhysReg *DL,
|
||||
const char *Strings,
|
||||
const uint16_t *SubIndices,
|
||||
unsigned NumIndices,
|
||||
const uint16_t *RET);
|
||||
|
||||
unsigned MCRegisterInfo_getMatchingSuperReg(const MCRegisterInfo *RI, unsigned Reg, unsigned SubIdx, const MCRegisterClass *RC);
|
||||
|
||||
unsigned MCRegisterInfo_getSubReg(const MCRegisterInfo *RI, unsigned Reg, unsigned Idx);
|
||||
|
||||
const MCRegisterClass* MCRegisterInfo_getRegClass(const MCRegisterInfo *RI, unsigned i);
|
||||
|
||||
bool MCRegisterClass_contains(const MCRegisterClass *c, unsigned Reg);
|
||||
|
||||
#endif
|
649
thirdparty/capstone/Makefile
vendored
Normal file
649
thirdparty/capstone/Makefile
vendored
Normal file
@@ -0,0 +1,649 @@
|
||||
# Capstone Disassembly Engine
|
||||
# By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014
|
||||
|
||||
include config.mk
|
||||
include pkgconfig.mk # package version
|
||||
include functions.mk
|
||||
|
||||
# Verbose output?
|
||||
V ?= 0
|
||||
|
||||
OS := $(shell uname)
|
||||
ifeq ($(OS),Darwin)
|
||||
LIBARCHS ?= x86_64 arm64
|
||||
PREFIX ?= /usr/local
|
||||
endif
|
||||
|
||||
ifeq ($(PKG_EXTRA),)
|
||||
PKG_VERSION = $(PKG_MAJOR).$(PKG_MINOR)
|
||||
else
|
||||
PKG_VERSION = $(PKG_MAJOR).$(PKG_MINOR).$(PKG_EXTRA)
|
||||
endif
|
||||
|
||||
ifeq ($(CROSS),)
|
||||
RANLIB ?= ranlib
|
||||
else ifeq ($(ANDROID), 1)
|
||||
CC = $(CROSS)/../../bin/clang
|
||||
AR = $(CROSS)/ar
|
||||
RANLIB = $(CROSS)/ranlib
|
||||
STRIP = $(CROSS)/strip
|
||||
else
|
||||
CC = $(CROSS)gcc
|
||||
AR = $(CROSS)ar
|
||||
RANLIB = $(CROSS)ranlib
|
||||
STRIP = $(CROSS)strip
|
||||
endif
|
||||
|
||||
ifeq ($(OS),OS/390)
|
||||
RANLIB = touch
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring yes,$(CAPSTONE_DIET)))
|
||||
CFLAGS ?= -Os
|
||||
CFLAGS += -DCAPSTONE_DIET
|
||||
else
|
||||
CFLAGS ?= -O3
|
||||
endif
|
||||
|
||||
# C99 has been enforced elsewhere like xcode
|
||||
CFLAGS += -std=gnu99
|
||||
|
||||
ifneq (,$(findstring yes,$(CAPSTONE_X86_ATT_DISABLE)))
|
||||
CFLAGS += -DCAPSTONE_X86_ATT_DISABLE
|
||||
endif
|
||||
|
||||
ifeq ($(CC),xlc)
|
||||
CFLAGS += -qcpluscmt -qkeyword=inline -qlanglvl=extc1x -Iinclude
|
||||
ifneq ($(OS),OS/390)
|
||||
CFLAGS += -fPIC
|
||||
endif
|
||||
else
|
||||
CFLAGS += -fPIC -Wall -Wwrite-strings -Wmissing-prototypes -Iinclude
|
||||
endif
|
||||
|
||||
ifeq ($(CAPSTONE_USE_SYS_DYN_MEM),yes)
|
||||
CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM
|
||||
endif
|
||||
|
||||
ifeq ($(CAPSTONE_HAS_OSXKERNEL), yes)
|
||||
CFLAGS += -DCAPSTONE_HAS_OSXKERNEL
|
||||
SDKROOT ?= $(shell xcodebuild -version -sdk macosx Path)
|
||||
CFLAGS += -mmacosx-version-min=10.5 \
|
||||
-isysroot$(SDKROOT) \
|
||||
-I$(SDKROOT)/System/Library/Frameworks/Kernel.framework/Headers \
|
||||
-mkernel \
|
||||
-fno-builtin
|
||||
endif
|
||||
|
||||
PREFIX ?= /usr
|
||||
DESTDIR ?=
|
||||
ifndef BUILDDIR
|
||||
BLDIR = .
|
||||
OBJDIR = .
|
||||
else
|
||||
BLDIR = $(abspath $(BUILDDIR))
|
||||
OBJDIR = $(BLDIR)/obj
|
||||
endif
|
||||
INCDIR ?= $(PREFIX)/include
|
||||
|
||||
UNAME_S := $(shell uname -s)
|
||||
|
||||
LIBDIRARCH ?= lib
|
||||
# Uncomment the below line to installs x86_64 libs to lib64/ directory.
|
||||
# Or better, pass 'LIBDIRARCH=lib64' to 'make install/uninstall' via 'make.sh'.
|
||||
#LIBDIRARCH ?= lib64
|
||||
LIBDIR = $(DESTDIR)$(PREFIX)/$(LIBDIRARCH)
|
||||
BINDIR = $(DESTDIR)$(PREFIX)/bin
|
||||
|
||||
LIBDATADIR = $(LIBDIR)
|
||||
|
||||
# Don't redefine $LIBDATADIR when global environment variable
|
||||
# USE_GENERIC_LIBDATADIR is set. This is used by the pkgsrc framework.
|
||||
|
||||
ifndef USE_GENERIC_LIBDATADIR
|
||||
ifeq ($(UNAME_S), FreeBSD)
|
||||
LIBDATADIR = $(DESTDIR)$(PREFIX)/libdata
|
||||
endif
|
||||
ifeq ($(UNAME_S), DragonFly)
|
||||
LIBDATADIR = $(DESTDIR)$(PREFIX)/libdata
|
||||
endif
|
||||
endif
|
||||
|
||||
INSTALL_BIN ?= install
|
||||
INSTALL_DATA ?= $(INSTALL_BIN) -m0644
|
||||
INSTALL_LIB ?= $(INSTALL_BIN) -m0755
|
||||
|
||||
LIBNAME = capstone
|
||||
|
||||
|
||||
DEP_ARM =
|
||||
DEP_ARM += $(wildcard arch/ARM/ARM*.inc)
|
||||
|
||||
LIBOBJ_ARM =
|
||||
ifneq (,$(findstring arm,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_ARM
|
||||
LIBSRC_ARM += $(wildcard arch/ARM/ARM*.c)
|
||||
LIBOBJ_ARM += $(LIBSRC_ARM:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
DEP_AARCH64 =
|
||||
DEP_AARCH64 += $(wildcard arch/AArch64/AArch64*.inc)
|
||||
|
||||
LIBOBJ_AARCH64 =
|
||||
ifneq (,$(findstring aarch64,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_ARM64
|
||||
CFLAGS += -DCAPSTONE_HAS_AARCH64
|
||||
LIBSRC_AARCH64 += $(wildcard arch/AArch64/AArch64*.c)
|
||||
LIBOBJ_AARCH64 += $(LIBSRC_AARCH64:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
|
||||
DEP_M68K =
|
||||
DEP_M68K += $(wildcard arch/M68K/M68K*.inc)
|
||||
DEP_M68K += $(wildcard arch/M68K/M68K*.h)
|
||||
|
||||
LIBOBJ_M68K =
|
||||
ifneq (,$(findstring m68k,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_M68K
|
||||
LIBSRC_M68K += $(wildcard arch/M68K/M68K*.c)
|
||||
LIBOBJ_M68K += $(LIBSRC_M68K:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
DEP_MIPS =
|
||||
DEP_MIPS += $(wildcard arch/Mips/Mips*.inc)
|
||||
|
||||
LIBOBJ_MIPS =
|
||||
ifneq (,$(findstring mips,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_MIPS
|
||||
LIBSRC_MIPS += $(wildcard arch/Mips/Mips*.c)
|
||||
LIBOBJ_MIPS += $(LIBSRC_MIPS:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
DEP_SH = $(wildcard arch/SH/SH*.inc)
|
||||
|
||||
LIBOBJ_SH =
|
||||
ifneq (,$(findstring sh,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_SH
|
||||
LIBSRC_SH += $(wildcard arch/SH/SH*.c)
|
||||
LIBOBJ_SH += $(LIBSRC_SH:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
DEP_PPC =
|
||||
DEP_PPC += $(wildcard arch/PowerPC/PPC*.inc)
|
||||
|
||||
LIBOBJ_PPC =
|
||||
ifneq (,$(findstring powerpc,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_POWERPC
|
||||
LIBSRC_PPC += $(wildcard arch/PowerPC/PPC*.c)
|
||||
LIBOBJ_PPC += $(LIBSRC_PPC:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
|
||||
DEP_SPARC =
|
||||
DEP_SPARC += $(wildcard arch/Sparc/Sparc*.inc)
|
||||
|
||||
LIBOBJ_SPARC =
|
||||
ifneq (,$(findstring sparc,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_SPARC
|
||||
LIBSRC_SPARC += $(wildcard arch/Sparc/Sparc*.c)
|
||||
LIBOBJ_SPARC += $(LIBSRC_SPARC:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
|
||||
DEP_SYSZ =
|
||||
DEP_SYSZ += $(wildcard arch/SystemZ/SystemZ*.inc)
|
||||
|
||||
LIBOBJ_SYSZ =
|
||||
ifneq (,$(findstring systemz,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_SYSZ
|
||||
LIBSRC_SYSZ += $(wildcard arch/SystemZ/SystemZ*.c)
|
||||
LIBOBJ_SYSZ += $(LIBSRC_SYSZ:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
|
||||
# by default, we compile full X86 instruction sets
|
||||
X86_REDUCE =
|
||||
ifneq (,$(findstring yes,$(CAPSTONE_X86_REDUCE)))
|
||||
X86_REDUCE = _reduce
|
||||
CFLAGS += -DCAPSTONE_X86_REDUCE -Os
|
||||
endif
|
||||
|
||||
|
||||
DEP_X86 =
|
||||
DEP_X86 += $(wildcard arch/X86/X86*.inc)
|
||||
|
||||
LIBOBJ_X86 =
|
||||
ifneq (,$(findstring x86,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_X86
|
||||
LIBOBJ_X86 += $(OBJDIR)/arch/X86/X86DisassemblerDecoder.o
|
||||
LIBOBJ_X86 += $(OBJDIR)/arch/X86/X86Disassembler.o
|
||||
LIBOBJ_X86 += $(OBJDIR)/arch/X86/X86InstPrinterCommon.o
|
||||
LIBOBJ_X86 += $(OBJDIR)/arch/X86/X86IntelInstPrinter.o
|
||||
# assembly syntax is irrelevant in Diet mode, when this info is suppressed
|
||||
ifeq (,$(findstring yes,$(CAPSTONE_DIET)))
|
||||
ifeq (,$(findstring yes,$(CAPSTONE_X86_ATT_DISABLE)))
|
||||
LIBOBJ_X86 += $(OBJDIR)/arch/X86/X86ATTInstPrinter.o
|
||||
endif
|
||||
endif
|
||||
LIBOBJ_X86 += $(OBJDIR)/arch/X86/X86Mapping.o
|
||||
LIBOBJ_X86 += $(OBJDIR)/arch/X86/X86Module.o
|
||||
endif
|
||||
|
||||
|
||||
DEP_XCORE =
|
||||
DEP_XCORE += $(wildcard arch/XCore/XCore*.inc)
|
||||
|
||||
LIBOBJ_XCORE =
|
||||
ifneq (,$(findstring xcore,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_XCORE
|
||||
LIBSRC_XCORE += $(wildcard arch/XCore/XCore*.c)
|
||||
LIBOBJ_XCORE += $(LIBSRC_XCORE:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
|
||||
DEP_TMS320C64X =
|
||||
DEP_TMS320C64X += $(wildcard arch/TMS320C64x/TMS320C64x*.inc)
|
||||
|
||||
LIBOBJ_TMS320C64X =
|
||||
ifneq (,$(findstring tms320c64x,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_TMS320C64X
|
||||
LIBSRC_TMS320C64X += $(wildcard arch/TMS320C64x/TMS320C64x*.c)
|
||||
LIBOBJ_TMS320C64X += $(LIBSRC_TMS320C64X:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
DEP_M680X =
|
||||
DEP_M680X += $(wildcard arch/M680X/*.inc)
|
||||
DEP_M680X += $(wildcard arch/M680X/M680X*.h)
|
||||
|
||||
LIBOBJ_M680X =
|
||||
ifneq (,$(findstring m680x,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_M680X
|
||||
LIBSRC_M680X += $(wildcard arch/M680X/*.c)
|
||||
LIBOBJ_M680X += $(LIBSRC_M680X:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
|
||||
DEP_EVM =
|
||||
DEP_EVM += $(wildcard arch/EVM/EVM*.inc)
|
||||
|
||||
LIBOBJ_EVM =
|
||||
ifneq (,$(findstring evm,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_EVM
|
||||
LIBSRC_EVM += $(wildcard arch/EVM/EVM*.c)
|
||||
LIBOBJ_EVM += $(LIBSRC_EVM:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
DEP_RISCV =
|
||||
DEP_RISCV += $(wildcard arch/RISCV/RISCV*.inc)
|
||||
|
||||
LIBOBJ_RISCV =
|
||||
ifneq (,$(findstring riscv,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_RISCV
|
||||
LIBSRC_RISCV += $(wildcard arch/RISCV/RISCV*.c)
|
||||
LIBOBJ_RISCV += $(LIBSRC_RISCV:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
DEP_WASM =
|
||||
DEP_WASM += $(wildcard arch/WASM/WASM*.inc)
|
||||
|
||||
LIBOBJ_WASM =
|
||||
ifneq (,$(findstring wasm,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_WASM
|
||||
LIBSRC_WASM += $(wildcard arch/WASM/WASM*.c)
|
||||
LIBOBJ_WASM += $(LIBSRC_WASM:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
|
||||
DEP_MOS65XX =
|
||||
DEP_MOS65XX += $(wildcard arch/MOS65XX/MOS65XX*.inc)
|
||||
|
||||
LIBOBJ_MOS65XX =
|
||||
ifneq (,$(findstring mos65xx,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_MOS65XX
|
||||
LIBSRC_MOS65XX += $(wildcard arch/MOS65XX/MOS65XX*.c)
|
||||
LIBOBJ_MOS65XX += $(LIBSRC_MOS65XX:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
|
||||
DEP_BPF =
|
||||
DEP_BPF += $(wildcard arch/BPF/BPF*.inc)
|
||||
|
||||
LIBOBJ_BPF =
|
||||
ifneq (,$(findstring bpf,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_BPF
|
||||
LIBSRC_BPF += $(wildcard arch/BPF/BPF*.c)
|
||||
LIBOBJ_BPF += $(LIBSRC_BPF:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
DEP_TRICORE =
|
||||
DEP_TRICORE +=$(wildcard arch/TriCore/TriCore*.inc)
|
||||
|
||||
LIBOBJ_TRICORE =
|
||||
ifneq (,$(findstring tricore,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_TRICORE
|
||||
LIBSRC_TRICORE += $(wildcard arch/TriCore/TriCore*.c)
|
||||
LIBOBJ_TRICORE += $(LIBSRC_TRICORE:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
DEP_ALPHA =
|
||||
DEP_ALPHA +=$(wildcard arch/Alpha/Alpha*.inc)
|
||||
|
||||
LIBOBJ_ALPHA =
|
||||
ifneq (,$(findstring alpha,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_ALPHA
|
||||
LIBSRC_ALPHA += $(wildcard arch/Alpha/Alpha*.c)
|
||||
LIBOBJ_ALPHA += $(LIBSRC_ALPHA:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
DEP_HPPA =
|
||||
DEP_HPPA += $(wildcard arch/HPPA/HPPA*.inc)
|
||||
|
||||
LIBOBJ_HPPA =
|
||||
ifneq (,$(findstring hppa,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_HPPA
|
||||
LIBSRC_HPPA += $(wildcard arch/HPPA/HPPA*.c)
|
||||
LIBOBJ_HPPA += $(LIBSRC_HPPA:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
DEP_LOONGARCH =
|
||||
DEP_LOONGARCH += $(wildcard arch/LoongArch/LoongArch*.inc)
|
||||
|
||||
LIBOBJ_LOONGARCH =
|
||||
ifneq (,$(findstring loongarch,$(CAPSTONE_ARCHS)))
|
||||
CFLAGS += -DCAPSTONE_HAS_LOONGARCH
|
||||
LIBSRC_LOONGARCH += $(wildcard arch/LoongArch/LoongArch*.c)
|
||||
LIBOBJ_LOONGARCH += $(LIBSRC_LOONGARCH:%.c=$(OBJDIR)/%.o)
|
||||
endif
|
||||
|
||||
LIBOBJ =
|
||||
LIBOBJ += $(OBJDIR)/cs.o $(OBJDIR)/utils.o $(OBJDIR)/SStream.o $(OBJDIR)/MCInstrDesc.o $(OBJDIR)/MCRegisterInfo.o $(OBJDIR)/MCInst.o $(OBJDIR)/MCInstPrinter.o $(OBJDIR)/Mapping.o
|
||||
LIBOBJ += $(LIBOBJ_ARM) $(LIBOBJ_AARCH64) $(LIBOBJ_M68K) $(LIBOBJ_MIPS) $(LIBOBJ_PPC) $(LIBOBJ_RISCV) $(LIBOBJ_SPARC) $(LIBOBJ_SYSZ) $(LIBOBJ_SH)
|
||||
LIBOBJ += $(LIBOBJ_X86) $(LIBOBJ_XCORE) $(LIBOBJ_TMS320C64X) $(LIBOBJ_M680X) $(LIBOBJ_EVM) $(LIBOBJ_MOS65XX) $(LIBOBJ_WASM) $(LIBOBJ_BPF)
|
||||
LIBOBJ += $(LIBOBJ_TRICORE) $(LIBOBJ_ALPHA) $(LIBOBJ_HPPA) $(LIBOBJ_LOONGARCH)
|
||||
|
||||
|
||||
ifeq ($(PKG_EXTRA),)
|
||||
PKGCFGDIR = $(LIBDATADIR)/pkgconfig
|
||||
else
|
||||
PKGCFGDIR ?= $(LIBDATADIR)/pkgconfig
|
||||
ifeq ($(PKGCFGDIR),)
|
||||
PKGCFGDIR = $(LIBDATADIR)/pkgconfig
|
||||
endif
|
||||
endif
|
||||
|
||||
API_MAJOR=$(shell echo `grep -e CS_API_MAJOR include/capstone/capstone.h | grep -v = | awk '{print $$3}'` | awk '{print $$1}')
|
||||
VERSION_EXT =
|
||||
|
||||
IS_APPLE := $(shell $(CC) -dM -E - < /dev/null 2> /dev/null | grep __APPLE__ | wc -l | tr -d " ")
|
||||
ifeq ($(IS_APPLE),1)
|
||||
# on MacOS, do not build in Universal format by default
|
||||
MACOS_UNIVERSAL ?= no
|
||||
ifeq ($(MACOS_UNIVERSAL),yes)
|
||||
CFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch))
|
||||
LDFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch))
|
||||
endif
|
||||
EXT = dylib
|
||||
VERSION_EXT = $(API_MAJOR).$(EXT)
|
||||
$(LIBNAME)_LDFLAGS += -dynamiclib -install_name lib$(LIBNAME).$(VERSION_EXT) -current_version $(PKG_MAJOR).$(PKG_MINOR).$(PKG_EXTRA) -compatibility_version $(PKG_MAJOR).$(PKG_MINOR)
|
||||
AR_EXT = a
|
||||
# Homebrew wants to make sure its formula does not disable FORTIFY_SOURCE
|
||||
# However, this is not really necessary because 'CAPSTONE_USE_SYS_DYN_MEM=yes' by default
|
||||
ifneq ($(HOMEBREW_CAPSTONE),1)
|
||||
ifneq ($(CAPSTONE_USE_SYS_DYN_MEM),yes)
|
||||
# remove string check because OSX kernel complains about missing symbols
|
||||
CFLAGS += -D_FORTIFY_SOURCE=0
|
||||
endif
|
||||
endif
|
||||
else
|
||||
CFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch))
|
||||
LDFLAGS += $(foreach arch,$(LIBARCHS),-arch $(arch))
|
||||
ifeq ($(OS), AIX)
|
||||
$(LIBNAME)_LDFLAGS += -qmkshrobj
|
||||
else
|
||||
$(LIBNAME)_LDFLAGS += -shared
|
||||
endif
|
||||
# Cygwin?
|
||||
IS_CYGWIN := $(shell $(CC) -dumpmachine 2>/dev/null | grep -i cygwin | wc -l)
|
||||
ifeq ($(IS_CYGWIN),1)
|
||||
EXT = dll
|
||||
AR_EXT = lib
|
||||
# Cygwin doesn't like -fPIC
|
||||
CFLAGS := $(CFLAGS:-fPIC=)
|
||||
# On Windows we need the shared library to be executable
|
||||
else
|
||||
# mingw?
|
||||
IS_MINGW := $(shell $(CC) --version 2>/dev/null | grep -i "\(mingw\|MSYS\)" | wc -l)
|
||||
ifeq ($(IS_MINGW),1)
|
||||
EXT = dll
|
||||
AR_EXT = lib
|
||||
# mingw doesn't like -fPIC either
|
||||
CFLAGS := $(CFLAGS:-fPIC=)
|
||||
# On Windows we need the shared library to be executable
|
||||
else
|
||||
# Linux, *BSD
|
||||
EXT = so
|
||||
VERSION_EXT = $(EXT).$(API_MAJOR)
|
||||
AR_EXT = a
|
||||
$(LIBNAME)_LDFLAGS += -Wl,-soname,lib$(LIBNAME).$(VERSION_EXT)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CAPSTONE_SHARED),yes)
|
||||
ifeq ($(IS_MINGW),1)
|
||||
LIBRARY = $(BLDIR)/$(LIBNAME).$(VERSION_EXT)
|
||||
else ifeq ($(IS_CYGWIN),1)
|
||||
LIBRARY = $(BLDIR)/$(LIBNAME).$(EXT)
|
||||
else # *nix
|
||||
LIBRARY = $(BLDIR)/lib$(LIBNAME).$(VERSION_EXT)
|
||||
CFLAGS += -fvisibility=hidden
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CAPSTONE_STATIC),yes)
|
||||
ifeq ($(IS_MINGW),1)
|
||||
ARCHIVE = $(BLDIR)/$(LIBNAME).$(AR_EXT)
|
||||
else ifeq ($(IS_CYGWIN),1)
|
||||
ARCHIVE = $(BLDIR)/$(LIBNAME).$(AR_EXT)
|
||||
else
|
||||
ARCHIVE = $(BLDIR)/lib$(LIBNAME).$(AR_EXT)
|
||||
endif
|
||||
endif
|
||||
|
||||
PKGCFGF = $(BLDIR)/$(LIBNAME).pc
|
||||
|
||||
.PHONY: all clean install uninstall dist
|
||||
|
||||
all: $(LIBRARY) $(ARCHIVE) $(PKGCFGF)
|
||||
ifeq (,$(findstring yes,$(CAPSTONE_BUILD_CORE_ONLY)))
|
||||
@V=$(V) CC=$(CC) $(MAKE) -C cstool
|
||||
endif
|
||||
|
||||
ifeq ($(CAPSTONE_SHARED),yes)
|
||||
$(LIBRARY): $(LIBOBJ)
|
||||
ifeq ($(V),0)
|
||||
$(call log,LINK,$(@:$(BLDIR)/%=%))
|
||||
@$(create-library)
|
||||
else
|
||||
$(create-library)
|
||||
endif
|
||||
endif
|
||||
|
||||
$(LIBOBJ): config.mk
|
||||
|
||||
$(LIBOBJ_ARM): $(DEP_ARM)
|
||||
$(LIBOBJ_AARCH64): $(DEP_AARCH64)
|
||||
$(LIBOBJ_M68K): $(DEP_M68K)
|
||||
$(LIBOBJ_MIPS): $(DEP_MIPS)
|
||||
$(LIBOBJ_PPC): $(DEP_PPC)
|
||||
$(LIBOBJ_SH): $(DEP_SH)
|
||||
$(LIBOBJ_SPARC): $(DEP_SPARC)
|
||||
$(LIBOBJ_SYSZ): $(DEP_SYSZ)
|
||||
$(LIBOBJ_X86): $(DEP_X86)
|
||||
$(LIBOBJ_XCORE): $(DEP_XCORE)
|
||||
$(LIBOBJ_TMS320C64X): $(DEP_TMS320C64X)
|
||||
$(LIBOBJ_M680X): $(DEP_M680X)
|
||||
$(LIBOBJ_EVM): $(DEP_EVM)
|
||||
$(LIBOBJ_RISCV): $(DEP_RISCV)
|
||||
$(LIBOBJ_WASM): $(DEP_WASM)
|
||||
$(LIBOBJ_MOS65XX): $(DEP_MOS65XX)
|
||||
$(LIBOBJ_BPF): $(DEP_BPF)
|
||||
$(LIBOBJ_TRICORE): $(DEP_TRICORE)
|
||||
$(LIBOBJ_ALPHA): $(DEP_ALPHA)
|
||||
$(LIBOBJ_HPPA): $(DEP_HPPA)
|
||||
$(LIBOBJ_LOONGARCH): $(DEP_LOONGARCH)
|
||||
|
||||
ifeq ($(CAPSTONE_STATIC),yes)
|
||||
$(ARCHIVE): $(LIBOBJ)
|
||||
@rm -f $(ARCHIVE)
|
||||
ifeq ($(V),0)
|
||||
$(call log,AR,$(@:$(BLDIR)/%=%))
|
||||
@$(create-archive)
|
||||
else
|
||||
$(create-archive)
|
||||
endif
|
||||
endif
|
||||
|
||||
$(PKGCFGF):
|
||||
ifeq ($(V),0)
|
||||
$(call log,GEN,$(@:$(BLDIR)/%=%))
|
||||
@$(generate-pkgcfg)
|
||||
else
|
||||
$(generate-pkgcfg)
|
||||
endif
|
||||
|
||||
# create a list of auto dependencies
|
||||
AUTODEPS:= $(patsubst %.o,%.d, $(LIBOBJ))
|
||||
|
||||
# include by auto dependencies
|
||||
-include $(AUTODEPS)
|
||||
|
||||
install: $(PKGCFGF) $(ARCHIVE) $(LIBRARY)
|
||||
mkdir -p $(LIBDIR)
|
||||
$(call install-library,$(LIBDIR))
|
||||
ifeq ($(CAPSTONE_STATIC),yes)
|
||||
$(INSTALL_DATA) $(ARCHIVE) $(LIBDIR)
|
||||
endif
|
||||
mkdir -p $(DESTDIR)$(INCDIR)/$(LIBNAME)
|
||||
$(INSTALL_DATA) include/capstone/*.h $(DESTDIR)$(INCDIR)/$(LIBNAME)
|
||||
mkdir -p $(PKGCFGDIR)
|
||||
$(INSTALL_DATA) $(PKGCFGF) $(PKGCFGDIR)
|
||||
ifeq (,$(findstring yes,$(CAPSTONE_BUILD_CORE_ONLY)))
|
||||
mkdir -p $(BINDIR)
|
||||
$(INSTALL_LIB) cstool/cstool $(BINDIR)
|
||||
endif
|
||||
|
||||
uninstall:
|
||||
rm -rf $(DESTDIR)$(INCDIR)/$(LIBNAME)
|
||||
rm -f $(LIBDIR)/lib$(LIBNAME).*
|
||||
rm -f $(PKGCFGDIR)/$(LIBNAME).pc
|
||||
ifeq (,$(findstring yes,$(CAPSTONE_BUILD_CORE_ONLY)))
|
||||
rm -f $(BINDIR)/cstool
|
||||
endif
|
||||
|
||||
clean:
|
||||
rm -f $(LIBOBJ)
|
||||
rm -f $(BLDIR)/lib$(LIBNAME).* $(BLDIR)/$(LIBNAME).pc
|
||||
rm -f $(PKGCFGF)
|
||||
rm -f $(AUTODEPS)
|
||||
[ "${ANDROID}" = "1" ] && rm -rf android-ndk-* || true
|
||||
|
||||
ifeq (,$(findstring yes,$(CAPSTONE_BUILD_CORE_ONLY)))
|
||||
$(MAKE) -C cstool clean
|
||||
$(MAKE) -C suite/fuzz clean
|
||||
endif
|
||||
|
||||
ifdef BUILDDIR
|
||||
rm -rf $(BUILDDIR)
|
||||
endif
|
||||
|
||||
ifeq (,$(findstring yes,$(CAPSTONE_BUILD_CORE_ONLY)))
|
||||
$(MAKE) -C bindings/python clean
|
||||
$(MAKE) -C bindings/java clean
|
||||
$(MAKE) -C bindings/ocaml clean
|
||||
endif
|
||||
|
||||
|
||||
TAG ?= HEAD
|
||||
ifeq ($(TAG), HEAD)
|
||||
DIST_VERSION = latest
|
||||
else
|
||||
DIST_VERSION = $(TAG)
|
||||
endif
|
||||
|
||||
dist:
|
||||
git archive --format=tar.gz --prefix=capstone-$(DIST_VERSION)/ $(TAG) > capstone-$(DIST_VERSION).tgz
|
||||
git archive --format=zip --prefix=capstone-$(DIST_VERSION)/ $(TAG) > capstone-$(DIST_VERSION).zip
|
||||
|
||||
checkfuzz: fuzztest fuzzallcorp
|
||||
|
||||
FUZZ_INPUTS = $(shell find suite/MC -type f -name '*.cs')
|
||||
|
||||
buildfuzz:
|
||||
ifndef BUILDDIR
|
||||
$(MAKE) -C suite/fuzz
|
||||
else
|
||||
$(MAKE) -C suite/fuzz BUILDDIR=$(BLDIR)
|
||||
endif
|
||||
|
||||
fuzztest:
|
||||
./suite/fuzz/fuzz_disasm $(FUZZ_INPUTS)
|
||||
|
||||
fuzzallcorp:
|
||||
ifneq ($(wildcard suite/fuzz/corpus-libFuzzer-capstone_fuzz_disasmnext-latest),)
|
||||
./suite/fuzz/fuzz_bindisasm suite/fuzz/corpus-libFuzzer-capstone_fuzz_disasmnext-latest/ > fuzz_bindisasm.log || (tail -1 fuzz_bindisasm.log; false)
|
||||
else
|
||||
@echo "Skipping tests on whole corpus"
|
||||
endif
|
||||
|
||||
$(OBJDIR)/%.o: %.c
|
||||
@mkdir -p $(@D)
|
||||
ifeq ($(V),0)
|
||||
$(call log,CC,$(@:$(OBJDIR)/%=%))
|
||||
@$(compile)
|
||||
else
|
||||
$(compile)
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(CAPSTONE_SHARED),yes)
|
||||
define install-library
|
||||
$(INSTALL_LIB) $(LIBRARY) $1
|
||||
$(if $(VERSION_EXT),
|
||||
cd $1 && \
|
||||
rm -f lib$(LIBNAME).$(EXT) && \
|
||||
ln -s lib$(LIBNAME).$(VERSION_EXT) lib$(LIBNAME).$(EXT))
|
||||
endef
|
||||
else
|
||||
define install-library
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(AR_FLAGS),)
|
||||
AR_FLAGS := q
|
||||
endif
|
||||
|
||||
define create-archive
|
||||
$(AR) $(AR_FLAGS) $(ARCHIVE) $(LIBOBJ)
|
||||
$(RANLIB) $(ARCHIVE)
|
||||
endef
|
||||
|
||||
|
||||
define create-library
|
||||
$(CC) $(LDFLAGS) $($(LIBNAME)_LDFLAGS) $(LIBOBJ) -o $(LIBRARY)
|
||||
endef
|
||||
|
||||
|
||||
define generate-pkgcfg
|
||||
mkdir -p $(BLDIR)
|
||||
echo 'Name: capstone' > $(PKGCFGF)
|
||||
echo 'Description: Capstone disassembly engine' >> $(PKGCFGF)
|
||||
echo 'Version: $(PKG_VERSION)' >> $(PKGCFGF)
|
||||
echo 'libdir=$(LIBDIR)' >> $(PKGCFGF)
|
||||
echo 'includedir=$(INCDIR)/capstone' >> $(PKGCFGF)
|
||||
echo 'archive=$${libdir}/libcapstone.a' >> $(PKGCFGF)
|
||||
echo 'Libs: -L$${libdir} -lcapstone' >> $(PKGCFGF)
|
||||
echo 'Libs.private: -L$${libdir} -l:libcapstone.a' >> $(PKGCFGF)
|
||||
echo 'Cflags: -I$${includedir}' >> $(PKGCFGF)
|
||||
echo 'archs=${CAPSTONE_ARCHS}' >> $(PKGCFGF)
|
||||
endef
|
443
thirdparty/capstone/Mapping.c
vendored
Normal file
443
thirdparty/capstone/Mapping.c
vendored
Normal file
@@ -0,0 +1,443 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
/* Rot127 <unisono@quyllur.org>, 2022-2023 */
|
||||
|
||||
#include "Mapping.h"
|
||||
#include "capstone/capstone.h"
|
||||
#include "utils.h"
|
||||
|
||||
// create a cache for fast id lookup
|
||||
static unsigned short *make_id2insn(const insn_map *insns, unsigned int size)
|
||||
{
|
||||
// NOTE: assume that the max id is always put at the end of insns array
|
||||
unsigned short max_id = insns[size - 1].id;
|
||||
unsigned int i;
|
||||
|
||||
unsigned short *cache =
|
||||
(unsigned short *)cs_mem_calloc(max_id + 1, sizeof(*cache));
|
||||
|
||||
for (i = 1; i < size; i++)
|
||||
cache[insns[i].id] = i;
|
||||
|
||||
return cache;
|
||||
}
|
||||
|
||||
// look for @id in @insns, given its size in @max. first time call will update
|
||||
// @cache. return 0 if not found
|
||||
unsigned short insn_find(const insn_map *insns, unsigned int max,
|
||||
unsigned int id, unsigned short **cache)
|
||||
{
|
||||
if (id > insns[max - 1].id)
|
||||
return 0;
|
||||
|
||||
if (*cache == NULL)
|
||||
*cache = make_id2insn(insns, max);
|
||||
|
||||
return (*cache)[id];
|
||||
}
|
||||
|
||||
// Gives the id for the given @name if it is saved in @map.
|
||||
// Returns the id or -1 if not found.
|
||||
int name2id(const name_map *map, int max, const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < max; i++) {
|
||||
if (!strcmp(map[i].name, name)) {
|
||||
return map[i].id;
|
||||
}
|
||||
}
|
||||
|
||||
// nothing match
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Gives the name for the given @id if it is saved in @map.
|
||||
// Returns the name or NULL if not found.
|
||||
const char *id2name(const name_map *map, int max, const unsigned int id)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < max; i++) {
|
||||
if (map[i].id == id) {
|
||||
return map[i].name;
|
||||
}
|
||||
}
|
||||
|
||||
// nothing match
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/// Adds a register to the implicit write register list.
|
||||
/// It will not add the same register twice.
|
||||
void map_add_implicit_write(MCInst *MI, uint32_t Reg)
|
||||
{
|
||||
if (!MI->flat_insn->detail)
|
||||
return;
|
||||
|
||||
uint16_t *regs_write = MI->flat_insn->detail->regs_write;
|
||||
for (int i = 0; i < MAX_IMPL_W_REGS; ++i) {
|
||||
if (i == MI->flat_insn->detail->regs_write_count) {
|
||||
regs_write[i] = Reg;
|
||||
MI->flat_insn->detail->regs_write_count++;
|
||||
return;
|
||||
}
|
||||
if (regs_write[i] == Reg)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds a register to the implicit read register list.
|
||||
/// It will not add the same register twice.
|
||||
void map_add_implicit_read(MCInst *MI, uint32_t Reg)
|
||||
{
|
||||
if (!MI->flat_insn->detail)
|
||||
return;
|
||||
|
||||
uint16_t *regs_read = MI->flat_insn->detail->regs_read;
|
||||
for (int i = 0; i < MAX_IMPL_R_REGS; ++i) {
|
||||
if (i == MI->flat_insn->detail->regs_read_count) {
|
||||
regs_read[i] = Reg;
|
||||
MI->flat_insn->detail->regs_read_count++;
|
||||
return;
|
||||
}
|
||||
if (regs_read[i] == Reg)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// Removes a register from the implicit write register list.
|
||||
void map_remove_implicit_write(MCInst *MI, uint32_t Reg)
|
||||
{
|
||||
if (!MI->flat_insn->detail)
|
||||
return;
|
||||
|
||||
uint16_t *regs_write = MI->flat_insn->detail->regs_write;
|
||||
bool shorten_list = false;
|
||||
for (int i = 0; i < MAX_IMPL_W_REGS; ++i) {
|
||||
if (shorten_list) {
|
||||
regs_write[i - 1] = regs_write[i];
|
||||
}
|
||||
if (i >= MI->flat_insn->detail->regs_write_count)
|
||||
return;
|
||||
|
||||
if (regs_write[i] == Reg) {
|
||||
MI->flat_insn->detail->regs_write_count--;
|
||||
// The register should exist only once in the list.
|
||||
assert(!shorten_list);
|
||||
shorten_list = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Copies the implicit read registers of @imap to @MI->flat_insn.
|
||||
/// Already present registers will be preserved.
|
||||
void map_implicit_reads(MCInst *MI, const insn_map *imap)
|
||||
{
|
||||
#ifndef CAPSTONE_DIET
|
||||
if (!MI->flat_insn->detail)
|
||||
return;
|
||||
|
||||
cs_detail *detail = MI->flat_insn->detail;
|
||||
unsigned Opcode = MCInst_getOpcode(MI);
|
||||
unsigned i = 0;
|
||||
uint16_t reg = imap[Opcode].regs_use[i];
|
||||
while (reg != 0) {
|
||||
if (i >= MAX_IMPL_R_REGS ||
|
||||
detail->regs_read_count >= MAX_IMPL_R_REGS) {
|
||||
printf("ERROR: Too many implicit read register defined in "
|
||||
"instruction mapping.\n");
|
||||
return;
|
||||
}
|
||||
detail->regs_read[detail->regs_read_count++] = reg;
|
||||
reg = imap[Opcode].regs_use[++i];
|
||||
}
|
||||
#endif // CAPSTONE_DIET
|
||||
}
|
||||
|
||||
/// Copies the implicit write registers of @imap to @MI->flat_insn.
|
||||
/// Already present registers will be preserved.
|
||||
void map_implicit_writes(MCInst *MI, const insn_map *imap)
|
||||
{
|
||||
#ifndef CAPSTONE_DIET
|
||||
if (!MI->flat_insn->detail)
|
||||
return;
|
||||
|
||||
cs_detail *detail = MI->flat_insn->detail;
|
||||
unsigned Opcode = MCInst_getOpcode(MI);
|
||||
unsigned i = 0;
|
||||
uint16_t reg = imap[Opcode].regs_mod[i];
|
||||
while (reg != 0) {
|
||||
if (i >= MAX_IMPL_W_REGS ||
|
||||
detail->regs_write_count >= MAX_IMPL_W_REGS) {
|
||||
printf("ERROR: Too many implicit write register defined in "
|
||||
"instruction mapping.\n");
|
||||
return;
|
||||
}
|
||||
detail->regs_write[detail->regs_write_count++] = reg;
|
||||
reg = imap[Opcode].regs_mod[++i];
|
||||
}
|
||||
#endif // CAPSTONE_DIET
|
||||
}
|
||||
|
||||
/// Adds a given group to @MI->flat_insn.
|
||||
/// A group is never added twice.
|
||||
void add_group(MCInst *MI, unsigned /* arch_group */ group)
|
||||
{
|
||||
#ifndef CAPSTONE_DIET
|
||||
if (!MI->flat_insn->detail)
|
||||
return;
|
||||
|
||||
cs_detail *detail = MI->flat_insn->detail;
|
||||
if (detail->groups_count >= MAX_NUM_GROUPS) {
|
||||
printf("ERROR: Too many groups defined.\n");
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < detail->groups_count; ++i) {
|
||||
if (detail->groups[i] == group) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
detail->groups[detail->groups_count++] = group;
|
||||
#endif // CAPSTONE_DIET
|
||||
}
|
||||
|
||||
/// Copies the groups from @imap to @MI->flat_insn.
|
||||
/// Already present groups will be preserved.
|
||||
void map_groups(MCInst *MI, const insn_map *imap)
|
||||
{
|
||||
#ifndef CAPSTONE_DIET
|
||||
if (!MI->flat_insn->detail)
|
||||
return;
|
||||
|
||||
cs_detail *detail = MI->flat_insn->detail;
|
||||
unsigned Opcode = MCInst_getOpcode(MI);
|
||||
unsigned i = 0;
|
||||
uint16_t group = imap[Opcode].groups[i];
|
||||
while (group != 0) {
|
||||
if (detail->groups_count >= MAX_NUM_GROUPS) {
|
||||
printf("ERROR: Too many groups defined in instruction mapping.\n");
|
||||
return;
|
||||
}
|
||||
detail->groups[detail->groups_count++] = group;
|
||||
group = imap[Opcode].groups[++i];
|
||||
}
|
||||
#endif // CAPSTONE_DIET
|
||||
}
|
||||
|
||||
/// Returns the pointer to the supllementary information in
|
||||
/// the instruction mapping table @imap or NULL in case of failure.
|
||||
const void *map_get_suppl_info(MCInst *MI, const insn_map *imap)
|
||||
{
|
||||
#ifndef CAPSTONE_DIET
|
||||
if (!MI->flat_insn->detail)
|
||||
return NULL;
|
||||
|
||||
unsigned Opcode = MCInst_getOpcode(MI);
|
||||
return &imap[Opcode].suppl_info;
|
||||
#else
|
||||
return NULL;
|
||||
#endif // CAPSTONE_DIET
|
||||
}
|
||||
|
||||
// Search for the CS instruction id for the given @MC_Opcode in @imap.
|
||||
// return -1 if none is found.
|
||||
unsigned int find_cs_id(unsigned MC_Opcode, const insn_map *imap,
|
||||
unsigned imap_size)
|
||||
{
|
||||
// binary searching since the IDs are sorted in order
|
||||
unsigned int left, right, m;
|
||||
unsigned int max = imap_size;
|
||||
|
||||
right = max - 1;
|
||||
|
||||
if (MC_Opcode < imap[0].id || MC_Opcode > imap[right].id)
|
||||
// not found
|
||||
return -1;
|
||||
|
||||
left = 0;
|
||||
|
||||
while (left <= right) {
|
||||
m = (left + right) / 2;
|
||||
if (MC_Opcode == imap[m].id) {
|
||||
return m;
|
||||
}
|
||||
|
||||
if (MC_Opcode < imap[m].id)
|
||||
right = m - 1;
|
||||
else
|
||||
left = m + 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// Sets the Capstone instruction id which maps to the @MI opcode.
|
||||
/// If no mapping is found the function returns and prints an error.
|
||||
void map_cs_id(MCInst *MI, const insn_map *imap, unsigned int imap_size)
|
||||
{
|
||||
unsigned int i = find_cs_id(MCInst_getOpcode(MI), imap, imap_size);
|
||||
if (i != -1) {
|
||||
MI->flat_insn->id = imap[i].mapid;
|
||||
return;
|
||||
}
|
||||
printf("ERROR: Could not find CS id for MCInst opcode: %d\n",
|
||||
MCInst_getOpcode(MI));
|
||||
return;
|
||||
}
|
||||
|
||||
/// Returns the operand type information from the
|
||||
/// mapping table for instruction operands.
|
||||
/// Only usable by `auto-sync` archs!
|
||||
const cs_op_type mapping_get_op_type(MCInst *MI, unsigned OpNum,
|
||||
const map_insn_ops *insn_ops_map,
|
||||
size_t map_size)
|
||||
{
|
||||
assert(MI);
|
||||
assert(MI->Opcode < map_size);
|
||||
assert(OpNum < sizeof(insn_ops_map[MI->Opcode].ops) /
|
||||
sizeof(insn_ops_map[MI->Opcode].ops[0]));
|
||||
|
||||
return insn_ops_map[MI->Opcode].ops[OpNum].type;
|
||||
}
|
||||
|
||||
/// Returns the operand access flags from the
|
||||
/// mapping table for instruction operands.
|
||||
/// Only usable by `auto-sync` archs!
|
||||
const cs_ac_type mapping_get_op_access(MCInst *MI, unsigned OpNum,
|
||||
const map_insn_ops *insn_ops_map,
|
||||
size_t map_size)
|
||||
{
|
||||
assert(MI);
|
||||
assert(MI->Opcode < map_size);
|
||||
assert(OpNum < sizeof(insn_ops_map[MI->Opcode].ops) /
|
||||
sizeof(insn_ops_map[MI->Opcode].ops[0]));
|
||||
|
||||
cs_ac_type access = insn_ops_map[MI->Opcode].ops[OpNum].access;
|
||||
if (MCInst_opIsTied(MI, OpNum) || MCInst_opIsTying(MI, OpNum))
|
||||
access |= (access == CS_AC_READ) ? CS_AC_WRITE : CS_AC_READ;
|
||||
return access;
|
||||
}
|
||||
|
||||
/// Returns the operand at detail->arch.operands[op_count + offset]
|
||||
/// Or NULL if detail is not set.
|
||||
#define DEFINE_get_detail_op(arch, ARCH) \
|
||||
cs_##arch##_op *ARCH##_get_detail_op(MCInst *MI, int offset) \
|
||||
{ \
|
||||
if (!MI->flat_insn->detail) \
|
||||
return NULL; \
|
||||
int OpIdx = MI->flat_insn->detail->arch.op_count + offset; \
|
||||
assert(OpIdx >= 0 && OpIdx < MAX_MC_OPS); \
|
||||
return &MI->flat_insn->detail->arch.operands[OpIdx]; \
|
||||
}
|
||||
|
||||
DEFINE_get_detail_op(arm, ARM);
|
||||
DEFINE_get_detail_op(ppc, PPC);
|
||||
DEFINE_get_detail_op(tricore, TriCore);
|
||||
DEFINE_get_detail_op(aarch64, AArch64);
|
||||
DEFINE_get_detail_op(alpha, Alpha);
|
||||
DEFINE_get_detail_op(hppa, HPPA);
|
||||
DEFINE_get_detail_op(loongarch, LoongArch);
|
||||
DEFINE_get_detail_op(riscv, RISCV);
|
||||
|
||||
/// Returns true if for this architecture the
|
||||
/// alias operands should be filled.
|
||||
/// TODO: Replace this with a proper option.
|
||||
/// So it can be toggled between disas() calls.
|
||||
bool map_use_alias_details(const MCInst *MI) {
|
||||
assert(MI);
|
||||
return !(MI->csh->detail_opt & CS_OPT_DETAIL_REAL);
|
||||
}
|
||||
|
||||
/// Sets the setDetailOps flag to @p Val.
|
||||
/// If detail == NULLit refuses to set the flag to true.
|
||||
void map_set_fill_detail_ops(MCInst *MI, bool Val) {
|
||||
assert(MI);
|
||||
if (!detail_is_set(MI)) {
|
||||
MI->fillDetailOps = false;
|
||||
return;
|
||||
}
|
||||
|
||||
MI->fillDetailOps = Val;
|
||||
}
|
||||
|
||||
/// Sets the instruction alias flags and the given alias id.
|
||||
void map_set_is_alias_insn(MCInst *MI, bool Val, uint64_t Alias) {
|
||||
assert(MI);
|
||||
MI->isAliasInstr = Val;
|
||||
MI->flat_insn->is_alias = Val;
|
||||
MI->flat_insn->alias_id = Alias;
|
||||
}
|
||||
|
||||
static inline bool char_ends_mnem(const char c) {
|
||||
return (!c || c == ' ' || c == '\t');
|
||||
}
|
||||
|
||||
/// Sets an alternative id for some instruction.
|
||||
/// Or -1 if it fails.
|
||||
/// You must add (<ARCH>_INS_ALIAS_BEGIN + 1) to the id to get the real id.
|
||||
void map_set_alias_id(MCInst *MI, const SStream *O, const name_map *alias_mnem_id_map, int map_size) {
|
||||
if (!MCInst_isAlias(MI))
|
||||
return;
|
||||
|
||||
char alias_mnem[16] = { 0 };
|
||||
int i = 0, j = 0;
|
||||
const char *asm_str_buf = O->buffer;
|
||||
// Skip spaces and tabs
|
||||
while (is_blank_char(asm_str_buf[i])) {
|
||||
if (!asm_str_buf[i]) {
|
||||
MI->flat_insn->alias_id = -1;
|
||||
return;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
for (; j < sizeof(alias_mnem) - 1; ++j, ++i) {
|
||||
if (char_ends_mnem(asm_str_buf[i]))
|
||||
break;
|
||||
alias_mnem[j] = asm_str_buf[i];
|
||||
}
|
||||
|
||||
MI->flat_insn->alias_id = name2id(alias_mnem_id_map, map_size, alias_mnem);
|
||||
}
|
||||
|
||||
/// Does a binary search over the given map and searches for @id.
|
||||
/// If @id exists in @map, it sets @found to true and returns
|
||||
/// the value for the @id.
|
||||
/// Otherwise, @found is set to false and it returns UINT64_MAX.
|
||||
///
|
||||
/// Of course it assumes the map is sorted.
|
||||
uint64_t enum_map_bin_search(const cs_enum_id_map *map, size_t map_len,
|
||||
const char *id, bool *found)
|
||||
{
|
||||
size_t l = 0;
|
||||
size_t r = map_len;
|
||||
size_t id_len = strlen(id);
|
||||
|
||||
while (l <= r) {
|
||||
size_t m = (l + r) / 2;
|
||||
size_t j = 0;
|
||||
size_t i = 0;
|
||||
size_t entry_len = strlen(map[m].str);
|
||||
|
||||
while (j < entry_len && i < id_len && id[i] == map[m].str[j]) {
|
||||
++j, ++i;
|
||||
}
|
||||
if (i == id_len && j == entry_len) {
|
||||
*found = true;
|
||||
return map[m].val;
|
||||
}
|
||||
|
||||
if (id[i] < map[m].str[j]) {
|
||||
r = m - 1;
|
||||
} else if (id[i] > map[m].str[j]) {
|
||||
l = m + 1;
|
||||
}
|
||||
if (m == 0 || (l + r) / 2 >= map_len) {
|
||||
// Break before we go out of bounds.
|
||||
break;
|
||||
}
|
||||
}
|
||||
*found = false;
|
||||
return UINT64_MAX;
|
||||
}
|
||||
|
258
thirdparty/capstone/Mapping.h
vendored
Normal file
258
thirdparty/capstone/Mapping.h
vendored
Normal file
@@ -0,0 +1,258 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
/* Rot127 <unisono@quyllur.org>, 2022-2023 */
|
||||
|
||||
#ifndef CS_MAPPING_H
|
||||
#define CS_MAPPING_H
|
||||
|
||||
#if defined(CAPSTONE_HAS_OSXKERNEL)
|
||||
#include <libkern/libkern.h>
|
||||
#else
|
||||
#include "include/capstone/capstone.h"
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
#include "cs_priv.h"
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
// map instruction to its characteristics
|
||||
typedef struct insn_map {
|
||||
unsigned short id; // The LLVM instruction id
|
||||
unsigned short mapid; // The Capstone instruction id
|
||||
#ifndef CAPSTONE_DIET
|
||||
uint16_t regs_use[MAX_IMPL_R_REGS]; ///< list of implicit registers used by
|
||||
///< this instruction
|
||||
uint16_t regs_mod[MAX_IMPL_W_REGS]; ///< list of implicit registers modified
|
||||
///< by this instruction
|
||||
unsigned char groups
|
||||
[MAX_NUM_GROUPS]; ///< list of group this instruction belong to
|
||||
bool branch; // branch instruction?
|
||||
bool indirect_branch; // indirect branch instruction?
|
||||
union {
|
||||
ppc_suppl_info ppc;
|
||||
loongarch_suppl_info loongarch;
|
||||
aarch64_suppl_info aarch64;
|
||||
} suppl_info; // Supplementary information for each instruction.
|
||||
#endif
|
||||
} insn_map;
|
||||
|
||||
// look for @id in @m, given its size in @max. first time call will update
|
||||
// @cache. return 0 if not found
|
||||
unsigned short insn_find(const insn_map *m, unsigned int max, unsigned int id,
|
||||
unsigned short **cache);
|
||||
|
||||
unsigned int find_cs_id(unsigned MC_Opcode, const insn_map *imap,
|
||||
unsigned imap_size);
|
||||
|
||||
#define MAX_NO_DATA_TYPES 16
|
||||
|
||||
///< A LLVM<->CS Mapping entry of an MCOperand.
|
||||
typedef struct {
|
||||
uint8_t /* cs_op_type */ type; ///< Operand type (e.g.: reg, imm, mem)
|
||||
uint8_t /* cs_ac_type */ access; ///< The access type (read, write)
|
||||
uint8_t /* cs_data_type */
|
||||
dtypes[MAX_NO_DATA_TYPES]; ///< List of op types. Terminated by
|
||||
///< CS_DATA_TYPE_LAST
|
||||
} mapping_op;
|
||||
|
||||
#define MAX_NO_INSN_MAP_OPS 16
|
||||
|
||||
///< MCOperands of an instruction.
|
||||
typedef struct {
|
||||
mapping_op
|
||||
ops[MAX_NO_INSN_MAP_OPS]; ///< NULL terminated array of insn_op.
|
||||
} map_insn_ops;
|
||||
|
||||
/// Only usable by `auto-sync` archs!
|
||||
const cs_op_type mapping_get_op_type(MCInst *MI, unsigned OpNum,
|
||||
const map_insn_ops *insn_ops_map,
|
||||
size_t map_size);
|
||||
|
||||
/// Only usable by `auto-sync` archs!
|
||||
const cs_ac_type mapping_get_op_access(MCInst *MI, unsigned OpNum,
|
||||
const map_insn_ops *insn_ops_map,
|
||||
size_t map_size);
|
||||
|
||||
/// Macro for easier access of operand types from the map.
|
||||
/// Assumes the istruction operands map is called "insn_operands"
|
||||
/// Only usable by `auto-sync` archs!
|
||||
#ifndef CAPSTONE_DIET
|
||||
#define map_get_op_type(MI, OpNum) \
|
||||
mapping_get_op_type(MI, OpNum, (const map_insn_ops *)insn_operands, \
|
||||
sizeof(insn_operands) / sizeof(insn_operands[0]))
|
||||
#else
|
||||
#define map_get_op_type(MI, OpNum) \
|
||||
CS_OP_INVALID
|
||||
#endif
|
||||
|
||||
/// Macro for easier access of operand access flags from the map.
|
||||
/// Assumes the istruction operands map is called "insn_operands"
|
||||
/// Only usable by `auto-sync` archs!
|
||||
#ifndef CAPSTONE_DIET
|
||||
#define map_get_op_access(MI, OpNum) \
|
||||
mapping_get_op_access(MI, OpNum, (const map_insn_ops *)insn_operands, \
|
||||
sizeof(insn_operands) / \
|
||||
sizeof(insn_operands[0]))
|
||||
#else
|
||||
#define map_get_op_access(MI, OpNum) \
|
||||
CS_AC_INVALID
|
||||
#endif
|
||||
|
||||
///< Map for ids to their string
|
||||
typedef struct name_map {
|
||||
unsigned int id;
|
||||
const char *name;
|
||||
} name_map;
|
||||
|
||||
// map a name to its ID
|
||||
// return 0 if not found
|
||||
int name2id(const name_map *map, int max, const char *name);
|
||||
|
||||
// map ID to a name
|
||||
// return NULL if not found
|
||||
const char *id2name(const name_map *map, int max, const unsigned int id);
|
||||
|
||||
void map_add_implicit_write(MCInst *MI, uint32_t Reg);
|
||||
void map_add_implicit_read(MCInst *MI, uint32_t Reg);
|
||||
void map_remove_implicit_write(MCInst *MI, uint32_t Reg);
|
||||
|
||||
void map_implicit_reads(MCInst *MI, const insn_map *imap);
|
||||
|
||||
void map_implicit_writes(MCInst *MI, const insn_map *imap);
|
||||
|
||||
void add_group(MCInst *MI, unsigned /* arch_group */ group);
|
||||
|
||||
void map_groups(MCInst *MI, const insn_map *imap);
|
||||
|
||||
void map_cs_id(MCInst *MI, const insn_map *imap, unsigned int imap_size);
|
||||
|
||||
const void *map_get_suppl_info(MCInst *MI, const insn_map *imap);
|
||||
|
||||
#define DECL_get_detail_op(arch, ARCH) \
|
||||
cs_##arch##_op *ARCH##_get_detail_op(MCInst *MI, int offset);
|
||||
|
||||
DECL_get_detail_op(arm, ARM);
|
||||
DECL_get_detail_op(ppc, PPC);
|
||||
DECL_get_detail_op(tricore, TriCore);
|
||||
DECL_get_detail_op(aarch64, AArch64);
|
||||
DECL_get_detail_op(alpha, Alpha);
|
||||
DECL_get_detail_op(hppa, HPPA);
|
||||
DECL_get_detail_op(loongarch, LoongArch);
|
||||
DECL_get_detail_op(riscv, RISCV);
|
||||
|
||||
/// Increments the detail->arch.op_count by one.
|
||||
#define DEFINE_inc_detail_op_count(arch, ARCH) \
|
||||
static inline void ARCH##_inc_op_count(MCInst *MI) \
|
||||
{ \
|
||||
MI->flat_insn->detail->arch.op_count++; \
|
||||
}
|
||||
|
||||
/// Decrements the detail->arch.op_count by one.
|
||||
#define DEFINE_dec_detail_op_count(arch, ARCH) \
|
||||
static inline void ARCH##_dec_op_count(MCInst *MI) \
|
||||
{ \
|
||||
MI->flat_insn->detail->arch.op_count--; \
|
||||
}
|
||||
|
||||
DEFINE_inc_detail_op_count(arm, ARM);
|
||||
DEFINE_dec_detail_op_count(arm, ARM);
|
||||
DEFINE_inc_detail_op_count(ppc, PPC);
|
||||
DEFINE_dec_detail_op_count(ppc, PPC);
|
||||
DEFINE_inc_detail_op_count(tricore, TriCore);
|
||||
DEFINE_dec_detail_op_count(tricore, TriCore);
|
||||
DEFINE_inc_detail_op_count(aarch64, AArch64);
|
||||
DEFINE_dec_detail_op_count(aarch64, AArch64);
|
||||
DEFINE_inc_detail_op_count(alpha, Alpha);
|
||||
DEFINE_dec_detail_op_count(alpha, Alpha);
|
||||
DEFINE_inc_detail_op_count(hppa, HPPA);
|
||||
DEFINE_dec_detail_op_count(hppa, HPPA);
|
||||
DEFINE_inc_detail_op_count(loongarch, LoongArch);
|
||||
DEFINE_dec_detail_op_count(loongarch, LoongArch);
|
||||
DEFINE_inc_detail_op_count(riscv, RISCV);
|
||||
DEFINE_dec_detail_op_count(riscv, RISCV);
|
||||
|
||||
/// Returns true if a memory operand is currently edited.
|
||||
static inline bool doing_mem(const MCInst *MI)
|
||||
{
|
||||
return MI->csh->doing_mem;
|
||||
}
|
||||
|
||||
/// Sets the doing_mem flag to @status.
|
||||
static inline void set_doing_mem(const MCInst *MI, bool status)
|
||||
{
|
||||
MI->csh->doing_mem = status;
|
||||
}
|
||||
|
||||
/// Returns detail->arch
|
||||
#define DEFINE_get_arch_detail(arch, ARCH) \
|
||||
static inline cs_##arch *ARCH##_get_detail(const MCInst *MI) \
|
||||
{ \
|
||||
assert(MI && MI->flat_insn && MI->flat_insn->detail); \
|
||||
return &MI->flat_insn->detail->arch; \
|
||||
}
|
||||
|
||||
DEFINE_get_arch_detail(arm, ARM);
|
||||
DEFINE_get_arch_detail(ppc, PPC);
|
||||
DEFINE_get_arch_detail(tricore, TriCore);
|
||||
DEFINE_get_arch_detail(aarch64, AArch64);
|
||||
DEFINE_get_arch_detail(alpha, Alpha);
|
||||
DEFINE_get_arch_detail(hppa, HPPA);
|
||||
DEFINE_get_arch_detail(loongarch, LoongArch);
|
||||
DEFINE_get_arch_detail(riscv, RISCV);
|
||||
|
||||
static inline bool detail_is_set(const MCInst *MI)
|
||||
{
|
||||
assert(MI && MI->flat_insn);
|
||||
return MI->flat_insn->detail != NULL && MI->csh->detail_opt & CS_OPT_ON;
|
||||
}
|
||||
|
||||
static inline cs_detail *get_detail(const MCInst *MI)
|
||||
{
|
||||
assert(MI && MI->flat_insn);
|
||||
return MI->flat_insn->detail;
|
||||
}
|
||||
|
||||
/// Returns if the given instruction is an alias instruction.
|
||||
#define RETURN_IF_INSN_IS_ALIAS(MI) \
|
||||
do { \
|
||||
if (MI->isAliasInstr) \
|
||||
return; \
|
||||
} while(0)
|
||||
|
||||
void map_set_fill_detail_ops(MCInst *MI, bool Val);
|
||||
|
||||
static inline bool map_fill_detail_ops(MCInst *MI) {
|
||||
assert(MI);
|
||||
return MI->fillDetailOps;
|
||||
}
|
||||
|
||||
void map_set_is_alias_insn(MCInst *MI, bool Val, uint64_t Alias);
|
||||
|
||||
bool map_use_alias_details(const MCInst *MI);
|
||||
|
||||
void map_set_alias_id(MCInst *MI, const SStream *O, const name_map *alias_mnem_id_map, int map_size);
|
||||
|
||||
/// Mapping from Capstone enumeration identifiers and their values.
|
||||
///
|
||||
/// This map MUST BE sorted to allow binary searches.
|
||||
/// Please always ensure the map is sorted after you added a value.
|
||||
///
|
||||
/// You can sort the map with Python.
|
||||
/// Copy the map into a file and run:
|
||||
///
|
||||
/// ```python
|
||||
/// with open("/tmp/file_with_map_entries") as f:
|
||||
/// text = f.readlines()
|
||||
///
|
||||
/// text.sort()
|
||||
/// print(''.join(text))
|
||||
/// ```
|
||||
typedef struct {
|
||||
const char *str; ///< The name of the enumeration identifier
|
||||
uint64_t val; ///< The value of the identifier
|
||||
} cs_enum_id_map;
|
||||
|
||||
uint64_t enum_map_bin_search(const cs_enum_id_map *map, size_t map_len,
|
||||
const char *id, bool *found);
|
||||
|
||||
#endif // CS_MAPPING_H
|
488
thirdparty/capstone/MathExtras.h
vendored
Normal file
488
thirdparty/capstone/MathExtras.h
vendored
Normal file
@@ -0,0 +1,488 @@
|
||||
//===-- llvm/Support/MathExtras.h - Useful math functions -------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains some functions that are useful for math stuff.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
|
||||
#ifndef CS_LLVM_SUPPORT_MATHEXTRAS_H
|
||||
#define CS_LLVM_SUPPORT_MATHEXTRAS_H
|
||||
|
||||
#if defined(_WIN32_WCE) && (_WIN32_WCE < 0x800)
|
||||
#include "windowsce/intrin.h"
|
||||
#elif defined(_MSC_VER)
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifdef _MSC_VER
|
||||
#define inline /* inline */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// NOTE: The following support functions use the _32/_64 extensions instead of
|
||||
// type overloading so that signed and unsigned integers can be used without
|
||||
// ambiguity.
|
||||
|
||||
/// Hi_32 - This function returns the high 32 bits of a 64 bit value.
|
||||
static inline uint32_t Hi_32(uint64_t Value) {
|
||||
return (uint32_t)(Value >> 32);
|
||||
}
|
||||
|
||||
/// Lo_32 - This function returns the low 32 bits of a 64 bit value.
|
||||
static inline uint32_t Lo_32(uint64_t Value) {
|
||||
return (uint32_t)(Value);
|
||||
}
|
||||
|
||||
/// isUIntN - Checks if an unsigned integer fits into the given (dynamic)
|
||||
/// bit width.
|
||||
static inline bool isUIntN(unsigned N, uint64_t x) {
|
||||
return x == (x & (~0ULL >> (64 - N)));
|
||||
}
|
||||
|
||||
/// isIntN - Checks if an signed integer fits into the given (dynamic)
|
||||
/// bit width.
|
||||
//static inline bool isIntN(unsigned N, int64_t x) {
|
||||
// return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1)));
|
||||
//}
|
||||
|
||||
/// isMask_32 - This function returns true if the argument is a sequence of ones
|
||||
/// starting at the least significant bit with the remainder zero (32 bit
|
||||
/// version). Ex. isMask_32(0x0000FFFFU) == true.
|
||||
static inline bool isMask_32(uint32_t Value) {
|
||||
return Value && ((Value + 1) & Value) == 0;
|
||||
}
|
||||
|
||||
/// isMask_64 - This function returns true if the argument is a sequence of ones
|
||||
/// starting at the least significant bit with the remainder zero (64 bit
|
||||
/// version).
|
||||
static inline bool isMask_64(uint64_t Value) {
|
||||
return Value && ((Value + 1) & Value) == 0;
|
||||
}
|
||||
|
||||
/// isShiftedMask_32 - This function returns true if the argument contains a
|
||||
/// sequence of ones with the remainder zero (32 bit version.)
|
||||
/// Ex. isShiftedMask_32(0x0000FF00U) == true.
|
||||
static inline bool isShiftedMask_32(uint32_t Value) {
|
||||
return isMask_32((Value - 1) | Value);
|
||||
}
|
||||
|
||||
/// isShiftedMask_64 - This function returns true if the argument contains a
|
||||
/// sequence of ones with the remainder zero (64 bit version.)
|
||||
static inline bool isShiftedMask_64(uint64_t Value) {
|
||||
return isMask_64((Value - 1) | Value);
|
||||
}
|
||||
|
||||
/// isPowerOf2_32 - This function returns true if the argument is a power of
|
||||
/// two > 0. Ex. isPowerOf2_32(0x00100000U) == true (32 bit edition.)
|
||||
static inline bool isPowerOf2_32(uint32_t Value) {
|
||||
return Value && !(Value & (Value - 1));
|
||||
}
|
||||
|
||||
/// CountLeadingZeros_32 - this function performs the platform optimal form of
|
||||
/// counting the number of zeros from the most significant bit to the first one
|
||||
/// bit. Ex. CountLeadingZeros_32(0x00F000FF) == 8.
|
||||
/// Returns 32 if the word is zero.
|
||||
static inline unsigned CountLeadingZeros_32(uint32_t Value) {
|
||||
unsigned Count; // result
|
||||
#if __GNUC__ >= 4
|
||||
// PowerPC is defined for __builtin_clz(0)
|
||||
#if !defined(__ppc__) && !defined(__ppc64__)
|
||||
if (!Value) return 32;
|
||||
#endif
|
||||
Count = __builtin_clz(Value);
|
||||
#else
|
||||
unsigned Shift;
|
||||
if (!Value) return 32;
|
||||
Count = 0;
|
||||
// bisection method for count leading zeros
|
||||
for (Shift = 32 >> 1; Shift; Shift >>= 1) {
|
||||
uint32_t Tmp = Value >> Shift;
|
||||
if (Tmp) {
|
||||
Value = Tmp;
|
||||
} else {
|
||||
Count |= Shift;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Count;
|
||||
}
|
||||
|
||||
/// CountLeadingOnes_32 - this function performs the operation of
|
||||
/// counting the number of ones from the most significant bit to the first zero
|
||||
/// bit. Ex. CountLeadingOnes_32(0xFF0FFF00) == 8.
|
||||
/// Returns 32 if the word is all ones.
|
||||
static inline unsigned CountLeadingOnes_32(uint32_t Value) {
|
||||
return CountLeadingZeros_32(~Value);
|
||||
}
|
||||
|
||||
/// CountLeadingZeros_64 - This function performs the platform optimal form
|
||||
/// of counting the number of zeros from the most significant bit to the first
|
||||
/// one bit (64 bit edition.)
|
||||
/// Returns 64 if the word is zero.
|
||||
static inline unsigned CountLeadingZeros_64(uint64_t Value) {
|
||||
unsigned Count; // result
|
||||
#if __GNUC__ >= 4
|
||||
// PowerPC is defined for __builtin_clzll(0)
|
||||
#if !defined(__ppc__) && !defined(__ppc64__)
|
||||
if (!Value) return 64;
|
||||
#endif
|
||||
Count = __builtin_clzll(Value);
|
||||
#else
|
||||
#ifndef _MSC_VER
|
||||
unsigned Shift;
|
||||
if (sizeof(long) == sizeof(int64_t))
|
||||
{
|
||||
if (!Value) return 64;
|
||||
Count = 0;
|
||||
// bisection method for count leading zeros
|
||||
for (Shift = 64 >> 1; Shift; Shift >>= 1) {
|
||||
uint64_t Tmp = Value >> Shift;
|
||||
if (Tmp) {
|
||||
Value = Tmp;
|
||||
} else {
|
||||
Count |= Shift;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// get hi portion
|
||||
uint32_t Hi = Hi_32(Value);
|
||||
|
||||
// if some bits in hi portion
|
||||
if (Hi) {
|
||||
// leading zeros in hi portion plus all bits in lo portion
|
||||
Count = CountLeadingZeros_32(Hi);
|
||||
} else {
|
||||
// get lo portion
|
||||
uint32_t Lo = Lo_32(Value);
|
||||
// same as 32 bit value
|
||||
Count = CountLeadingZeros_32(Lo)+32;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Count;
|
||||
}
|
||||
|
||||
/// CountLeadingOnes_64 - This function performs the operation
|
||||
/// of counting the number of ones from the most significant bit to the first
|
||||
/// zero bit (64 bit edition.)
|
||||
/// Returns 64 if the word is all ones.
|
||||
static inline unsigned CountLeadingOnes_64(uint64_t Value) {
|
||||
return CountLeadingZeros_64(~Value);
|
||||
}
|
||||
|
||||
/// CountTrailingZeros_32 - this function performs the platform optimal form of
|
||||
/// counting the number of zeros from the least significant bit to the first one
|
||||
/// bit. Ex. CountTrailingZeros_32(0xFF00FF00) == 8.
|
||||
/// Returns 32 if the word is zero.
|
||||
static inline unsigned CountTrailingZeros_32(uint32_t Value) {
|
||||
#if __GNUC__ >= 4
|
||||
return Value ? __builtin_ctz(Value) : 32;
|
||||
#else
|
||||
static const unsigned Mod37BitPosition[] = {
|
||||
32, 0, 1, 26, 2, 23, 27, 0, 3, 16, 24, 30, 28, 11, 0, 13,
|
||||
4, 7, 17, 0, 25, 22, 31, 15, 29, 10, 12, 6, 0, 21, 14, 9,
|
||||
5, 20, 8, 19, 18
|
||||
};
|
||||
// Replace "-Value" by "1+~Value" in the following commented code to avoid
|
||||
// MSVC warning C4146
|
||||
// return Mod37BitPosition[(-Value & Value) % 37];
|
||||
return Mod37BitPosition[((1 + ~Value) & Value) % 37];
|
||||
#endif
|
||||
}
|
||||
|
||||
// Count trailing zeros as in:
|
||||
// https://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightParallel
|
||||
static inline unsigned CountTrailingZeros_8(uint8_t Value) {
|
||||
uint8_t c = 8;
|
||||
Value &= -((int8_t)Value);
|
||||
if (Value) c--;
|
||||
if (Value & 0x0F) c -= 4;
|
||||
if (Value & 0x33) c -= 2;
|
||||
if (Value & 0x55) c -= 1;
|
||||
return c;
|
||||
}
|
||||
|
||||
/// CountTrailingOnes_32 - this function performs the operation of
|
||||
/// counting the number of ones from the least significant bit to the first zero
|
||||
/// bit. Ex. CountTrailingOnes_32(0x00FF00FF) == 8.
|
||||
/// Returns 32 if the word is all ones.
|
||||
static inline unsigned CountTrailingOnes_32(uint32_t Value) {
|
||||
return CountTrailingZeros_32(~Value);
|
||||
}
|
||||
|
||||
/// CountTrailingZeros_64 - This function performs the platform optimal form
|
||||
/// of counting the number of zeros from the least significant bit to the first
|
||||
/// one bit (64 bit edition.)
|
||||
/// Returns 64 if the word is zero.
|
||||
static inline unsigned CountTrailingZeros_64(uint64_t Value) {
|
||||
#if __GNUC__ >= 4
|
||||
return Value ? __builtin_ctzll(Value) : 64;
|
||||
#else
|
||||
static const unsigned Mod67Position[] = {
|
||||
64, 0, 1, 39, 2, 15, 40, 23, 3, 12, 16, 59, 41, 19, 24, 54,
|
||||
4, 64, 13, 10, 17, 62, 60, 28, 42, 30, 20, 51, 25, 44, 55,
|
||||
47, 5, 32, 65, 38, 14, 22, 11, 58, 18, 53, 63, 9, 61, 27,
|
||||
29, 50, 43, 46, 31, 37, 21, 57, 52, 8, 26, 49, 45, 36, 56,
|
||||
7, 48, 35, 6, 34, 33, 0
|
||||
};
|
||||
// Replace "-Value" by "1+~Value" in the following commented code to avoid
|
||||
// MSVC warning C4146
|
||||
// return Mod67Position[(-Value & Value) % 67];
|
||||
return Mod67Position[((1 + ~Value) & Value) % 67];
|
||||
#endif
|
||||
}
|
||||
|
||||
/// CountTrailingOnes_64 - This function performs the operation
|
||||
/// of counting the number of ones from the least significant bit to the first
|
||||
/// zero bit (64 bit edition.)
|
||||
/// Returns 64 if the word is all ones.
|
||||
static inline unsigned CountTrailingOnes_64(uint64_t Value) {
|
||||
return CountTrailingZeros_64(~Value);
|
||||
}
|
||||
|
||||
/// CountPopulation_32 - this function counts the number of set bits in a value.
|
||||
/// Ex. CountPopulation(0xF000F000) = 8
|
||||
/// Returns 0 if the word is zero.
|
||||
static inline unsigned CountPopulation_32(uint32_t Value) {
|
||||
#if __GNUC__ >= 4
|
||||
return __builtin_popcount(Value);
|
||||
#else
|
||||
uint32_t v = Value - ((Value >> 1) & 0x55555555);
|
||||
v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
|
||||
return (((v + (v >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// CountPopulation_64 - this function counts the number of set bits in a value,
|
||||
/// (64 bit edition.)
|
||||
static inline unsigned CountPopulation_64(uint64_t Value) {
|
||||
#if __GNUC__ >= 4
|
||||
return __builtin_popcountll(Value);
|
||||
#else
|
||||
uint64_t v = Value - ((Value >> 1) & 0x5555555555555555ULL);
|
||||
v = (v & 0x3333333333333333ULL) + ((v >> 2) & 0x3333333333333333ULL);
|
||||
v = (v + (v >> 4)) & 0x0F0F0F0F0F0F0F0FULL;
|
||||
return (uint64_t)((v * 0x0101010101010101ULL) >> 56);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Log2_32 - This function returns the floor log base 2 of the specified value,
|
||||
/// -1 if the value is zero. (32 bit edition.)
|
||||
/// Ex. Log2_32(32) == 5, Log2_32(1) == 0, Log2_32(0) == -1, Log2_32(6) == 2
|
||||
static inline unsigned Log2_32(uint32_t Value) {
|
||||
return 31 - CountLeadingZeros_32(Value);
|
||||
}
|
||||
|
||||
/// Log2_64 - This function returns the floor log base 2 of the specified value,
|
||||
/// -1 if the value is zero. (64 bit edition.)
|
||||
static inline unsigned Log2_64(uint64_t Value) {
|
||||
return 63 - CountLeadingZeros_64(Value);
|
||||
}
|
||||
|
||||
/// Log2_32_Ceil - This function returns the ceil log base 2 of the specified
|
||||
/// value, 32 if the value is zero. (32 bit edition).
|
||||
/// Ex. Log2_32_Ceil(32) == 5, Log2_32_Ceil(1) == 0, Log2_32_Ceil(6) == 3
|
||||
static inline unsigned Log2_32_Ceil(uint32_t Value) {
|
||||
return 32-CountLeadingZeros_32(Value-1);
|
||||
}
|
||||
|
||||
/// Log2_64_Ceil - This function returns the ceil log base 2 of the specified
|
||||
/// value, 64 if the value is zero. (64 bit edition.)
|
||||
static inline unsigned Log2_64_Ceil(uint64_t Value) {
|
||||
return 64-CountLeadingZeros_64(Value-1);
|
||||
}
|
||||
|
||||
/// GreatestCommonDivisor64 - Return the greatest common divisor of the two
|
||||
/// values using Euclid's algorithm.
|
||||
static inline uint64_t GreatestCommonDivisor64(uint64_t A, uint64_t B) {
|
||||
while (B) {
|
||||
uint64_t T = B;
|
||||
B = A % B;
|
||||
A = T;
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
/// BitsToDouble - This function takes a 64-bit integer and returns the bit
|
||||
/// equivalent double.
|
||||
static inline double BitsToDouble(uint64_t Bits) {
|
||||
union {
|
||||
uint64_t L;
|
||||
double D;
|
||||
} T;
|
||||
T.L = Bits;
|
||||
return T.D;
|
||||
}
|
||||
|
||||
/// BitsToFloat - This function takes a 32-bit integer and returns the bit
|
||||
/// equivalent float.
|
||||
static inline float BitsToFloat(uint32_t Bits) {
|
||||
union {
|
||||
uint32_t I;
|
||||
float F;
|
||||
} T;
|
||||
T.I = Bits;
|
||||
return T.F;
|
||||
}
|
||||
|
||||
/// DoubleToBits - This function takes a double and returns the bit
|
||||
/// equivalent 64-bit integer. Note that copying doubles around
|
||||
/// changes the bits of NaNs on some hosts, notably x86, so this
|
||||
/// routine cannot be used if these bits are needed.
|
||||
static inline uint64_t DoubleToBits(double Double) {
|
||||
union {
|
||||
uint64_t L;
|
||||
double D;
|
||||
} T;
|
||||
T.D = Double;
|
||||
return T.L;
|
||||
}
|
||||
|
||||
/// FloatToBits - This function takes a float and returns the bit
|
||||
/// equivalent 32-bit integer. Note that copying floats around
|
||||
/// changes the bits of NaNs on some hosts, notably x86, so this
|
||||
/// routine cannot be used if these bits are needed.
|
||||
static inline uint32_t FloatToBits(float Float) {
|
||||
union {
|
||||
uint32_t I;
|
||||
float F;
|
||||
} T;
|
||||
T.F = Float;
|
||||
return T.I;
|
||||
}
|
||||
|
||||
/// MinAlign - A and B are either alignments or offsets. Return the minimum
|
||||
/// alignment that may be assumed after adding the two together.
|
||||
static inline uint64_t MinAlign(uint64_t A, uint64_t B) {
|
||||
// The largest power of 2 that divides both A and B.
|
||||
//
|
||||
// Replace "-Value" by "1+~Value" in the following commented code to avoid
|
||||
// MSVC warning C4146
|
||||
// return (A | B) & -(A | B);
|
||||
return (A | B) & (1 + ~(A | B));
|
||||
}
|
||||
|
||||
/// NextPowerOf2 - Returns the next power of two (in 64-bits)
|
||||
/// that is strictly greater than A. Returns zero on overflow.
|
||||
static inline uint64_t NextPowerOf2(uint64_t A) {
|
||||
A |= (A >> 1);
|
||||
A |= (A >> 2);
|
||||
A |= (A >> 4);
|
||||
A |= (A >> 8);
|
||||
A |= (A >> 16);
|
||||
A |= (A >> 32);
|
||||
return A + 1;
|
||||
}
|
||||
|
||||
/// Returns the next integer (mod 2**64) that is greater than or equal to
|
||||
/// \p Value and is a multiple of \p Align. \p Align must be non-zero.
|
||||
///
|
||||
/// Examples:
|
||||
/// \code
|
||||
/// RoundUpToAlignment(5, 8) = 8
|
||||
/// RoundUpToAlignment(17, 8) = 24
|
||||
/// RoundUpToAlignment(~0LL, 8) = 0
|
||||
/// \endcode
|
||||
static inline uint64_t RoundUpToAlignment(uint64_t Value, uint64_t Align) {
|
||||
return ((Value + Align - 1) / Align) * Align;
|
||||
}
|
||||
|
||||
/// Returns the offset to the next integer (mod 2**64) that is greater than
|
||||
/// or equal to \p Value and is a multiple of \p Align. \p Align must be
|
||||
/// non-zero.
|
||||
static inline uint64_t OffsetToAlignment(uint64_t Value, uint64_t Align) {
|
||||
return RoundUpToAlignment(Value, Align) - Value;
|
||||
}
|
||||
|
||||
/// abs64 - absolute value of a 64-bit int. Not all environments support
|
||||
/// "abs" on whatever their name for the 64-bit int type is. The absolute
|
||||
/// value of the largest negative number is undefined, as with "abs".
|
||||
static inline int64_t abs64(int64_t x) {
|
||||
return (x < 0) ? -x : x;
|
||||
}
|
||||
|
||||
/// \brief Sign extend number in the bottom B bits of X to a 32-bit int.
|
||||
/// Requires 0 < B <= 32.
|
||||
/// Note that this implementation relies on right shift of signed
|
||||
/// integers being an arithmetic shift.
|
||||
static inline int32_t SignExtend32(uint32_t X, unsigned B) {
|
||||
return (int32_t)(X << (32 - B)) >> (32 - B);
|
||||
}
|
||||
|
||||
/// \brief Sign extend number in the bottom B bits of X to a 64-bit int.
|
||||
/// Requires 0 < B <= 64.
|
||||
/// Note that this implementation relies on right shift of signed
|
||||
/// integers being an arithmetic shift.
|
||||
static inline int64_t SignExtend64(uint64_t X, unsigned B) {
|
||||
return (int64_t)(X << (64 - B)) >> (64 - B);
|
||||
}
|
||||
|
||||
/// \brief Removes the rightmost bit of x and extends the field to the left with that
|
||||
/// bit to form a 64-bit quantity. The field is of size len
|
||||
static inline int64_t LowSignExtend64(uint64_t x, unsigned len) {
|
||||
return (x >> 1) - ((x & 1) << (len - 1));
|
||||
}
|
||||
|
||||
/// \brief One extend number X starting at bit B and returns it as int32_t.
|
||||
/// Requires 0 < B <= 32.
|
||||
static inline int32_t OneExtend32(uint32_t X, unsigned B) {
|
||||
return (~0U << B) | X;
|
||||
}
|
||||
|
||||
/// \brief One extend number X starting at bit B and returns it as int64_t.
|
||||
/// Requires 0 < B <= 64.
|
||||
static inline int64_t OneExtend64(uint64_t X, unsigned B) {
|
||||
return (~0ULL << B) | X;
|
||||
}
|
||||
|
||||
/// \brief Count number of 0's from the most significant bit to the least
|
||||
/// stopping at the first 1.
|
||||
///
|
||||
/// Only unsigned integral types are allowed.
|
||||
///
|
||||
/// \param ZB the behavior on an input of 0. Only ZB_Width and ZB_Undefined are
|
||||
/// valid arguments.
|
||||
static inline unsigned int countLeadingZeros(int x)
|
||||
{
|
||||
int i;
|
||||
const unsigned bits = sizeof(x) * 8;
|
||||
unsigned count = bits;
|
||||
|
||||
if (x < 0) {
|
||||
return 0;
|
||||
}
|
||||
for (i = bits; --i; ) {
|
||||
if (x == 0) break;
|
||||
count--;
|
||||
x >>= 1;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/// \brief Get specified field from 32-bit instruction. Returns bits from the segment [from, to]
|
||||
static inline uint32_t get_insn_field(uint32_t insn, uint8_t from, uint8_t to)
|
||||
{
|
||||
return insn >> (31 - to) & ((1 << (to - from + 1)) - 1);
|
||||
}
|
||||
|
||||
/// \brief Get specified bit from 32-bit instruction
|
||||
static inline uint32_t get_insn_bit(uint32_t insn, uint8_t bit)
|
||||
{
|
||||
return get_insn_field(insn, bit, bit);
|
||||
}
|
||||
|
||||
#endif
|
77
thirdparty/capstone/README.md
vendored
Normal file
77
thirdparty/capstone/README.md
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
Capstone Engine
|
||||
===============
|
||||
|
||||
[](https://ci.appveyor.com/project/aquynh/capstone/branch/next)
|
||||
[](https://pypi.python.org/pypi/capstone)
|
||||
[](https://pepy.tech/project/capstone)
|
||||
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:capstone)
|
||||
|
||||
> [!TIP]
|
||||
> Welcome to join our community group!   [<img src="https://img.shields.io/badge/Telegram-2CA5E0?style=flat-squeare&logo=telegram&logoColor=white" height="22" />](https://t.me/CapstoneEngine)
|
||||
|
||||
Capstone is a disassembly framework with the target of becoming the ultimate
|
||||
disasm engine for binary analysis and reversing in the security community.
|
||||
|
||||
Created by Nguyen Anh Quynh, then developed and maintained by a small community,
|
||||
Capstone offers some unparalleled features:
|
||||
|
||||
- Support multiple hardware architectures: ARM, AArch64, Alpha, BPF, Ethereum VM,
|
||||
LoongArch, HP PA-RISC (HPPA), M68K, M680X, Mips, MOS65XX, PPC, RISC-V(rv32G/rv64G), SH,
|
||||
Sparc, SystemZ, TMS320C64X, TriCore, Webassembly, XCore and X86 (16, 32, 64).
|
||||
|
||||
- Having clean/simple/lightweight/intuitive architecture-neutral API.
|
||||
|
||||
- Provide details on disassembled instruction (called “decomposer” by others).
|
||||
|
||||
- Provide semantics of the disassembled instruction, such as list of implicit
|
||||
registers read & written.
|
||||
|
||||
- Implemented in pure C language, with lightweight bindings for Swift, D, Clojure, F#,
|
||||
Common Lisp, Visual Basic, PHP, PowerShell, Emacs, Haskell, Perl, Python,
|
||||
Ruby, C#, NodeJS, Java, GO, C++, OCaml, Lua, Rust, Delphi, Free Pascal & Vala
|
||||
ready either in main code, or provided externally by the community).
|
||||
|
||||
- Native support for all popular platforms: Windows, Mac OSX, iOS, Android,
|
||||
Linux, \*BSD, Solaris, etc.
|
||||
|
||||
- Thread-safe by design.
|
||||
|
||||
- Special support for embedding into firmware or OS kernel.
|
||||
|
||||
- High performance & suitable for malware analysis (capable of handling various
|
||||
X86 malware tricks).
|
||||
|
||||
- Distributed under the open source BSD license.
|
||||
|
||||
Further information is available at https://www.capstone-engine.org
|
||||
|
||||
|
||||
Compile
|
||||
-------
|
||||
|
||||
See [COMPILE_CMAKE.TXT](COMPILE_CMAKE.TXT) file for how to compile and install Capstone.
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
See docs/README for how to customize & program your own tools with Capstone.
|
||||
|
||||
|
||||
Hack
|
||||
----
|
||||
|
||||
See HACK.TXT file for the structure of the source code.
|
||||
|
||||
|
||||
Fuzz
|
||||
----
|
||||
|
||||
See suite/fuzz/README.md for more information.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
This project is released under the BSD license. If you redistribute the binary
|
||||
or source code of Capstone, please attach file LICENSE.TXT with your products.
|
0
thirdparty/capstone/RELEASE_NOTES
vendored
Normal file
0
thirdparty/capstone/RELEASE_NOTES
vendored
Normal file
20
thirdparty/capstone/SPONSORS.TXT
vendored
Normal file
20
thirdparty/capstone/SPONSORS.TXT
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
* Version 4.0.1 - January 10th, 2019
|
||||
|
||||
Release 4.0.1 was sponsored by the following companies (in no particular order).
|
||||
|
||||
- NowSecure: https://www.nowsecure.com
|
||||
- Verichains: https://verichains.io
|
||||
- Vsec: https://vsec.com.vn
|
||||
|
||||
-----------------------------------
|
||||
* Version 4.0 - December 18th, 2018
|
||||
|
||||
Capstone 4.0 version marks 5 years of the project!
|
||||
This release was sponsored by the following companies (in no particular order).
|
||||
|
||||
- Thinkst Canary: https://canary.tools
|
||||
- NowSecure: https://www.nowsecure.com
|
||||
- ECQ: https://e-cq.net
|
||||
- Senrio: https://senr.io
|
||||
- GracefulBits: https://gracefulbits.com
|
||||
- Catena Cyber: https://catenacyber.fr
|
236
thirdparty/capstone/SStream.c
vendored
Normal file
236
thirdparty/capstone/SStream.c
vendored
Normal file
@@ -0,0 +1,236 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
|
||||
#include <stdarg.h>
|
||||
#if defined(CAPSTONE_HAS_OSXKERNEL)
|
||||
#include <Availability.h>
|
||||
#include <libkern/libkern.h>
|
||||
#include <i386/limits.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
#include <capstone/platform.h>
|
||||
|
||||
#include "SStream.h"
|
||||
#include "cs_priv.h"
|
||||
#include "utils.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4996) // disable MSVC's warning on strcpy()
|
||||
#endif
|
||||
|
||||
void SStream_Init(SStream *ss)
|
||||
{
|
||||
assert(ss);
|
||||
ss->index = 0;
|
||||
ss->buffer[0] = '\0';
|
||||
ss->is_closed = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the output stream. Every write attempt is accepted again.
|
||||
*/
|
||||
void SStream_Open(SStream *ss) {
|
||||
assert(ss);
|
||||
ss->is_closed = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the output stream. Every write attempt is ignored.
|
||||
*/
|
||||
void SStream_Close(SStream *ss) {
|
||||
assert(ss);
|
||||
ss->is_closed = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the string \p s to the buffer of \p ss and terminate it with a '\\0' byte.
|
||||
*/
|
||||
void SStream_concat0(SStream *ss, const char *s)
|
||||
{
|
||||
#ifndef CAPSTONE_DIET
|
||||
SSTREAM_RETURN_IF_CLOSED(ss);
|
||||
if (s[0] == '\0')
|
||||
return;
|
||||
unsigned int len = (unsigned int) strlen(s);
|
||||
|
||||
memcpy(ss->buffer + ss->index, s, len);
|
||||
ss->index += len;
|
||||
ss->buffer[ss->index] = '\0';
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the single char \p c to the buffer of \p ss.
|
||||
*/
|
||||
void SStream_concat1(SStream *ss, const char c)
|
||||
{
|
||||
#ifndef CAPSTONE_DIET
|
||||
SSTREAM_RETURN_IF_CLOSED(ss);
|
||||
if (c == '\0')
|
||||
return;
|
||||
ss->buffer[ss->index] = c;
|
||||
ss->index++;
|
||||
ss->buffer[ss->index] = '\0';
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy all strings given to the buffer of \p ss according to formatting \p fmt.
|
||||
*/
|
||||
void SStream_concat(SStream *ss, const char *fmt, ...)
|
||||
{
|
||||
#ifndef CAPSTONE_DIET
|
||||
SSTREAM_RETURN_IF_CLOSED(ss);
|
||||
va_list ap;
|
||||
int ret;
|
||||
|
||||
va_start(ap, fmt);
|
||||
ret = cs_vsnprintf(ss->buffer + ss->index, sizeof(ss->buffer) - (ss->index + 1), fmt, ap);
|
||||
va_end(ap);
|
||||
ss->index += ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
// print number with prefix #
|
||||
void printInt64Bang(SStream *O, int64_t val)
|
||||
{
|
||||
SSTREAM_RETURN_IF_CLOSED(O);
|
||||
if (val >= 0) {
|
||||
if (val > HEX_THRESHOLD)
|
||||
SStream_concat(O, "#0x%"PRIx64, val);
|
||||
else
|
||||
SStream_concat(O, "#%"PRIu64, val);
|
||||
} else {
|
||||
if (val <- HEX_THRESHOLD) {
|
||||
if (val == LONG_MIN)
|
||||
SStream_concat(O, "#-0x%"PRIx64, (uint64_t)val);
|
||||
else
|
||||
SStream_concat(O, "#-0x%"PRIx64, (uint64_t)-val);
|
||||
} else
|
||||
SStream_concat(O, "#-%"PRIu64, -val);
|
||||
}
|
||||
}
|
||||
|
||||
void printUInt64Bang(SStream *O, uint64_t val)
|
||||
{
|
||||
SSTREAM_RETURN_IF_CLOSED(O);
|
||||
if (val > HEX_THRESHOLD)
|
||||
SStream_concat(O, "#0x%"PRIx64, val);
|
||||
else
|
||||
SStream_concat(O, "#%"PRIu64, val);
|
||||
}
|
||||
|
||||
// print number
|
||||
void printInt64(SStream *O, int64_t val)
|
||||
{
|
||||
SSTREAM_RETURN_IF_CLOSED(O);
|
||||
if (val >= 0) {
|
||||
if (val > HEX_THRESHOLD)
|
||||
SStream_concat(O, "0x%"PRIx64, val);
|
||||
else
|
||||
SStream_concat(O, "%"PRIu64, val);
|
||||
} else {
|
||||
if (val <- HEX_THRESHOLD) {
|
||||
if (val == LONG_MIN)
|
||||
SStream_concat(O, "-0x%"PRIx64, (uint64_t)val);
|
||||
else
|
||||
SStream_concat(O, "-0x%"PRIx64, (uint64_t)-val);
|
||||
} else
|
||||
SStream_concat(O, "-%"PRIu64, -val);
|
||||
}
|
||||
}
|
||||
|
||||
void printUInt64(SStream *O, uint64_t val)
|
||||
{
|
||||
SSTREAM_RETURN_IF_CLOSED(O);
|
||||
if (val > HEX_THRESHOLD)
|
||||
SStream_concat(O, "0x%"PRIx64, val);
|
||||
else
|
||||
SStream_concat(O, "%"PRIu64, val);
|
||||
}
|
||||
|
||||
// print number in decimal mode
|
||||
void printInt32BangDec(SStream *O, int32_t val)
|
||||
{
|
||||
SSTREAM_RETURN_IF_CLOSED(O);
|
||||
if (val >= 0)
|
||||
SStream_concat(O, "#%u", val);
|
||||
else {
|
||||
if (val == INT_MIN)
|
||||
SStream_concat(O, "#-%u", val);
|
||||
else
|
||||
SStream_concat(O, "#-%u", (uint32_t)-val);
|
||||
}
|
||||
}
|
||||
|
||||
void printInt32Bang(SStream *O, int32_t val)
|
||||
{
|
||||
SSTREAM_RETURN_IF_CLOSED(O);
|
||||
if (val >= 0) {
|
||||
if (val > HEX_THRESHOLD)
|
||||
SStream_concat(O, "#0x%x", val);
|
||||
else
|
||||
SStream_concat(O, "#%u", val);
|
||||
} else {
|
||||
if (val <- HEX_THRESHOLD) {
|
||||
if (val == INT_MIN)
|
||||
SStream_concat(O, "#-0x%x", (uint32_t)val);
|
||||
else
|
||||
SStream_concat(O, "#-0x%x", (uint32_t)-val);
|
||||
} else
|
||||
SStream_concat(O, "#-%u", -val);
|
||||
}
|
||||
}
|
||||
|
||||
void printInt32(SStream *O, int32_t val)
|
||||
{
|
||||
SSTREAM_RETURN_IF_CLOSED(O);
|
||||
if (val >= 0) {
|
||||
if (val > HEX_THRESHOLD)
|
||||
SStream_concat(O, "0x%x", val);
|
||||
else
|
||||
SStream_concat(O, "%u", val);
|
||||
} else {
|
||||
if (val <- HEX_THRESHOLD) {
|
||||
if (val == INT_MIN)
|
||||
SStream_concat(O, "-0x%x", (uint32_t)val);
|
||||
else
|
||||
SStream_concat(O, "-0x%x", (uint32_t)-val);
|
||||
} else
|
||||
SStream_concat(O, "-%u", -val);
|
||||
}
|
||||
}
|
||||
|
||||
void printUInt32Bang(SStream *O, uint32_t val)
|
||||
{
|
||||
SSTREAM_RETURN_IF_CLOSED(O);
|
||||
if (val > HEX_THRESHOLD)
|
||||
SStream_concat(O, "#0x%x", val);
|
||||
else
|
||||
SStream_concat(O, "#%u", val);
|
||||
}
|
||||
|
||||
void printUInt32(SStream *O, uint32_t val)
|
||||
{
|
||||
SSTREAM_RETURN_IF_CLOSED(O);
|
||||
if (val > HEX_THRESHOLD)
|
||||
SStream_concat(O, "0x%x", val);
|
||||
else
|
||||
SStream_concat(O, "%u", val);
|
||||
}
|
||||
|
||||
void printFloat(SStream *O, float val)
|
||||
{
|
||||
SSTREAM_RETURN_IF_CLOSED(O);
|
||||
SStream_concat(O, "%e", val);
|
||||
}
|
||||
|
||||
void printFloatBang(SStream *O, float val)
|
||||
{
|
||||
SSTREAM_RETURN_IF_CLOSED(O);
|
||||
SStream_concat(O, "#%e", val);
|
||||
}
|
55
thirdparty/capstone/SStream.h
vendored
Normal file
55
thirdparty/capstone/SStream.h
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
|
||||
#ifndef CS_SSTREAM_H_
|
||||
#define CS_SSTREAM_H_
|
||||
|
||||
#include "include/capstone/platform.h"
|
||||
|
||||
typedef struct SStream {
|
||||
char buffer[512];
|
||||
int index;
|
||||
bool is_closed;
|
||||
} SStream;
|
||||
|
||||
#define SSTREAM_RETURN_IF_CLOSED(OS) \
|
||||
do { \
|
||||
if (OS->is_closed) \
|
||||
return; \
|
||||
} while(0)
|
||||
|
||||
void SStream_Init(SStream *ss);
|
||||
|
||||
void SStream_Open(SStream *ss);
|
||||
|
||||
void SStream_Close(SStream *ss);
|
||||
|
||||
void SStream_concat(SStream *ss, const char *fmt, ...);
|
||||
|
||||
void SStream_concat0(SStream *ss, const char *s);
|
||||
|
||||
void SStream_concat1(SStream *ss, const char c);
|
||||
|
||||
void printInt64Bang(SStream *O, int64_t val);
|
||||
|
||||
void printUInt64Bang(SStream *O, uint64_t val);
|
||||
|
||||
void printInt64(SStream *O, int64_t val);
|
||||
void printUInt64(SStream *O, uint64_t val);
|
||||
|
||||
void printInt32Bang(SStream *O, int32_t val);
|
||||
|
||||
void printInt32(SStream *O, int32_t val);
|
||||
|
||||
void printUInt32Bang(SStream *O, uint32_t val);
|
||||
|
||||
void printUInt32(SStream *O, uint32_t val);
|
||||
|
||||
// print number in decimal mode
|
||||
void printInt32BangDec(SStream *O, int32_t val);
|
||||
|
||||
void printFloat(SStream *O, float val);
|
||||
|
||||
void printFloatBang(SStream *O, float val);
|
||||
|
||||
#endif
|
999
thirdparty/capstone/arch/AArch64/AArch64AddressingModes.h
vendored
Normal file
999
thirdparty/capstone/arch/AArch64/AArch64AddressingModes.h
vendored
Normal file
@@ -0,0 +1,999 @@
|
||||
/* Capstone Disassembly Engine, http://www.capstone-engine.org */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */
|
||||
/* Rot127 <unisono@quyllur.org> 2022-2023 */
|
||||
/* Automatically translated source file from LLVM. */
|
||||
|
||||
/* LLVM-commit: <commit> */
|
||||
/* LLVM-tag: <tag> */
|
||||
|
||||
/* Only small edits allowed. */
|
||||
/* For multiple similar edits, please create a Patch for the translator. */
|
||||
|
||||
/* Capstone's C++ file translator: */
|
||||
/* https://github.com/capstone-engine/capstone/tree/next/suite/auto-sync */
|
||||
|
||||
//===- AArch64AddressingModes.h - AArch64 Addressing Modes ------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains the AArch64 addressing mode implementation stuff.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64ADDRESSINGMODES_H
|
||||
#define LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64ADDRESSINGMODES_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <capstone/platform.h>
|
||||
|
||||
#include "../../MathExtras.h"
|
||||
#include <assert.h>
|
||||
#include "../../MathExtras.h"
|
||||
|
||||
#define CONCAT(a, b) CONCAT_(a, b)
|
||||
#define CONCAT_(a, b) a##_##b
|
||||
|
||||
/// AArch64_AM - AArch64 Addressing Mode Stuff
|
||||
// CS namespace begin: AArch64_AM
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Shifts
|
||||
//
|
||||
typedef enum ShiftExtendType {
|
||||
AArch64_AM_InvalidShiftExtend = -1,
|
||||
AArch64_AM_LSL = 0,
|
||||
AArch64_AM_LSR,
|
||||
AArch64_AM_ASR,
|
||||
AArch64_AM_ROR,
|
||||
AArch64_AM_MSL,
|
||||
|
||||
AArch64_AM_UXTB,
|
||||
AArch64_AM_UXTH,
|
||||
AArch64_AM_UXTW,
|
||||
AArch64_AM_UXTX,
|
||||
|
||||
AArch64_AM_SXTB,
|
||||
AArch64_AM_SXTH,
|
||||
AArch64_AM_SXTW,
|
||||
AArch64_AM_SXTX,
|
||||
} AArch64_AM_ShiftExtendType;
|
||||
|
||||
/// getShiftName - Get the string encoding for the shift type.
|
||||
static inline const char *
|
||||
AArch64_AM_getShiftExtendName(AArch64_AM_ShiftExtendType ST)
|
||||
{
|
||||
switch (ST) {
|
||||
default:
|
||||
assert(0 && "unhandled shift type!");
|
||||
case AArch64_AM_LSL:
|
||||
return "lsl";
|
||||
case AArch64_AM_LSR:
|
||||
return "lsr";
|
||||
case AArch64_AM_ASR:
|
||||
return "asr";
|
||||
case AArch64_AM_ROR:
|
||||
return "ror";
|
||||
case AArch64_AM_MSL:
|
||||
return "msl";
|
||||
case AArch64_AM_UXTB:
|
||||
return "uxtb";
|
||||
case AArch64_AM_UXTH:
|
||||
return "uxth";
|
||||
case AArch64_AM_UXTW:
|
||||
return "uxtw";
|
||||
case AArch64_AM_UXTX:
|
||||
return "uxtx";
|
||||
case AArch64_AM_SXTB:
|
||||
return "sxtb";
|
||||
case AArch64_AM_SXTH:
|
||||
return "sxth";
|
||||
case AArch64_AM_SXTW:
|
||||
return "sxtw";
|
||||
case AArch64_AM_SXTX:
|
||||
return "sxtx";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/// getShiftType - Extract the shift type.
|
||||
static inline AArch64_AM_ShiftExtendType AArch64_AM_getShiftType(unsigned Imm)
|
||||
{
|
||||
switch ((Imm >> 6) & 0x7) {
|
||||
default:
|
||||
return AArch64_AM_InvalidShiftExtend;
|
||||
case 0:
|
||||
return AArch64_AM_LSL;
|
||||
case 1:
|
||||
return AArch64_AM_LSR;
|
||||
case 2:
|
||||
return AArch64_AM_ASR;
|
||||
case 3:
|
||||
return AArch64_AM_ROR;
|
||||
case 4:
|
||||
return AArch64_AM_MSL;
|
||||
}
|
||||
}
|
||||
|
||||
/// getShiftValue - Extract the shift value.
|
||||
static inline unsigned AArch64_AM_getShiftValue(unsigned Imm)
|
||||
{
|
||||
return Imm & 0x3f;
|
||||
}
|
||||
|
||||
/// getShifterImm - Encode the shift type and amount:
|
||||
/// imm: 6-bit shift amount
|
||||
/// shifter: 000 ==> lsl
|
||||
/// 001 ==> lsr
|
||||
/// 010 ==> asr
|
||||
/// 011 ==> ror
|
||||
/// 100 ==> msl
|
||||
/// {8-6} = shifter
|
||||
/// {5-0} = imm
|
||||
static inline unsigned AArch64_AM_getShifterImm(AArch64_AM_ShiftExtendType ST,
|
||||
unsigned Imm)
|
||||
{
|
||||
unsigned STEnc = 0;
|
||||
switch (ST) {
|
||||
default:
|
||||
assert(0 && "Invalid shift requested");
|
||||
case AArch64_AM_LSL:
|
||||
STEnc = 0;
|
||||
break;
|
||||
case AArch64_AM_LSR:
|
||||
STEnc = 1;
|
||||
break;
|
||||
case AArch64_AM_ASR:
|
||||
STEnc = 2;
|
||||
break;
|
||||
case AArch64_AM_ROR:
|
||||
STEnc = 3;
|
||||
break;
|
||||
case AArch64_AM_MSL:
|
||||
STEnc = 4;
|
||||
break;
|
||||
}
|
||||
return (STEnc << 6) | (Imm & 0x3f);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Extends
|
||||
//
|
||||
/// getArithShiftValue - get the arithmetic shift value.
|
||||
static inline unsigned AArch64_AM_getArithShiftValue(unsigned Imm)
|
||||
{
|
||||
return Imm & 0x7;
|
||||
}
|
||||
|
||||
/// getExtendType - Extract the extend type for operands of arithmetic ops.
|
||||
static inline AArch64_AM_ShiftExtendType AArch64_AM_getExtendType(unsigned Imm)
|
||||
{
|
||||
switch (Imm) {
|
||||
default:
|
||||
assert(0 && "Compiler bug!");
|
||||
case 0:
|
||||
return AArch64_AM_UXTB;
|
||||
case 1:
|
||||
return AArch64_AM_UXTH;
|
||||
case 2:
|
||||
return AArch64_AM_UXTW;
|
||||
case 3:
|
||||
return AArch64_AM_UXTX;
|
||||
case 4:
|
||||
return AArch64_AM_SXTB;
|
||||
case 5:
|
||||
return AArch64_AM_SXTH;
|
||||
case 6:
|
||||
return AArch64_AM_SXTW;
|
||||
case 7:
|
||||
return AArch64_AM_SXTX;
|
||||
}
|
||||
}
|
||||
|
||||
static inline AArch64_AM_ShiftExtendType
|
||||
AArch64_AM_getArithExtendType(unsigned Imm)
|
||||
{
|
||||
return AArch64_AM_getExtendType((Imm >> 3) & 0x7);
|
||||
}
|
||||
|
||||
/// Mapping from extend bits to required operation:
|
||||
/// shifter: 000 ==> uxtb
|
||||
/// 001 ==> uxth
|
||||
/// 010 ==> uxtw
|
||||
/// 011 ==> uxtx
|
||||
/// 100 ==> sxtb
|
||||
/// 101 ==> sxth
|
||||
/// 110 ==> sxtw
|
||||
/// 111 ==> sxtx
|
||||
static inline unsigned
|
||||
AArch64_AM_getExtendEncoding(AArch64_AM_ShiftExtendType ET)
|
||||
{
|
||||
switch (ET) {
|
||||
default:
|
||||
assert(0 && "Invalid extend type requested");
|
||||
case AArch64_AM_UXTB:
|
||||
return 0;
|
||||
break;
|
||||
case AArch64_AM_UXTH:
|
||||
return 1;
|
||||
break;
|
||||
case AArch64_AM_UXTW:
|
||||
return 2;
|
||||
break;
|
||||
case AArch64_AM_UXTX:
|
||||
return 3;
|
||||
break;
|
||||
case AArch64_AM_SXTB:
|
||||
return 4;
|
||||
break;
|
||||
case AArch64_AM_SXTH:
|
||||
return 5;
|
||||
break;
|
||||
case AArch64_AM_SXTW:
|
||||
return 6;
|
||||
break;
|
||||
case AArch64_AM_SXTX:
|
||||
return 7;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// getArithExtendImm - Encode the extend type and shift amount for an
|
||||
/// arithmetic instruction:
|
||||
/// imm: 3-bit extend amount
|
||||
/// {5-3} = shifter
|
||||
/// {2-0} = imm3
|
||||
static inline unsigned
|
||||
AArch64_AM_getArithExtendImm(AArch64_AM_ShiftExtendType ET, unsigned Imm)
|
||||
{
|
||||
return (AArch64_AM_getExtendEncoding(ET) << 3) | (Imm & 0x7);
|
||||
}
|
||||
|
||||
/// getMemDoShift - Extract the "do shift" flag value for load/store
|
||||
/// instructions.
|
||||
static inline bool AArch64_AM_getMemDoShift(unsigned Imm)
|
||||
{
|
||||
return (Imm & 0x1) != 0;
|
||||
}
|
||||
|
||||
/// getExtendType - Extract the extend type for the offset operand of
|
||||
/// loads/stores.
|
||||
static inline AArch64_AM_ShiftExtendType
|
||||
AArch64_AM_getMemExtendType(unsigned Imm)
|
||||
{
|
||||
return AArch64_AM_getExtendType((Imm >> 1) & 0x7);
|
||||
}
|
||||
|
||||
/// getExtendImm - Encode the extend type and amount for a load/store inst:
|
||||
/// doshift: should the offset be scaled by the access size
|
||||
/// shifter: 000 ==> uxtb
|
||||
/// 001 ==> uxth
|
||||
/// 010 ==> uxtw
|
||||
/// 011 ==> uxtx
|
||||
/// 100 ==> sxtb
|
||||
/// 101 ==> sxth
|
||||
/// 110 ==> sxtw
|
||||
/// 111 ==> sxtx
|
||||
/// {3-1} = shifter
|
||||
/// {0} = doshift
|
||||
static inline unsigned AArch64_AM_getMemExtendImm(AArch64_AM_ShiftExtendType ET,
|
||||
bool DoShift)
|
||||
{
|
||||
return (AArch64_AM_getExtendEncoding(ET) << 1) | (unsigned)DoShift;
|
||||
}
|
||||
|
||||
static inline uint64_t AArch64_AM_ror(uint64_t elt, unsigned size)
|
||||
{
|
||||
return ((elt & 1) << (size - 1)) | (elt >> 1);
|
||||
}
|
||||
|
||||
/// processLogicalImmediate - Determine if an immediate value can be encoded
|
||||
/// as the immediate operand of a logical instruction for the given register
|
||||
/// size. If so, return true with "encoding" set to the encoded value in
|
||||
/// the form N:immr:imms.
|
||||
static inline bool AArch64_AM_processLogicalImmediate(uint64_t Imm,
|
||||
unsigned RegSize,
|
||||
uint64_t *Encoding)
|
||||
{
|
||||
if (Imm == 0ULL || Imm == ~0ULL ||
|
||||
(RegSize != 64 &&
|
||||
(Imm >> RegSize != 0 || Imm == (~0ULL >> (64 - RegSize)))))
|
||||
return false;
|
||||
|
||||
// First, determine the element size.
|
||||
unsigned Size = RegSize;
|
||||
|
||||
do {
|
||||
Size /= 2;
|
||||
uint64_t Mask = (1ULL << Size) - 1;
|
||||
|
||||
if ((Imm & Mask) != ((Imm >> Size) & Mask)) {
|
||||
Size *= 2;
|
||||
break;
|
||||
}
|
||||
} while (Size > 2);
|
||||
|
||||
// Second, determine the rotation to make the element be: 0^m 1^n.
|
||||
uint32_t CTO, I;
|
||||
uint64_t Mask = ((uint64_t)-1LL) >> (64 - Size);
|
||||
Imm &= Mask;
|
||||
|
||||
if (isShiftedMask_64(Imm)) {
|
||||
I = CountTrailingZeros_64(Imm);
|
||||
|
||||
CTO = CountTrailingOnes_64(Imm >> I);
|
||||
} else {
|
||||
Imm |= ~Mask;
|
||||
if (!isShiftedMask_64(~Imm))
|
||||
return false;
|
||||
|
||||
unsigned CLO = CountLeadingOnes_64(Imm);
|
||||
I = 64 - CLO;
|
||||
CTO = CLO + CountTrailingOnes_64(Imm) - (64 - Size);
|
||||
}
|
||||
|
||||
// Encode in Immr the number of RORs it would take to get *from* 0^m 1^n
|
||||
// to our target value, where I is the number of RORs to go the opposite
|
||||
// direction.
|
||||
|
||||
unsigned Immr = (Size - I) & (Size - 1);
|
||||
|
||||
// If size has a 1 in the n'th bit, create a value that has zeroes in
|
||||
// bits [0, n] and ones above that.
|
||||
uint64_t NImms = ~(Size - 1) << 1;
|
||||
|
||||
// Or the CTO value into the low bits, which must be below the Nth bit
|
||||
// bit mentioned above.
|
||||
NImms |= (CTO - 1);
|
||||
|
||||
// Extract the seventh bit and toggle it to create the N field.
|
||||
unsigned N = ((NImms >> 6) & 1) ^ 1;
|
||||
|
||||
*Encoding = (N << 12) | (Immr << 6) | (NImms & 0x3f);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// isLogicalImmediate - Return true if the immediate is valid for a logical
|
||||
/// immediate instruction of the given register size. Return false otherwise.
|
||||
static inline bool AArch64_AM_isLogicalImmediate(uint64_t imm, unsigned regSize)
|
||||
{
|
||||
uint64_t encoding = 0;
|
||||
return AArch64_AM_processLogicalImmediate(imm, regSize, &encoding);
|
||||
}
|
||||
|
||||
/// encodeLogicalImmediate - Return the encoded immediate value for a logical
|
||||
/// immediate instruction of the given register size.
|
||||
static inline uint64_t AArch64_AM_encodeLogicalImmediate(uint64_t imm,
|
||||
unsigned regSize)
|
||||
{
|
||||
uint64_t encoding = 0;
|
||||
bool res = AArch64_AM_processLogicalImmediate(imm, regSize, &encoding);
|
||||
|
||||
(void)res;
|
||||
return encoding;
|
||||
}
|
||||
|
||||
/// decodeLogicalImmediate - Decode a logical immediate value in the form
|
||||
/// "N:immr:imms" (where the immr and imms fields are each 6 bits) into the
|
||||
/// integer value it represents with regSize bits.
|
||||
static inline uint64_t AArch64_AM_decodeLogicalImmediate(uint64_t val,
|
||||
unsigned regSize)
|
||||
{
|
||||
// Extract the N, imms, and immr fields.
|
||||
unsigned N = (val >> 12) & 1;
|
||||
unsigned immr = (val >> 6) & 0x3f;
|
||||
unsigned imms = val & 0x3f;
|
||||
|
||||
int len = 31 - countLeadingZeros((N << 6) | (~imms & 0x3f));
|
||||
assert(len >= 1);
|
||||
|
||||
unsigned size = (1 << len);
|
||||
unsigned R = immr & (size - 1);
|
||||
unsigned S = imms & (size - 1);
|
||||
|
||||
uint64_t pattern = (1ULL << (S + 1)) - 1;
|
||||
for (unsigned i = 0; i < R; ++i)
|
||||
pattern = AArch64_AM_ror(pattern, size);
|
||||
|
||||
// Replicate the pattern to fill the regSize.
|
||||
while (size != regSize) {
|
||||
pattern |= (pattern << size);
|
||||
size *= 2;
|
||||
}
|
||||
return pattern;
|
||||
}
|
||||
|
||||
/// isValidDecodeLogicalImmediate - Check to see if the logical immediate value
|
||||
/// in the form "N:immr:imms" (where the immr and imms fields are each 6 bits)
|
||||
/// is a valid encoding for an integer value with regSize bits.
|
||||
static inline bool AArch64_AM_isValidDecodeLogicalImmediate(uint64_t val,
|
||||
unsigned regSize)
|
||||
{
|
||||
// Extract the N and imms fields needed for checking.
|
||||
unsigned N = (val >> 12) & 1;
|
||||
unsigned imms = val & 0x3f;
|
||||
|
||||
if (regSize == 32 && N != 0) // undefined logical immediate encoding
|
||||
return false;
|
||||
int len = 31 - countLeadingZeros((N << 6) | (~imms & 0x3f));
|
||||
if (len < 0) // undefined logical immediate encoding
|
||||
return false;
|
||||
unsigned size = (1 << len);
|
||||
unsigned S = imms & (size - 1);
|
||||
if (S == size - 1) // undefined logical immediate encoding
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Floating-point Immediates
|
||||
//
|
||||
static inline float AArch64_AM_getFPImmFloat(unsigned Imm)
|
||||
{
|
||||
// We expect an 8-bit binary encoding of a floating-point number here.
|
||||
|
||||
uint8_t Sign = (Imm >> 7) & 0x1;
|
||||
uint8_t Exp = (Imm >> 4) & 0x7;
|
||||
uint8_t Mantissa = Imm & 0xf;
|
||||
|
||||
// 8-bit FP IEEE Float Encoding
|
||||
// abcd efgh aBbbbbbc defgh000 00000000 00000000
|
||||
//
|
||||
// where B = NOT(b);
|
||||
|
||||
uint32_t I = 0;
|
||||
I |= Sign << 31;
|
||||
I |= ((Exp & 0x4) != 0 ? 0 : 1) << 30;
|
||||
I |= ((Exp & 0x4) != 0 ? 0x1f : 0) << 25;
|
||||
I |= (Exp & 0x3) << 23;
|
||||
I |= Mantissa << 19;
|
||||
return BitsToFloat(I);
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// AdvSIMD Modified Immediates
|
||||
//===--------------------------------------------------------------------===//
|
||||
// 0x00 0x00 0x00 abcdefgh 0x00 0x00 0x00 abcdefgh
|
||||
static inline bool AArch64_AM_isAdvSIMDModImmType1(uint64_t Imm)
|
||||
{
|
||||
return ((Imm >> 32) == (Imm & 0xffffffffULL)) &&
|
||||
((Imm & 0xffffff00ffffff00ULL) == 0);
|
||||
}
|
||||
|
||||
static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType1(uint64_t Imm)
|
||||
{
|
||||
return (Imm & 0xffULL);
|
||||
}
|
||||
|
||||
static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType1(uint8_t Imm)
|
||||
{
|
||||
uint64_t EncVal = Imm;
|
||||
return (EncVal << 32) | EncVal;
|
||||
}
|
||||
|
||||
// 0x00 0x00 abcdefgh 0x00 0x00 0x00 abcdefgh 0x00
|
||||
static inline bool AArch64_AM_isAdvSIMDModImmType2(uint64_t Imm)
|
||||
{
|
||||
return ((Imm >> 32) == (Imm & 0xffffffffULL)) &&
|
||||
((Imm & 0xffff00ffffff00ffULL) == 0);
|
||||
}
|
||||
|
||||
static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType2(uint64_t Imm)
|
||||
{
|
||||
return (Imm & 0xff00ULL) >> 8;
|
||||
}
|
||||
|
||||
static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType2(uint8_t Imm)
|
||||
{
|
||||
uint64_t EncVal = Imm;
|
||||
return (EncVal << 40) | (EncVal << 8);
|
||||
}
|
||||
|
||||
// 0x00 abcdefgh 0x00 0x00 0x00 abcdefgh 0x00 0x00
|
||||
static inline bool AArch64_AM_isAdvSIMDModImmType3(uint64_t Imm)
|
||||
{
|
||||
return ((Imm >> 32) == (Imm & 0xffffffffULL)) &&
|
||||
((Imm & 0xff00ffffff00ffffULL) == 0);
|
||||
}
|
||||
|
||||
static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType3(uint64_t Imm)
|
||||
{
|
||||
return (Imm & 0xff0000ULL) >> 16;
|
||||
}
|
||||
|
||||
static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType3(uint8_t Imm)
|
||||
{
|
||||
uint64_t EncVal = Imm;
|
||||
return (EncVal << 48) | (EncVal << 16);
|
||||
}
|
||||
|
||||
// abcdefgh 0x00 0x00 0x00 abcdefgh 0x00 0x00 0x00
|
||||
static inline bool AArch64_AM_isAdvSIMDModImmType4(uint64_t Imm)
|
||||
{
|
||||
return ((Imm >> 32) == (Imm & 0xffffffffULL)) &&
|
||||
((Imm & 0x00ffffff00ffffffULL) == 0);
|
||||
}
|
||||
|
||||
static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType4(uint64_t Imm)
|
||||
{
|
||||
return (Imm & 0xff000000ULL) >> 24;
|
||||
}
|
||||
|
||||
static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType4(uint8_t Imm)
|
||||
{
|
||||
uint64_t EncVal = Imm;
|
||||
return (EncVal << 56) | (EncVal << 24);
|
||||
}
|
||||
|
||||
// 0x00 abcdefgh 0x00 abcdefgh 0x00 abcdefgh 0x00 abcdefgh
|
||||
static inline bool AArch64_AM_isAdvSIMDModImmType5(uint64_t Imm)
|
||||
{
|
||||
return ((Imm >> 32) == (Imm & 0xffffffffULL)) &&
|
||||
(((Imm & 0x00ff0000ULL) >> 16) == (Imm & 0x000000ffULL)) &&
|
||||
((Imm & 0xff00ff00ff00ff00ULL) == 0);
|
||||
}
|
||||
|
||||
static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType5(uint64_t Imm)
|
||||
{
|
||||
return (Imm & 0xffULL);
|
||||
}
|
||||
|
||||
static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType5(uint8_t Imm)
|
||||
{
|
||||
uint64_t EncVal = Imm;
|
||||
return (EncVal << 48) | (EncVal << 32) | (EncVal << 16) | EncVal;
|
||||
}
|
||||
|
||||
// abcdefgh 0x00 abcdefgh 0x00 abcdefgh 0x00 abcdefgh 0x00
|
||||
static inline bool AArch64_AM_isAdvSIMDModImmType6(uint64_t Imm)
|
||||
{
|
||||
return ((Imm >> 32) == (Imm & 0xffffffffULL)) &&
|
||||
(((Imm & 0xff000000ULL) >> 16) == (Imm & 0x0000ff00ULL)) &&
|
||||
((Imm & 0x00ff00ff00ff00ffULL) == 0);
|
||||
}
|
||||
|
||||
static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType6(uint64_t Imm)
|
||||
{
|
||||
return (Imm & 0xff00ULL) >> 8;
|
||||
}
|
||||
|
||||
static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType6(uint8_t Imm)
|
||||
{
|
||||
uint64_t EncVal = Imm;
|
||||
return (EncVal << 56) | (EncVal << 40) | (EncVal << 24) | (EncVal << 8);
|
||||
}
|
||||
|
||||
// 0x00 0x00 abcdefgh 0xFF 0x00 0x00 abcdefgh 0xFF
|
||||
static inline bool AArch64_AM_isAdvSIMDModImmType7(uint64_t Imm)
|
||||
{
|
||||
return ((Imm >> 32) == (Imm & 0xffffffffULL)) &&
|
||||
((Imm & 0xffff00ffffff00ffULL) == 0x000000ff000000ffULL);
|
||||
}
|
||||
|
||||
static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType7(uint64_t Imm)
|
||||
{
|
||||
return (Imm & 0xff00ULL) >> 8;
|
||||
}
|
||||
|
||||
static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType7(uint8_t Imm)
|
||||
{
|
||||
uint64_t EncVal = Imm;
|
||||
return (EncVal << 40) | (EncVal << 8) | 0x000000ff000000ffULL;
|
||||
}
|
||||
|
||||
// 0x00 abcdefgh 0xFF 0xFF 0x00 abcdefgh 0xFF 0xFF
|
||||
static inline bool AArch64_AM_isAdvSIMDModImmType8(uint64_t Imm)
|
||||
{
|
||||
return ((Imm >> 32) == (Imm & 0xffffffffULL)) &&
|
||||
((Imm & 0xff00ffffff00ffffULL) == 0x0000ffff0000ffffULL);
|
||||
}
|
||||
|
||||
static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType8(uint8_t Imm)
|
||||
{
|
||||
uint64_t EncVal = Imm;
|
||||
return (EncVal << 48) | (EncVal << 16) | 0x0000ffff0000ffffULL;
|
||||
}
|
||||
|
||||
static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType8(uint64_t Imm)
|
||||
{
|
||||
return (Imm & 0x00ff0000ULL) >> 16;
|
||||
}
|
||||
|
||||
// abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh
|
||||
static inline bool AArch64_AM_isAdvSIMDModImmType9(uint64_t Imm)
|
||||
{
|
||||
return ((Imm >> 32) == (Imm & 0xffffffffULL)) &&
|
||||
((Imm >> 48) == (Imm & 0x0000ffffULL)) &&
|
||||
((Imm >> 56) == (Imm & 0x000000ffULL));
|
||||
}
|
||||
|
||||
static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType9(uint64_t Imm)
|
||||
{
|
||||
return (Imm & 0xffULL);
|
||||
}
|
||||
|
||||
static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType9(uint8_t Imm)
|
||||
{
|
||||
uint64_t EncVal = Imm;
|
||||
EncVal |= (EncVal << 8);
|
||||
EncVal |= (EncVal << 16);
|
||||
EncVal |= (EncVal << 32);
|
||||
return EncVal;
|
||||
}
|
||||
|
||||
// aaaaaaaa bbbbbbbb cccccccc dddddddd eeeeeeee ffffffff gggggggg hhhhhhhh
|
||||
// cmode: 1110, op: 1
|
||||
static inline bool AArch64_AM_isAdvSIMDModImmType10(uint64_t Imm)
|
||||
{
|
||||
#if defined(_MSC_VER) && _MSC_VER == 1937 && !defined(__clang__) && \
|
||||
defined(_M_ARM64)
|
||||
// The MSVC compiler 19.37 for ARM64 has an optimization bug that
|
||||
// causes an incorrect behavior with the orignal version. Work around
|
||||
// by using a slightly different variation.
|
||||
// https://developercommunity.visualstudio.com/t/C-ARM64-compiler-optimization-bug/10481261
|
||||
constexpr uint64_t Mask = 0xFFULL;
|
||||
uint64_t ByteA = (Imm >> 56) & Mask;
|
||||
uint64_t ByteB = (Imm >> 48) & Mask;
|
||||
uint64_t ByteC = (Imm >> 40) & Mask;
|
||||
uint64_t ByteD = (Imm >> 32) & Mask;
|
||||
uint64_t ByteE = (Imm >> 24) & Mask;
|
||||
uint64_t ByteF = (Imm >> 16) & Mask;
|
||||
uint64_t ByteG = (Imm >> 8) & Mask;
|
||||
uint64_t ByteH = Imm & Mask;
|
||||
|
||||
return (ByteA == 0ULL || ByteA == Mask) &&
|
||||
(ByteB == 0ULL || ByteB == Mask) &&
|
||||
(ByteC == 0ULL || ByteC == Mask) &&
|
||||
(ByteD == 0ULL || ByteD == Mask) &&
|
||||
(ByteE == 0ULL || ByteE == Mask) &&
|
||||
(ByteF == 0ULL || ByteF == Mask) &&
|
||||
(ByteG == 0ULL || ByteG == Mask) &&
|
||||
(ByteH == 0ULL || ByteH == Mask);
|
||||
#else
|
||||
uint64_t ByteA = Imm & 0xff00000000000000ULL;
|
||||
uint64_t ByteB = Imm & 0x00ff000000000000ULL;
|
||||
uint64_t ByteC = Imm & 0x0000ff0000000000ULL;
|
||||
uint64_t ByteD = Imm & 0x000000ff00000000ULL;
|
||||
uint64_t ByteE = Imm & 0x00000000ff000000ULL;
|
||||
uint64_t ByteF = Imm & 0x0000000000ff0000ULL;
|
||||
uint64_t ByteG = Imm & 0x000000000000ff00ULL;
|
||||
uint64_t ByteH = Imm & 0x00000000000000ffULL;
|
||||
|
||||
return (ByteA == 0ULL || ByteA == 0xff00000000000000ULL) &&
|
||||
(ByteB == 0ULL || ByteB == 0x00ff000000000000ULL) &&
|
||||
(ByteC == 0ULL || ByteC == 0x0000ff0000000000ULL) &&
|
||||
(ByteD == 0ULL || ByteD == 0x000000ff00000000ULL) &&
|
||||
(ByteE == 0ULL || ByteE == 0x00000000ff000000ULL) &&
|
||||
(ByteF == 0ULL || ByteF == 0x0000000000ff0000ULL) &&
|
||||
(ByteG == 0ULL || ByteG == 0x000000000000ff00ULL) &&
|
||||
(ByteH == 0ULL || ByteH == 0x00000000000000ffULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType10(uint64_t Imm)
|
||||
{
|
||||
uint8_t BitA = (Imm & 0xff00000000000000ULL) != 0;
|
||||
uint8_t BitB = (Imm & 0x00ff000000000000ULL) != 0;
|
||||
uint8_t BitC = (Imm & 0x0000ff0000000000ULL) != 0;
|
||||
uint8_t BitD = (Imm & 0x000000ff00000000ULL) != 0;
|
||||
uint8_t BitE = (Imm & 0x00000000ff000000ULL) != 0;
|
||||
uint8_t BitF = (Imm & 0x0000000000ff0000ULL) != 0;
|
||||
uint8_t BitG = (Imm & 0x000000000000ff00ULL) != 0;
|
||||
uint8_t BitH = (Imm & 0x00000000000000ffULL) != 0;
|
||||
|
||||
uint8_t EncVal = BitA;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitB;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitC;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitD;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitE;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitF;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitG;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitH;
|
||||
return EncVal;
|
||||
}
|
||||
|
||||
static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType10(uint8_t Imm)
|
||||
{
|
||||
uint64_t EncVal = 0;
|
||||
if (Imm & 0x80)
|
||||
EncVal |= 0xff00000000000000ULL;
|
||||
if (Imm & 0x40)
|
||||
EncVal |= 0x00ff000000000000ULL;
|
||||
if (Imm & 0x20)
|
||||
EncVal |= 0x0000ff0000000000ULL;
|
||||
if (Imm & 0x10)
|
||||
EncVal |= 0x000000ff00000000ULL;
|
||||
if (Imm & 0x08)
|
||||
EncVal |= 0x00000000ff000000ULL;
|
||||
if (Imm & 0x04)
|
||||
EncVal |= 0x0000000000ff0000ULL;
|
||||
if (Imm & 0x02)
|
||||
EncVal |= 0x000000000000ff00ULL;
|
||||
if (Imm & 0x01)
|
||||
EncVal |= 0x00000000000000ffULL;
|
||||
return EncVal;
|
||||
}
|
||||
|
||||
// aBbbbbbc defgh000 0x00 0x00 aBbbbbbc defgh000 0x00 0x00
|
||||
static inline bool AArch64_AM_isAdvSIMDModImmType11(uint64_t Imm)
|
||||
{
|
||||
uint64_t BString = (Imm & 0x7E000000ULL) >> 25;
|
||||
return ((Imm >> 32) == (Imm & 0xffffffffULL)) &&
|
||||
(BString == 0x1f || BString == 0x20) &&
|
||||
((Imm & 0x0007ffff0007ffffULL) == 0);
|
||||
}
|
||||
|
||||
static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType11(uint64_t Imm)
|
||||
{
|
||||
uint8_t BitA = (Imm & 0x80000000ULL) != 0;
|
||||
uint8_t BitB = (Imm & 0x20000000ULL) != 0;
|
||||
uint8_t BitC = (Imm & 0x01000000ULL) != 0;
|
||||
uint8_t BitD = (Imm & 0x00800000ULL) != 0;
|
||||
uint8_t BitE = (Imm & 0x00400000ULL) != 0;
|
||||
uint8_t BitF = (Imm & 0x00200000ULL) != 0;
|
||||
uint8_t BitG = (Imm & 0x00100000ULL) != 0;
|
||||
uint8_t BitH = (Imm & 0x00080000ULL) != 0;
|
||||
|
||||
uint8_t EncVal = BitA;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitB;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitC;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitD;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitE;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitF;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitG;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitH;
|
||||
return EncVal;
|
||||
}
|
||||
|
||||
static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType11(uint8_t Imm)
|
||||
{
|
||||
uint64_t EncVal = 0;
|
||||
if (Imm & 0x80)
|
||||
EncVal |= 0x80000000ULL;
|
||||
if (Imm & 0x40)
|
||||
EncVal |= 0x3e000000ULL;
|
||||
else
|
||||
EncVal |= 0x40000000ULL;
|
||||
if (Imm & 0x20)
|
||||
EncVal |= 0x01000000ULL;
|
||||
if (Imm & 0x10)
|
||||
EncVal |= 0x00800000ULL;
|
||||
if (Imm & 0x08)
|
||||
EncVal |= 0x00400000ULL;
|
||||
if (Imm & 0x04)
|
||||
EncVal |= 0x00200000ULL;
|
||||
if (Imm & 0x02)
|
||||
EncVal |= 0x00100000ULL;
|
||||
if (Imm & 0x01)
|
||||
EncVal |= 0x00080000ULL;
|
||||
return (EncVal << 32) | EncVal;
|
||||
}
|
||||
|
||||
// aBbbbbbb bbcdefgh 0x00 0x00 0x00 0x00 0x00 0x00
|
||||
static inline bool AArch64_AM_isAdvSIMDModImmType12(uint64_t Imm)
|
||||
{
|
||||
uint64_t BString = (Imm & 0x7fc0000000000000ULL) >> 54;
|
||||
return ((BString == 0xff || BString == 0x100) &&
|
||||
((Imm & 0x0000ffffffffffffULL) == 0));
|
||||
}
|
||||
|
||||
static inline uint8_t AArch64_AM_encodeAdvSIMDModImmType12(uint64_t Imm)
|
||||
{
|
||||
uint8_t BitA = (Imm & 0x8000000000000000ULL) != 0;
|
||||
uint8_t BitB = (Imm & 0x0040000000000000ULL) != 0;
|
||||
uint8_t BitC = (Imm & 0x0020000000000000ULL) != 0;
|
||||
uint8_t BitD = (Imm & 0x0010000000000000ULL) != 0;
|
||||
uint8_t BitE = (Imm & 0x0008000000000000ULL) != 0;
|
||||
uint8_t BitF = (Imm & 0x0004000000000000ULL) != 0;
|
||||
uint8_t BitG = (Imm & 0x0002000000000000ULL) != 0;
|
||||
uint8_t BitH = (Imm & 0x0001000000000000ULL) != 0;
|
||||
|
||||
uint8_t EncVal = BitA;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitB;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitC;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitD;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitE;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitF;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitG;
|
||||
EncVal <<= 1;
|
||||
EncVal |= BitH;
|
||||
return EncVal;
|
||||
}
|
||||
|
||||
static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType12(uint8_t Imm)
|
||||
{
|
||||
uint64_t EncVal = 0;
|
||||
if (Imm & 0x80)
|
||||
EncVal |= 0x8000000000000000ULL;
|
||||
if (Imm & 0x40)
|
||||
EncVal |= 0x3fc0000000000000ULL;
|
||||
else
|
||||
EncVal |= 0x4000000000000000ULL;
|
||||
if (Imm & 0x20)
|
||||
EncVal |= 0x0020000000000000ULL;
|
||||
if (Imm & 0x10)
|
||||
EncVal |= 0x0010000000000000ULL;
|
||||
if (Imm & 0x08)
|
||||
EncVal |= 0x0008000000000000ULL;
|
||||
if (Imm & 0x04)
|
||||
EncVal |= 0x0004000000000000ULL;
|
||||
if (Imm & 0x02)
|
||||
EncVal |= 0x0002000000000000ULL;
|
||||
if (Imm & 0x01)
|
||||
EncVal |= 0x0001000000000000ULL;
|
||||
return (EncVal << 32) | EncVal;
|
||||
}
|
||||
|
||||
/// Returns true if Imm is the concatenation of a repeating pattern of type T.
|
||||
#define DEFINE_isSVEMaskOfIdenticalElements(T) \
|
||||
static inline bool CONCAT(AArch64_AM_isSVEMaskOfIdenticalElements, \
|
||||
T)(int64_t Imm) \
|
||||
{ \
|
||||
union { \
|
||||
int64_t In; \
|
||||
T Out[sizeof(int64_t) / sizeof(T)]; \
|
||||
} U_Parts; \
|
||||
U_Parts.In = Imm; \
|
||||
T *Parts = U_Parts.Out; \
|
||||
for (int i = 0; i < (sizeof(int64_t) / sizeof(T)); i++) { \
|
||||
if (Parts[i] != Parts[0]) \
|
||||
return false; \
|
||||
} \
|
||||
return true; \
|
||||
}
|
||||
DEFINE_isSVEMaskOfIdenticalElements(int8_t);
|
||||
DEFINE_isSVEMaskOfIdenticalElements(int16_t);
|
||||
DEFINE_isSVEMaskOfIdenticalElements(int32_t);
|
||||
DEFINE_isSVEMaskOfIdenticalElements(int64_t);
|
||||
|
||||
static inline bool isSVECpyImm8(int64_t Imm)
|
||||
{
|
||||
bool IsImm8 = (int8_t)Imm == Imm;
|
||||
|
||||
return IsImm8 || (uint8_t)Imm == Imm;
|
||||
}
|
||||
|
||||
static inline bool isSVECpyImm16(int64_t Imm)
|
||||
{
|
||||
bool IsImm8 = (int8_t)Imm == Imm;
|
||||
bool IsImm16 = (int16_t)(Imm & ~0xff) == Imm;
|
||||
|
||||
return IsImm8 || IsImm16 || (uint16_t)(Imm & ~0xff) == Imm;
|
||||
}
|
||||
|
||||
static inline bool isSVECpyImm32(int64_t Imm)
|
||||
{
|
||||
bool IsImm8 = (int8_t)Imm == Imm;
|
||||
bool IsImm16 = (int16_t)(Imm & ~0xff) == Imm;
|
||||
|
||||
return IsImm8 || IsImm16;
|
||||
}
|
||||
|
||||
static inline bool isSVECpyImm64(int64_t Imm)
|
||||
{
|
||||
bool IsImm8 = (int8_t)Imm == Imm;
|
||||
bool IsImm16 = (int16_t)(Imm & ~0xff) == Imm;
|
||||
|
||||
return IsImm8 || IsImm16;
|
||||
}
|
||||
|
||||
/// Return true if Imm is valid for DUPM and has no single CPY/DUP equivalent.
|
||||
static inline bool
|
||||
AArch64_AM_isSVEMoveMaskPreferredLogicalImmediate(int64_t Imm)
|
||||
{
|
||||
if (isSVECpyImm64(Imm))
|
||||
return false;
|
||||
|
||||
union {
|
||||
int64_t In;
|
||||
int32_t Out[2];
|
||||
} U_S;
|
||||
U_S.In = Imm;
|
||||
int32_t *S = U_S.Out;
|
||||
union {
|
||||
int64_t In;
|
||||
int16_t Out[4];
|
||||
} U_H;
|
||||
U_H.In = Imm;
|
||||
int16_t *H = U_H.Out;
|
||||
union {
|
||||
int64_t In;
|
||||
int8_t Out[8];
|
||||
} U_B;
|
||||
U_B.In = Imm;
|
||||
int8_t *B = U_B.Out;
|
||||
|
||||
if (CONCAT(AArch64_AM_isSVEMaskOfIdenticalElements, int32_t)(Imm) &&
|
||||
isSVECpyImm32(S[0]))
|
||||
return false;
|
||||
if (CONCAT(AArch64_AM_isSVEMaskOfIdenticalElements, int16_t)(Imm) &&
|
||||
isSVECpyImm16(H[0]))
|
||||
return false;
|
||||
if (CONCAT(AArch64_AM_isSVEMaskOfIdenticalElements, int8_t)(Imm) &&
|
||||
isSVECpyImm8(B[0]))
|
||||
return false;
|
||||
return AArch64_AM_isLogicalImmediate(Imm, 64);
|
||||
}
|
||||
|
||||
inline static bool AArch64_AM_isAnyMOVZMovAlias(uint64_t Value, int RegWidth)
|
||||
{
|
||||
for (int Shift = 0; Shift <= RegWidth - 16; Shift += 16)
|
||||
if ((Value & ~(0xffffULL << Shift)) == 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
inline static bool AArch64_AM_isMOVZMovAlias(uint64_t Value, int Shift,
|
||||
int RegWidth)
|
||||
{
|
||||
if (RegWidth == 32)
|
||||
Value &= 0xffffffffULL;
|
||||
|
||||
// "lsl #0" takes precedence: in practice this only affects "#0, lsl #0".
|
||||
if (Value == 0 && Shift != 0)
|
||||
return false;
|
||||
|
||||
return (Value & ~(0xffffULL << Shift)) == 0;
|
||||
}
|
||||
|
||||
inline static bool AArch64_AM_isMOVNMovAlias(uint64_t Value, int Shift,
|
||||
int RegWidth)
|
||||
{
|
||||
// MOVZ takes precedence over MOVN.
|
||||
if (AArch64_AM_isAnyMOVZMovAlias(Value, RegWidth))
|
||||
return false;
|
||||
|
||||
Value = ~Value;
|
||||
if (RegWidth == 32)
|
||||
Value &= 0xffffffffULL;
|
||||
|
||||
return AArch64_AM_isMOVZMovAlias(Value, Shift, RegWidth);
|
||||
}
|
||||
|
||||
inline static bool AArch64_AM_isAnyMOVWMovAlias(uint64_t Value, int RegWidth)
|
||||
{
|
||||
if (AArch64_AM_isAnyMOVZMovAlias(Value, RegWidth))
|
||||
return true;
|
||||
|
||||
// It's not a MOVZ, but it might be a MOVN.
|
||||
Value = ~Value;
|
||||
if (RegWidth == 32)
|
||||
Value &= 0xffffffffULL;
|
||||
|
||||
return AArch64_AM_isAnyMOVZMovAlias(Value, RegWidth);
|
||||
}
|
||||
|
||||
// CS namespace end: AArch64_AM
|
||||
|
||||
// end namespace AArch64_AM
|
||||
|
||||
// end namespace llvm
|
||||
|
||||
#endif
|
175
thirdparty/capstone/arch/AArch64/AArch64BaseInfo.c
vendored
Normal file
175
thirdparty/capstone/arch/AArch64/AArch64BaseInfo.c
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
/* Capstone Disassembly Engine, http://www.capstone-engine.org */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */
|
||||
/* Rot127 <unisono@quyllur.org> 2022-2023 */
|
||||
/* Automatically translated source file from LLVM. */
|
||||
|
||||
/* LLVM-commit: <commit> */
|
||||
/* LLVM-tag: <tag> */
|
||||
|
||||
/* Only small edits allowed. */
|
||||
/* For multiple similar edits, please create a Patch for the translator. */
|
||||
|
||||
/* Capstone's C++ file translator: */
|
||||
/* https://github.com/capstone-engine/capstone/tree/next/suite/auto-sync */
|
||||
|
||||
//===-- AArch64BaseInfo.cpp - AArch64 Base encoding information------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file provides basic encoding and assembly information for AArch64.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#include <capstone/platform.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "AArch64BaseInfo.h"
|
||||
|
||||
#define CONCAT(a, b) CONCAT_(a, b)
|
||||
#define CONCAT_(a, b) a##_##b
|
||||
|
||||
#define GET_AT_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_AT_IMPL
|
||||
|
||||
#define GET_DBNXS_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_DBNXS_IMPL
|
||||
|
||||
#define GET_DB_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_DB_IMPL
|
||||
|
||||
#define GET_DC_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_DC_IMPL
|
||||
|
||||
#define GET_IC_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_IC_IMPL
|
||||
|
||||
#define GET_ISB_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_ISB_IMPL
|
||||
|
||||
#define GET_TSB_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_TSB_IMPL
|
||||
|
||||
#define GET_PRCTX_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_PRCTX_IMPL
|
||||
|
||||
#define GET_PRFM_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_PRFM_IMPL
|
||||
|
||||
#define GET_SVEPRFM_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_SVEPRFM_IMPL
|
||||
|
||||
#define GET_RPRFM_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_RPRFM_IMPL
|
||||
|
||||
// namespace AArch64RPRFM
|
||||
// namespace llvm
|
||||
|
||||
#define GET_SVEPREDPAT_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_SVEPREDPAT_IMPL
|
||||
|
||||
#define GET_SVEVECLENSPECIFIER_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_SVEVECLENSPECIFIER_IMPL
|
||||
|
||||
// namespace AArch64SVEVecLenSpecifier
|
||||
// namespace llvm
|
||||
|
||||
#define GET_EXACTFPIMM_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_EXACTFPIMM_IMPL
|
||||
|
||||
#define GET_PSTATEIMM0_15_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_PSTATEIMM0_15_IMPL
|
||||
|
||||
#define GET_PSTATEIMM0_1_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_PSTATEIMM0_1_IMPL
|
||||
|
||||
#define GET_PSB_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_PSB_IMPL
|
||||
|
||||
#define GET_BTI_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_BTI_IMPL
|
||||
|
||||
#define SysReg AArch64SysReg_SysReg
|
||||
#define GET_SYSREG_IMPL
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_SYSREG_IMPL
|
||||
|
||||
#undef SysReg
|
||||
|
||||
// return a string representing the number X
|
||||
// NOTE: result must be big enough to contain the data
|
||||
static void utostr(uint64_t X, bool isNeg, char *result)
|
||||
{
|
||||
char Buffer[22];
|
||||
char *BufPtr = Buffer + 21;
|
||||
|
||||
Buffer[21] = '\0';
|
||||
if (X == 0)
|
||||
*--BufPtr = '0'; // Handle special case...
|
||||
|
||||
while (X) {
|
||||
*--BufPtr = X % 10 + '0';
|
||||
X /= 10;
|
||||
}
|
||||
|
||||
if (isNeg)
|
||||
*--BufPtr = '-'; // Add negative sign...
|
||||
|
||||
// suppose that result is big enough
|
||||
strncpy(result, BufPtr, sizeof(Buffer));
|
||||
}
|
||||
|
||||
// NOTE: result must be big enough to contain the result
|
||||
void AArch64SysReg_genericRegisterString(uint32_t Bits, char *result)
|
||||
{
|
||||
// assert(Bits < 0x10000);
|
||||
char Op0Str[32], Op1Str[32], CRnStr[32], CRmStr[32], Op2Str[32];
|
||||
int dummy;
|
||||
uint32_t Op0 = (Bits >> 14) & 0x3;
|
||||
uint32_t Op1 = (Bits >> 11) & 0x7;
|
||||
uint32_t CRn = (Bits >> 7) & 0xf;
|
||||
uint32_t CRm = (Bits >> 3) & 0xf;
|
||||
uint32_t Op2 = Bits & 0x7;
|
||||
|
||||
utostr(Op0, false, Op0Str);
|
||||
utostr(Op1, false, Op1Str);
|
||||
utostr(Op2, false, Op2Str);
|
||||
utostr(CRn, false, CRnStr);
|
||||
utostr(CRm, false, CRmStr);
|
||||
|
||||
dummy = cs_snprintf(result, AARCH64_GRS_LEN, "s%s_%s_c%s_c%s_%s",
|
||||
Op0Str, Op1Str, CRnStr, CRmStr, Op2Str);
|
||||
(void)dummy;
|
||||
}
|
||||
|
||||
#define GET_TLBITable_IMPL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_TLBITable_IMPL
|
||||
|
||||
#define GET_SVCR_IMPL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
#undef GET_SVCR_IMPL
|
983
thirdparty/capstone/arch/AArch64/AArch64BaseInfo.h
vendored
Normal file
983
thirdparty/capstone/arch/AArch64/AArch64BaseInfo.h
vendored
Normal file
@@ -0,0 +1,983 @@
|
||||
/* Capstone Disassembly Engine, http://www.capstone-engine.org */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */
|
||||
/* Rot127 <unisono@quyllur.org> 2022-2023 */
|
||||
/* Automatically translated source file from LLVM. */
|
||||
|
||||
/* LLVM-commit: <commit> */
|
||||
/* LLVM-tag: <tag> */
|
||||
|
||||
/* Only small edits allowed. */
|
||||
/* For multiple similar edits, please create a Patch for the translator. */
|
||||
|
||||
/* Capstone's C++ file translator: */
|
||||
/* https://github.com/capstone-engine/capstone/tree/next/suite/auto-sync */
|
||||
|
||||
//===-- AArch64BaseInfo.h - Top level definitions for AArch64 ---*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains small standalone helper functions and enum definitions for
|
||||
// the AArch64 target useful for the compiler back-end and the MC libraries.
|
||||
// As such, it deliberately does not include references to LLVM core
|
||||
// code gen types, passes, etc..
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIB_TARGET_AARCH64_UTILS_AARCH64BASEINFO_H
|
||||
#define LLVM_LIB_TARGET_AARCH64_UTILS_AARCH64BASEINFO_H
|
||||
|
||||
// FIXME: Is it easiest to fix this layering violation by moving the .inc
|
||||
// #includes from AArch64MCTargetDesc.h to here?
|
||||
#include <capstone/platform.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../../MCInstPrinter.h"
|
||||
|
||||
#include "../../utils.h"
|
||||
#include "capstone/aarch64.h"
|
||||
|
||||
#define GET_SUBTARGETINFO_ENUM
|
||||
#include "AArch64GenSubtargetInfo.inc"
|
||||
|
||||
#define GET_REGINFO_ENUM
|
||||
#define GET_REGINFO_MC_DESC
|
||||
#include "AArch64GenRegisterInfo.inc"
|
||||
|
||||
#define GET_INSTRINFO_ENUM
|
||||
#include "AArch64GenInstrInfo.inc"
|
||||
|
||||
#define CONCAT(a, b) CONCAT_(a, b)
|
||||
#define CONCAT_(a, b) a##_##b
|
||||
|
||||
static inline unsigned getWRegFromXReg(unsigned Reg)
|
||||
{
|
||||
switch (Reg) {
|
||||
case AArch64_X0:
|
||||
return AArch64_W0;
|
||||
case AArch64_X1:
|
||||
return AArch64_W1;
|
||||
case AArch64_X2:
|
||||
return AArch64_W2;
|
||||
case AArch64_X3:
|
||||
return AArch64_W3;
|
||||
case AArch64_X4:
|
||||
return AArch64_W4;
|
||||
case AArch64_X5:
|
||||
return AArch64_W5;
|
||||
case AArch64_X6:
|
||||
return AArch64_W6;
|
||||
case AArch64_X7:
|
||||
return AArch64_W7;
|
||||
case AArch64_X8:
|
||||
return AArch64_W8;
|
||||
case AArch64_X9:
|
||||
return AArch64_W9;
|
||||
case AArch64_X10:
|
||||
return AArch64_W10;
|
||||
case AArch64_X11:
|
||||
return AArch64_W11;
|
||||
case AArch64_X12:
|
||||
return AArch64_W12;
|
||||
case AArch64_X13:
|
||||
return AArch64_W13;
|
||||
case AArch64_X14:
|
||||
return AArch64_W14;
|
||||
case AArch64_X15:
|
||||
return AArch64_W15;
|
||||
case AArch64_X16:
|
||||
return AArch64_W16;
|
||||
case AArch64_X17:
|
||||
return AArch64_W17;
|
||||
case AArch64_X18:
|
||||
return AArch64_W18;
|
||||
case AArch64_X19:
|
||||
return AArch64_W19;
|
||||
case AArch64_X20:
|
||||
return AArch64_W20;
|
||||
case AArch64_X21:
|
||||
return AArch64_W21;
|
||||
case AArch64_X22:
|
||||
return AArch64_W22;
|
||||
case AArch64_X23:
|
||||
return AArch64_W23;
|
||||
case AArch64_X24:
|
||||
return AArch64_W24;
|
||||
case AArch64_X25:
|
||||
return AArch64_W25;
|
||||
case AArch64_X26:
|
||||
return AArch64_W26;
|
||||
case AArch64_X27:
|
||||
return AArch64_W27;
|
||||
case AArch64_X28:
|
||||
return AArch64_W28;
|
||||
case AArch64_FP:
|
||||
return AArch64_W29;
|
||||
case AArch64_LR:
|
||||
return AArch64_W30;
|
||||
case AArch64_SP:
|
||||
return AArch64_WSP;
|
||||
case AArch64_XZR:
|
||||
return AArch64_WZR;
|
||||
}
|
||||
// For anything else, return it unchanged.
|
||||
return Reg;
|
||||
}
|
||||
|
||||
static inline unsigned getXRegFromWReg(unsigned Reg)
|
||||
{
|
||||
switch (Reg) {
|
||||
case AArch64_W0:
|
||||
return AArch64_X0;
|
||||
case AArch64_W1:
|
||||
return AArch64_X1;
|
||||
case AArch64_W2:
|
||||
return AArch64_X2;
|
||||
case AArch64_W3:
|
||||
return AArch64_X3;
|
||||
case AArch64_W4:
|
||||
return AArch64_X4;
|
||||
case AArch64_W5:
|
||||
return AArch64_X5;
|
||||
case AArch64_W6:
|
||||
return AArch64_X6;
|
||||
case AArch64_W7:
|
||||
return AArch64_X7;
|
||||
case AArch64_W8:
|
||||
return AArch64_X8;
|
||||
case AArch64_W9:
|
||||
return AArch64_X9;
|
||||
case AArch64_W10:
|
||||
return AArch64_X10;
|
||||
case AArch64_W11:
|
||||
return AArch64_X11;
|
||||
case AArch64_W12:
|
||||
return AArch64_X12;
|
||||
case AArch64_W13:
|
||||
return AArch64_X13;
|
||||
case AArch64_W14:
|
||||
return AArch64_X14;
|
||||
case AArch64_W15:
|
||||
return AArch64_X15;
|
||||
case AArch64_W16:
|
||||
return AArch64_X16;
|
||||
case AArch64_W17:
|
||||
return AArch64_X17;
|
||||
case AArch64_W18:
|
||||
return AArch64_X18;
|
||||
case AArch64_W19:
|
||||
return AArch64_X19;
|
||||
case AArch64_W20:
|
||||
return AArch64_X20;
|
||||
case AArch64_W21:
|
||||
return AArch64_X21;
|
||||
case AArch64_W22:
|
||||
return AArch64_X22;
|
||||
case AArch64_W23:
|
||||
return AArch64_X23;
|
||||
case AArch64_W24:
|
||||
return AArch64_X24;
|
||||
case AArch64_W25:
|
||||
return AArch64_X25;
|
||||
case AArch64_W26:
|
||||
return AArch64_X26;
|
||||
case AArch64_W27:
|
||||
return AArch64_X27;
|
||||
case AArch64_W28:
|
||||
return AArch64_X28;
|
||||
case AArch64_W29:
|
||||
return AArch64_FP;
|
||||
case AArch64_W30:
|
||||
return AArch64_LR;
|
||||
case AArch64_WSP:
|
||||
return AArch64_SP;
|
||||
case AArch64_WZR:
|
||||
return AArch64_XZR;
|
||||
}
|
||||
// For anything else, return it unchanged.
|
||||
return Reg;
|
||||
}
|
||||
|
||||
static inline unsigned getXRegFromXRegTuple(unsigned RegTuple)
|
||||
{
|
||||
switch (RegTuple) {
|
||||
case AArch64_X0_X1_X2_X3_X4_X5_X6_X7:
|
||||
return AArch64_X0;
|
||||
case AArch64_X2_X3_X4_X5_X6_X7_X8_X9:
|
||||
return AArch64_X2;
|
||||
case AArch64_X4_X5_X6_X7_X8_X9_X10_X11:
|
||||
return AArch64_X4;
|
||||
case AArch64_X6_X7_X8_X9_X10_X11_X12_X13:
|
||||
return AArch64_X6;
|
||||
case AArch64_X8_X9_X10_X11_X12_X13_X14_X15:
|
||||
return AArch64_X8;
|
||||
case AArch64_X10_X11_X12_X13_X14_X15_X16_X17:
|
||||
return AArch64_X10;
|
||||
case AArch64_X12_X13_X14_X15_X16_X17_X18_X19:
|
||||
return AArch64_X12;
|
||||
case AArch64_X14_X15_X16_X17_X18_X19_X20_X21:
|
||||
return AArch64_X14;
|
||||
case AArch64_X16_X17_X18_X19_X20_X21_X22_X23:
|
||||
return AArch64_X16;
|
||||
case AArch64_X18_X19_X20_X21_X22_X23_X24_X25:
|
||||
return AArch64_X18;
|
||||
case AArch64_X20_X21_X22_X23_X24_X25_X26_X27:
|
||||
return AArch64_X20;
|
||||
case AArch64_X22_X23_X24_X25_X26_X27_X28_FP:
|
||||
return AArch64_X22;
|
||||
}
|
||||
// For anything else, return it unchanged.
|
||||
return RegTuple;
|
||||
}
|
||||
|
||||
static inline unsigned getBRegFromDReg(unsigned Reg)
|
||||
{
|
||||
switch (Reg) {
|
||||
case AArch64_D0:
|
||||
return AArch64_B0;
|
||||
case AArch64_D1:
|
||||
return AArch64_B1;
|
||||
case AArch64_D2:
|
||||
return AArch64_B2;
|
||||
case AArch64_D3:
|
||||
return AArch64_B3;
|
||||
case AArch64_D4:
|
||||
return AArch64_B4;
|
||||
case AArch64_D5:
|
||||
return AArch64_B5;
|
||||
case AArch64_D6:
|
||||
return AArch64_B6;
|
||||
case AArch64_D7:
|
||||
return AArch64_B7;
|
||||
case AArch64_D8:
|
||||
return AArch64_B8;
|
||||
case AArch64_D9:
|
||||
return AArch64_B9;
|
||||
case AArch64_D10:
|
||||
return AArch64_B10;
|
||||
case AArch64_D11:
|
||||
return AArch64_B11;
|
||||
case AArch64_D12:
|
||||
return AArch64_B12;
|
||||
case AArch64_D13:
|
||||
return AArch64_B13;
|
||||
case AArch64_D14:
|
||||
return AArch64_B14;
|
||||
case AArch64_D15:
|
||||
return AArch64_B15;
|
||||
case AArch64_D16:
|
||||
return AArch64_B16;
|
||||
case AArch64_D17:
|
||||
return AArch64_B17;
|
||||
case AArch64_D18:
|
||||
return AArch64_B18;
|
||||
case AArch64_D19:
|
||||
return AArch64_B19;
|
||||
case AArch64_D20:
|
||||
return AArch64_B20;
|
||||
case AArch64_D21:
|
||||
return AArch64_B21;
|
||||
case AArch64_D22:
|
||||
return AArch64_B22;
|
||||
case AArch64_D23:
|
||||
return AArch64_B23;
|
||||
case AArch64_D24:
|
||||
return AArch64_B24;
|
||||
case AArch64_D25:
|
||||
return AArch64_B25;
|
||||
case AArch64_D26:
|
||||
return AArch64_B26;
|
||||
case AArch64_D27:
|
||||
return AArch64_B27;
|
||||
case AArch64_D28:
|
||||
return AArch64_B28;
|
||||
case AArch64_D29:
|
||||
return AArch64_B29;
|
||||
case AArch64_D30:
|
||||
return AArch64_B30;
|
||||
case AArch64_D31:
|
||||
return AArch64_B31;
|
||||
}
|
||||
// For anything else, return it unchanged.
|
||||
return Reg;
|
||||
}
|
||||
|
||||
static inline unsigned getDRegFromBReg(unsigned Reg)
|
||||
{
|
||||
switch (Reg) {
|
||||
case AArch64_B0:
|
||||
return AArch64_D0;
|
||||
case AArch64_B1:
|
||||
return AArch64_D1;
|
||||
case AArch64_B2:
|
||||
return AArch64_D2;
|
||||
case AArch64_B3:
|
||||
return AArch64_D3;
|
||||
case AArch64_B4:
|
||||
return AArch64_D4;
|
||||
case AArch64_B5:
|
||||
return AArch64_D5;
|
||||
case AArch64_B6:
|
||||
return AArch64_D6;
|
||||
case AArch64_B7:
|
||||
return AArch64_D7;
|
||||
case AArch64_B8:
|
||||
return AArch64_D8;
|
||||
case AArch64_B9:
|
||||
return AArch64_D9;
|
||||
case AArch64_B10:
|
||||
return AArch64_D10;
|
||||
case AArch64_B11:
|
||||
return AArch64_D11;
|
||||
case AArch64_B12:
|
||||
return AArch64_D12;
|
||||
case AArch64_B13:
|
||||
return AArch64_D13;
|
||||
case AArch64_B14:
|
||||
return AArch64_D14;
|
||||
case AArch64_B15:
|
||||
return AArch64_D15;
|
||||
case AArch64_B16:
|
||||
return AArch64_D16;
|
||||
case AArch64_B17:
|
||||
return AArch64_D17;
|
||||
case AArch64_B18:
|
||||
return AArch64_D18;
|
||||
case AArch64_B19:
|
||||
return AArch64_D19;
|
||||
case AArch64_B20:
|
||||
return AArch64_D20;
|
||||
case AArch64_B21:
|
||||
return AArch64_D21;
|
||||
case AArch64_B22:
|
||||
return AArch64_D22;
|
||||
case AArch64_B23:
|
||||
return AArch64_D23;
|
||||
case AArch64_B24:
|
||||
return AArch64_D24;
|
||||
case AArch64_B25:
|
||||
return AArch64_D25;
|
||||
case AArch64_B26:
|
||||
return AArch64_D26;
|
||||
case AArch64_B27:
|
||||
return AArch64_D27;
|
||||
case AArch64_B28:
|
||||
return AArch64_D28;
|
||||
case AArch64_B29:
|
||||
return AArch64_D29;
|
||||
case AArch64_B30:
|
||||
return AArch64_D30;
|
||||
case AArch64_B31:
|
||||
return AArch64_D31;
|
||||
}
|
||||
// For anything else, return it unchanged.
|
||||
return Reg;
|
||||
}
|
||||
|
||||
static inline bool atomicBarrierDroppedOnZero(unsigned Opcode)
|
||||
{
|
||||
switch (Opcode) {
|
||||
case AArch64_LDADDAB:
|
||||
case AArch64_LDADDAH:
|
||||
case AArch64_LDADDAW:
|
||||
case AArch64_LDADDAX:
|
||||
case AArch64_LDADDALB:
|
||||
case AArch64_LDADDALH:
|
||||
case AArch64_LDADDALW:
|
||||
case AArch64_LDADDALX:
|
||||
case AArch64_LDCLRAB:
|
||||
case AArch64_LDCLRAH:
|
||||
case AArch64_LDCLRAW:
|
||||
case AArch64_LDCLRAX:
|
||||
case AArch64_LDCLRALB:
|
||||
case AArch64_LDCLRALH:
|
||||
case AArch64_LDCLRALW:
|
||||
case AArch64_LDCLRALX:
|
||||
case AArch64_LDEORAB:
|
||||
case AArch64_LDEORAH:
|
||||
case AArch64_LDEORAW:
|
||||
case AArch64_LDEORAX:
|
||||
case AArch64_LDEORALB:
|
||||
case AArch64_LDEORALH:
|
||||
case AArch64_LDEORALW:
|
||||
case AArch64_LDEORALX:
|
||||
case AArch64_LDSETAB:
|
||||
case AArch64_LDSETAH:
|
||||
case AArch64_LDSETAW:
|
||||
case AArch64_LDSETAX:
|
||||
case AArch64_LDSETALB:
|
||||
case AArch64_LDSETALH:
|
||||
case AArch64_LDSETALW:
|
||||
case AArch64_LDSETALX:
|
||||
case AArch64_LDSMAXAB:
|
||||
case AArch64_LDSMAXAH:
|
||||
case AArch64_LDSMAXAW:
|
||||
case AArch64_LDSMAXAX:
|
||||
case AArch64_LDSMAXALB:
|
||||
case AArch64_LDSMAXALH:
|
||||
case AArch64_LDSMAXALW:
|
||||
case AArch64_LDSMAXALX:
|
||||
case AArch64_LDSMINAB:
|
||||
case AArch64_LDSMINAH:
|
||||
case AArch64_LDSMINAW:
|
||||
case AArch64_LDSMINAX:
|
||||
case AArch64_LDSMINALB:
|
||||
case AArch64_LDSMINALH:
|
||||
case AArch64_LDSMINALW:
|
||||
case AArch64_LDSMINALX:
|
||||
case AArch64_LDUMAXAB:
|
||||
case AArch64_LDUMAXAH:
|
||||
case AArch64_LDUMAXAW:
|
||||
case AArch64_LDUMAXAX:
|
||||
case AArch64_LDUMAXALB:
|
||||
case AArch64_LDUMAXALH:
|
||||
case AArch64_LDUMAXALW:
|
||||
case AArch64_LDUMAXALX:
|
||||
case AArch64_LDUMINAB:
|
||||
case AArch64_LDUMINAH:
|
||||
case AArch64_LDUMINAW:
|
||||
case AArch64_LDUMINAX:
|
||||
case AArch64_LDUMINALB:
|
||||
case AArch64_LDUMINALH:
|
||||
case AArch64_LDUMINALW:
|
||||
case AArch64_LDUMINALX:
|
||||
case AArch64_SWPAB:
|
||||
case AArch64_SWPAH:
|
||||
case AArch64_SWPAW:
|
||||
case AArch64_SWPAX:
|
||||
case AArch64_SWPALB:
|
||||
case AArch64_SWPALH:
|
||||
case AArch64_SWPALW:
|
||||
case AArch64_SWPALX:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// MOVE-NOTICE: AArch64CC_CondCode : moved to aarch64.h
|
||||
// MOVE-NOTICE: AArch64CC_getCondCodeName : moved to aarch64.h
|
||||
// MOVE-NOTICE: AArch64CC_getInvertedCondCode : moved to aarch64.h
|
||||
// MOVE-NOTICE: AArch64CC_getNZCVToSatisfyCondCode : moved to aarch64.h
|
||||
|
||||
typedef struct SysAlias {
|
||||
const char *Name;
|
||||
aarch64_sysop_alias SysAlias;
|
||||
uint16_t Encoding;
|
||||
aarch64_insn_group FeaturesRequired[3];
|
||||
} SysAlias;
|
||||
|
||||
typedef struct SysAliasReg {
|
||||
const char *Name;
|
||||
aarch64_sysop_reg SysReg;
|
||||
uint16_t Encoding;
|
||||
bool NeedsReg;
|
||||
aarch64_insn_group FeaturesRequired[3];
|
||||
} SysAliasReg;
|
||||
|
||||
typedef struct SysAliasImm {
|
||||
const char *Name;
|
||||
aarch64_sysop_imm SysImm;
|
||||
uint16_t ImmValue;
|
||||
uint16_t Encoding;
|
||||
aarch64_insn_group FeaturesRequired[3];
|
||||
} SysAliasImm;
|
||||
|
||||
// CS namespace begin: AArch64SVCR
|
||||
|
||||
#define AArch64SVCR_SVCR SysAlias
|
||||
|
||||
#define GET_SVCR_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64SVCR
|
||||
|
||||
// CS namespace begin: AArch64AT
|
||||
|
||||
#define AArch64AT_AT SysAlias
|
||||
|
||||
#define GET_AT_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64AT
|
||||
|
||||
// CS namespace begin: AArch64DB
|
||||
|
||||
#define AArch64DB_DB SysAlias
|
||||
|
||||
#define GET_DB_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64DB
|
||||
|
||||
// CS namespace begin: AArch64DBnXS
|
||||
|
||||
#define AArch64DBnXS_DBnXS SysAliasImm
|
||||
|
||||
#define GET_DBNXS_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64DBnXS
|
||||
|
||||
// CS namespace begin: AArch64DC
|
||||
|
||||
#define AArch64DC_DC SysAlias
|
||||
|
||||
#define GET_DC_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64DC
|
||||
|
||||
// CS namespace begin: AArch64IC
|
||||
|
||||
#define AArch64IC_IC SysAliasReg
|
||||
|
||||
#define GET_IC_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64IC
|
||||
|
||||
// CS namespace begin: AArch64ISB
|
||||
|
||||
#define AArch64ISB_ISB SysAlias
|
||||
|
||||
#define GET_ISB_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64ISB
|
||||
|
||||
// CS namespace begin: AArch64TSB
|
||||
|
||||
#define AArch64TSB_TSB SysAlias
|
||||
|
||||
#define GET_TSB_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64TSB
|
||||
|
||||
// CS namespace begin: AArch64PRFM
|
||||
|
||||
#define AArch64PRFM_PRFM SysAlias
|
||||
|
||||
#define GET_PRFM_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64PRFM
|
||||
|
||||
// CS namespace begin: AArch64SVEPRFM
|
||||
|
||||
#define AArch64SVEPRFM_SVEPRFM SysAlias
|
||||
|
||||
#define GET_SVEPRFM_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64SVEPRFM
|
||||
|
||||
// CS namespace begin: AArch64RPRFM
|
||||
|
||||
#define AArch64RPRFM_RPRFM SysAlias
|
||||
|
||||
#define GET_RPRFM_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64RPRFM
|
||||
|
||||
// CS namespace begin: AArch64SVEPredPattern
|
||||
|
||||
typedef struct SVEPREDPAT {
|
||||
const char *Name;
|
||||
aarch64_sysop_alias SysAlias;
|
||||
uint16_t Encoding;
|
||||
} AArch64SVEPredPattern_SVEPREDPAT;
|
||||
|
||||
#define GET_SVEPREDPAT_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64SVEPredPattern
|
||||
|
||||
// CS namespace begin: AArch64SVEVecLenSpecifier
|
||||
|
||||
typedef struct SVEVECLENSPECIFIER {
|
||||
const char *Name;
|
||||
aarch64_sysop_alias SysAlias;
|
||||
uint16_t Encoding;
|
||||
} AArch64SVEVecLenSpecifier_SVEVECLENSPECIFIER;
|
||||
|
||||
#define GET_SVEVECLENSPECIFIER_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64SVEVecLenSpecifier
|
||||
|
||||
// namespace AArch64SVEVecLenSpecifier
|
||||
|
||||
/// Return the number of active elements for VL1 to VL256 predicate pattern,
|
||||
/// zero for all other patterns.
|
||||
static inline unsigned getNumElementsFromSVEPredPattern(unsigned Pattern)
|
||||
{
|
||||
switch (Pattern) {
|
||||
default:
|
||||
return 0;
|
||||
case AARCH64_SVEPREDPAT_VL1:
|
||||
case AARCH64_SVEPREDPAT_VL2:
|
||||
case AARCH64_SVEPREDPAT_VL3:
|
||||
case AARCH64_SVEPREDPAT_VL4:
|
||||
case AARCH64_SVEPREDPAT_VL5:
|
||||
case AARCH64_SVEPREDPAT_VL6:
|
||||
case AARCH64_SVEPREDPAT_VL7:
|
||||
case AARCH64_SVEPREDPAT_VL8:
|
||||
return Pattern;
|
||||
case AARCH64_SVEPREDPAT_VL16:
|
||||
return 16;
|
||||
case AARCH64_SVEPREDPAT_VL32:
|
||||
return 32;
|
||||
case AARCH64_SVEPREDPAT_VL64:
|
||||
return 64;
|
||||
case AARCH64_SVEPREDPAT_VL128:
|
||||
return 128;
|
||||
case AARCH64_SVEPREDPAT_VL256:
|
||||
return 256;
|
||||
}
|
||||
}
|
||||
|
||||
/// Return specific VL predicate pattern based on the number of elements.
|
||||
static inline unsigned getSVEPredPatternFromNumElements(unsigned MinNumElts)
|
||||
{
|
||||
switch (MinNumElts) {
|
||||
default:
|
||||
return 0;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
return MinNumElts;
|
||||
case 16:
|
||||
return AARCH64_SVEPREDPAT_VL16;
|
||||
case 32:
|
||||
return AARCH64_SVEPREDPAT_VL32;
|
||||
case 64:
|
||||
return AARCH64_SVEPREDPAT_VL64;
|
||||
case 128:
|
||||
return AARCH64_SVEPREDPAT_VL128;
|
||||
case 256:
|
||||
return AARCH64_SVEPREDPAT_VL256;
|
||||
}
|
||||
}
|
||||
|
||||
// CS namespace begin: AArch64ExactFPImm
|
||||
|
||||
typedef struct ExactFPImm {
|
||||
const char *Name;
|
||||
aarch64_sysop_imm SysImm;
|
||||
int Enum;
|
||||
const char *Repr;
|
||||
} AArch64ExactFPImm_ExactFPImm;
|
||||
|
||||
enum {
|
||||
AArch64ExactFPImm_half = 1,
|
||||
AArch64ExactFPImm_one = 2,
|
||||
AArch64ExactFPImm_two = 3,
|
||||
AArch64ExactFPImm_zero = 0,
|
||||
};
|
||||
|
||||
#define GET_EXACTFPIMM_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64ExactFPImm
|
||||
|
||||
// CS namespace begin: AArch64PState
|
||||
|
||||
#define AArch64PState_PStateImm0_15 SysAlias
|
||||
|
||||
#define GET_PSTATEIMM0_15_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
#define AArch64PState_PStateImm0_1 SysAlias
|
||||
|
||||
#define GET_PSTATEIMM0_1_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64PState
|
||||
|
||||
// CS namespace begin: AArch64PSBHint
|
||||
|
||||
#define AArch64PSBHint_PSB SysAlias
|
||||
|
||||
#define GET_PSB_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64PSBHint
|
||||
|
||||
// CS namespace begin: AArch64BTIHint
|
||||
|
||||
#define AArch64BTIHint_BTI SysAlias
|
||||
|
||||
#define GET_BTI_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64BTIHint
|
||||
|
||||
// CS namespace begin: AArch64SE
|
||||
|
||||
typedef enum ShiftExtSpecifiers {
|
||||
AArch64SE_Invalid = -1,
|
||||
AArch64SE_LSL,
|
||||
AArch64SE_MSL,
|
||||
AArch64SE_LSR,
|
||||
AArch64SE_ASR,
|
||||
AArch64SE_ROR,
|
||||
|
||||
AArch64SE_UXTB,
|
||||
AArch64SE_UXTH,
|
||||
AArch64SE_UXTW,
|
||||
AArch64SE_UXTX,
|
||||
|
||||
AArch64SE_SXTB,
|
||||
AArch64SE_SXTH,
|
||||
AArch64SE_SXTW,
|
||||
AArch64SE_SXTX
|
||||
} AArch64SE_ShiftExtSpecifiers;
|
||||
|
||||
// CS namespace end: AArch64SE
|
||||
|
||||
// CS namespace begin: AArch64Layout
|
||||
|
||||
// MOVE_NOTICE: AArch64Layout_VectorLayout - move to aarch64.h
|
||||
// MOVE_NOTICE: AArch64VectorLayoutToString - move to aarch64.h
|
||||
// MOVE_NOTICE: AArch64StringToVectorLayout - move to aarch64.h
|
||||
|
||||
// CS namespace end: AArch64Layout
|
||||
|
||||
// CS namespace begin: AArch64SysReg
|
||||
|
||||
typedef struct SysReg {
|
||||
const char *Name;
|
||||
aarch64_sysop_reg SysReg;
|
||||
const char *AltName;
|
||||
aarch64_sysop_reg AliasReg;
|
||||
unsigned Encoding;
|
||||
bool Readable;
|
||||
bool Writeable;
|
||||
aarch64_insn_group FeaturesRequired[3];
|
||||
} AArch64SysReg_SysReg;
|
||||
|
||||
#define GET_SYSREG_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
const AArch64SysReg_SysReg *AArch64SysReg_lookupSysRegByName(const char *Name);
|
||||
const AArch64SysReg_SysReg *
|
||||
AArch64SysReg_lookupSysRegByEncoding(uint16_t Encoding);
|
||||
#define AARCH64_GRS_LEN 128
|
||||
void AArch64SysReg_genericRegisterString(uint32_t Bits, char *result);
|
||||
|
||||
// CS namespace end: AArch64SysReg
|
||||
|
||||
// CS namespace begin: AArch64TLBI
|
||||
|
||||
#define AArch64TLBI_TLBI SysAliasReg
|
||||
|
||||
#define GET_TLBITable_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64TLBI
|
||||
|
||||
// CS namespace begin: AArch64PRCTX
|
||||
|
||||
#define AArch64PRCTX_PRCTX SysAliasReg
|
||||
|
||||
#define GET_PRCTX_DECL
|
||||
|
||||
#include "AArch64GenSystemOperands.inc"
|
||||
|
||||
// CS namespace end: AArch64PRCTX
|
||||
|
||||
// CS namespace begin: AArch64II
|
||||
|
||||
/// Target Operand Flag enum.
|
||||
typedef enum TOF {
|
||||
//===------------------------------------------------------------------===//
|
||||
// AArch64 Specific MachineOperand flags.
|
||||
|
||||
AArch64II_MO_NO_FLAG,
|
||||
|
||||
AArch64II_MO_FRAGMENT = 0x7,
|
||||
|
||||
/// MO_PAGE - A symbol operand with this flag represents the pc-relative
|
||||
/// offset of the 4K page containing the symbol. This is used with the
|
||||
/// ADRP instruction.
|
||||
AArch64II_MO_PAGE = 1,
|
||||
|
||||
/// MO_PAGEOFF - A symbol operand with this flag represents the offset of
|
||||
/// that symbol within a 4K page. This offset is added to the page address
|
||||
/// to produce the complete address.
|
||||
AArch64II_MO_PAGEOFF = 2,
|
||||
|
||||
/// MO_G3 - A symbol operand with this flag (granule 3) represents the high
|
||||
/// 16-bits of a 64-bit address, used in a MOVZ or MOVK instruction
|
||||
AArch64II_MO_G3 = 3,
|
||||
|
||||
/// MO_G2 - A symbol operand with this flag (granule 2) represents the bits
|
||||
/// 32-47 of a 64-bit address, used in a MOVZ or MOVK instruction
|
||||
AArch64II_MO_G2 = 4,
|
||||
|
||||
/// MO_G1 - A symbol operand with this flag (granule 1) represents the bits
|
||||
/// 16-31 of a 64-bit address, used in a MOVZ or MOVK instruction
|
||||
AArch64II_MO_G1 = 5,
|
||||
|
||||
/// MO_G0 - A symbol operand with this flag (granule 0) represents the bits
|
||||
/// 0-15 of a 64-bit address, used in a MOVZ or MOVK instruction
|
||||
AArch64II_MO_G0 = 6,
|
||||
|
||||
/// MO_HI12 - This flag indicates that a symbol operand represents the bits
|
||||
/// 13-24 of a 64-bit address, used in a arithmetic immediate-shifted-left-
|
||||
/// by-12-bits instruction.
|
||||
AArch64II_MO_HI12 = 7,
|
||||
|
||||
/// MO_COFFSTUB - On a symbol operand "FOO", this indicates that the
|
||||
/// reference is actually to the ".refptr.FOO" symbol. This is used for
|
||||
/// stub symbols on windows.
|
||||
AArch64II_MO_COFFSTUB = 0x8,
|
||||
|
||||
/// MO_GOT - This flag indicates that a symbol operand represents the
|
||||
/// address of the GOT entry for the symbol, rather than the address of
|
||||
/// the symbol itself.
|
||||
AArch64II_MO_GOT = 0x10,
|
||||
|
||||
/// MO_NC - Indicates whether the linker is expected to check the symbol
|
||||
/// reference for overflow. For example in an ADRP/ADD pair of relocations
|
||||
/// the ADRP usually does check, but not the ADD.
|
||||
AArch64II_MO_NC = 0x20,
|
||||
|
||||
/// MO_TLS - Indicates that the operand being accessed is some kind of
|
||||
/// thread-local symbol. On Darwin, only one type of thread-local access
|
||||
/// exists (pre linker-relaxation), but on ELF the TLSModel used for the
|
||||
/// referee will affect interpretation.
|
||||
AArch64II_MO_TLS = 0x40,
|
||||
|
||||
/// MO_DLLIMPORT - On a symbol operand, this represents that the reference
|
||||
/// to the symbol is for an import stub. This is used for DLL import
|
||||
/// storage class indication on Windows.
|
||||
AArch64II_MO_DLLIMPORT = 0x80,
|
||||
|
||||
/// MO_S - Indicates that the bits of the symbol operand represented by
|
||||
/// MO_G0 etc are signed.
|
||||
AArch64II_MO_S = 0x100,
|
||||
|
||||
/// MO_PREL - Indicates that the bits of the symbol operand represented by
|
||||
/// MO_G0 etc are PC relative.
|
||||
AArch64II_MO_PREL = 0x200,
|
||||
|
||||
/// MO_TAGGED - With MO_PAGE, indicates that the page includes a memory tag
|
||||
/// in bits 56-63.
|
||||
/// On a FrameIndex operand, indicates that the underlying memory is tagged
|
||||
/// with an unknown tag value (MTE); this needs to be lowered either to an
|
||||
/// SP-relative load or store instruction (which do not check tags), or to
|
||||
/// an LDG instruction to obtain the tag value.
|
||||
AArch64II_MO_TAGGED = 0x400,
|
||||
|
||||
/// MO_ARM64EC_CALLMANGLE - Operand refers to the Arm64EC-mangled version
|
||||
/// of a symbol, not the original. For dllimport symbols, this means it
|
||||
/// uses "__imp_aux". For other symbols, this means it uses the mangled
|
||||
/// ("#" prefix for C) name.
|
||||
AArch64II_MO_ARM64EC_CALLMANGLE = 0x800,
|
||||
} AArch64II_TOF;
|
||||
|
||||
// CS namespace end: AArch64II
|
||||
|
||||
// end namespace AArch64II
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// v8.3a Pointer Authentication
|
||||
//
|
||||
|
||||
// CS namespace begin: AArch64PACKey
|
||||
|
||||
typedef enum ID {
|
||||
AArch64PACKey_IA = 0,
|
||||
AArch64PACKey_IB = 1,
|
||||
AArch64PACKey_DA = 2,
|
||||
AArch64PACKey_DB = 3,
|
||||
AArch64PACKey_LAST = AArch64PACKey_DB
|
||||
} AArch64PACKey_ID;
|
||||
|
||||
// CS namespace end: AArch64PACKey
|
||||
|
||||
// namespace AArch64PACKey
|
||||
|
||||
/// Return 2-letter identifier string for numeric key ID.
|
||||
static inline const char *AArch64PACKeyIDToString(AArch64PACKey_ID KeyID)
|
||||
{
|
||||
switch (KeyID) {
|
||||
case AArch64PACKey_IA:
|
||||
return "ia";
|
||||
case AArch64PACKey_IB:
|
||||
return "ib";
|
||||
case AArch64PACKey_DA:
|
||||
return "da";
|
||||
case AArch64PACKey_DB:
|
||||
return "db";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/// Return numeric key ID for 2-letter identifier string.
|
||||
static inline AArch64PACKey_ID AArch64StringToPACKeyID(const char *Name)
|
||||
{
|
||||
if (strcmp(Name, "ia") == 0)
|
||||
return AArch64PACKey_IA;
|
||||
if (strcmp(Name, "ib") == 0)
|
||||
return AArch64PACKey_IB;
|
||||
if (strcmp(Name, "da") == 0)
|
||||
return AArch64PACKey_DA;
|
||||
if (strcmp(Name, "db") == 0)
|
||||
return AArch64PACKey_DB;
|
||||
assert(0 && "Invalid PAC key");
|
||||
return AArch64PACKey_LAST;
|
||||
}
|
||||
|
||||
// CS namespace begin: AArch64
|
||||
|
||||
// The number of bits in a SVE register is architecturally defined
|
||||
// to be a multiple of this value. If <M x t> has this number of bits,
|
||||
// a <n x M x t> vector can be stored in a SVE register without any
|
||||
// redundant bits. If <M x t> has this number of bits divided by P,
|
||||
// a <n x M x t> vector is stored in a SVE register by placing index i
|
||||
// in index i*P of a <n x (M*P) x t> vector. The other elements of the
|
||||
// <n x (M*P) x t> vector (such as index 1) are undefined.
|
||||
static const unsigned SVEBitsPerBlock = 128;
|
||||
|
||||
static const unsigned SVEMaxBitsPerVector = 2048;
|
||||
|
||||
// CS namespace end: AArch64
|
||||
|
||||
// end namespace AArch64
|
||||
// end namespace llvm
|
||||
|
||||
#endif
|
2215
thirdparty/capstone/arch/AArch64/AArch64Disassembler.c
vendored
Normal file
2215
thirdparty/capstone/arch/AArch64/AArch64Disassembler.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
24
thirdparty/capstone/arch/AArch64/AArch64DisassemblerExtension.c
vendored
Normal file
24
thirdparty/capstone/arch/AArch64/AArch64DisassemblerExtension.c
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
/* Rot127 <unisono@quyllur.org>, 2022-2023 */
|
||||
|
||||
#include "AArch64DisassemblerExtension.h"
|
||||
#include "AArch64BaseInfo.h"
|
||||
|
||||
bool AArch64_getFeatureBits(unsigned int mode, unsigned int feature)
|
||||
{
|
||||
// we support everything
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Tests a NULL terminated array of features if they are enabled.
|
||||
bool AArch64_testFeatureList(unsigned int mode, const unsigned int *features)
|
||||
{
|
||||
int i = 0;
|
||||
while (features[i]) {
|
||||
if (!AArch64_getFeatureBits(mode, features[i]))
|
||||
return false;
|
||||
++i;
|
||||
}
|
||||
return true;
|
||||
}
|
19
thirdparty/capstone/arch/AArch64/AArch64DisassemblerExtension.h
vendored
Normal file
19
thirdparty/capstone/arch/AArch64/AArch64DisassemblerExtension.h
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
/* Rot127 <unisono@quyllur.org>, 2022-2023 */
|
||||
|
||||
#ifndef CS_AARCH64_DISASSEMBLER_EXTENSION_H
|
||||
#define CS_AARCH64_DISASSEMBLER_EXTENSION_H
|
||||
|
||||
#include "../../MCDisassembler.h"
|
||||
#include "../../MCRegisterInfo.h"
|
||||
#include "../../MathExtras.h"
|
||||
#include "../../cs_priv.h"
|
||||
#include "AArch64AddressingModes.h"
|
||||
#include "capstone/aarch64.h"
|
||||
#include "capstone/capstone.h"
|
||||
|
||||
bool AArch64_getFeatureBits(unsigned int mode, unsigned int feature);
|
||||
bool AArch64_testFeatureList(unsigned int mode, const unsigned int *features);
|
||||
|
||||
#endif // CS_AARCH64_DISASSEMBLER_EXTENSION_H
|
34788
thirdparty/capstone/arch/AArch64/AArch64GenAsmWriter.inc
vendored
Normal file
34788
thirdparty/capstone/arch/AArch64/AArch64GenAsmWriter.inc
vendored
Normal file
File diff suppressed because it is too large
Load Diff
375
thirdparty/capstone/arch/AArch64/AArch64GenCSAliasMnemMap.inc
vendored
Normal file
375
thirdparty/capstone/arch/AArch64/AArch64GenCSAliasMnemMap.inc
vendored
Normal file
@@ -0,0 +1,375 @@
|
||||
/* Capstone Disassembly Engine, https://www.capstone-engine.org */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */
|
||||
/* Rot127 <unisono@quyllur.org> 2022-2024 */
|
||||
/* Automatically generated file by Capstone's LLVM TableGen Disassembler Backend. */
|
||||
|
||||
/* LLVM-commit: <commit> */
|
||||
/* LLVM-tag: <tag> */
|
||||
|
||||
/* Do not edit. */
|
||||
|
||||
/* Capstone's LLVM TableGen Backends: */
|
||||
/* https://github.com/capstone-engine/llvm-capstone */
|
||||
|
||||
{ AARCH64_INS_ALIAS_ADDPT, "addpt" },
|
||||
{ AARCH64_INS_ALIAS_GCSB, "gcsb" },
|
||||
{ AARCH64_INS_ALIAS_GCSPOPM, "gcspopm" },
|
||||
{ AARCH64_INS_ALIAS_LDAPUR, "ldapur" },
|
||||
{ AARCH64_INS_ALIAS_STLLRB, "stllrb" },
|
||||
{ AARCH64_INS_ALIAS_STLLRH, "stllrh" },
|
||||
{ AARCH64_INS_ALIAS_STLLR, "stllr" },
|
||||
{ AARCH64_INS_ALIAS_STLRB, "stlrb" },
|
||||
{ AARCH64_INS_ALIAS_STLRH, "stlrh" },
|
||||
{ AARCH64_INS_ALIAS_STLR, "stlr" },
|
||||
{ AARCH64_INS_ALIAS_STLUR, "stlur" },
|
||||
{ AARCH64_INS_ALIAS_SUBPT, "subpt" },
|
||||
{ AARCH64_INS_ALIAS_LDRAA, "ldraa" },
|
||||
{ AARCH64_INS_ALIAS_ADD, "add" },
|
||||
{ AARCH64_INS_ALIAS_CMN, "cmn" },
|
||||
{ AARCH64_INS_ALIAS_ADDS, "adds" },
|
||||
{ AARCH64_INS_ALIAS_AND, "and" },
|
||||
{ AARCH64_INS_ALIAS_ANDS, "ands" },
|
||||
{ AARCH64_INS_ALIAS_LDR, "ldr" },
|
||||
{ AARCH64_INS_ALIAS_STR, "str" },
|
||||
{ AARCH64_INS_ALIAS_LDRB, "ldrb" },
|
||||
{ AARCH64_INS_ALIAS_STRB, "strb" },
|
||||
{ AARCH64_INS_ALIAS_LDRH, "ldrh" },
|
||||
{ AARCH64_INS_ALIAS_STRH, "strh" },
|
||||
{ AARCH64_INS_ALIAS_PRFM, "prfm" },
|
||||
{ AARCH64_INS_ALIAS_LDAPURB, "ldapurb" },
|
||||
{ AARCH64_INS_ALIAS_STLURB, "stlurb" },
|
||||
{ AARCH64_INS_ALIAS_LDUR, "ldur" },
|
||||
{ AARCH64_INS_ALIAS_STUR, "stur" },
|
||||
{ AARCH64_INS_ALIAS_PRFUM, "prfum" },
|
||||
{ AARCH64_INS_ALIAS_LDTR, "ldtr" },
|
||||
{ AARCH64_INS_ALIAS_STTR, "sttr" },
|
||||
{ AARCH64_INS_ALIAS_LDP, "ldp" },
|
||||
{ AARCH64_INS_ALIAS_STGP, "stgp" },
|
||||
{ AARCH64_INS_ALIAS_LDNP, "ldnp" },
|
||||
{ AARCH64_INS_ALIAS_STNP, "stnp" },
|
||||
{ AARCH64_INS_ALIAS_STG, "stg" },
|
||||
{ AARCH64_INS_ALIAS_MOV, "mov" },
|
||||
{ AARCH64_INS_ALIAS_LD1, "ld1" },
|
||||
{ AARCH64_INS_ALIAS_LD1R, "ld1r" },
|
||||
{ AARCH64_INS_ALIAS_STADDLB, "staddlb" },
|
||||
{ AARCH64_INS_ALIAS_STADDLH, "staddlh" },
|
||||
{ AARCH64_INS_ALIAS_STADDL, "staddl" },
|
||||
{ AARCH64_INS_ALIAS_STADDB, "staddb" },
|
||||
{ AARCH64_INS_ALIAS_STADDH, "staddh" },
|
||||
{ AARCH64_INS_ALIAS_STADD, "stadd" },
|
||||
{ AARCH64_INS_ALIAS_PTRUE, "ptrue" },
|
||||
{ AARCH64_INS_ALIAS_PTRUES, "ptrues" },
|
||||
{ AARCH64_INS_ALIAS_CNTB, "cntb" },
|
||||
{ AARCH64_INS_ALIAS_SQINCH, "sqinch" },
|
||||
{ AARCH64_INS_ALIAS_INCB, "incb" },
|
||||
{ AARCH64_INS_ALIAS_SQINCB, "sqincb" },
|
||||
{ AARCH64_INS_ALIAS_UQINCB, "uqincb" },
|
||||
{ AARCH64_INS_ALIAS_ORR, "orr" },
|
||||
{ AARCH64_INS_ALIAS_DUPM, "dupm" },
|
||||
{ AARCH64_INS_ALIAS_FMOV, "fmov" },
|
||||
{ AARCH64_INS_ALIAS_EOR3, "eor3" },
|
||||
{ AARCH64_INS_ALIAS_ST1B, "st1b" },
|
||||
{ AARCH64_INS_ALIAS_ST2B, "st2b" },
|
||||
{ AARCH64_INS_ALIAS_ST2Q, "st2q" },
|
||||
{ AARCH64_INS_ALIAS_STNT1B, "stnt1b" },
|
||||
{ AARCH64_INS_ALIAS_LD1B, "ld1b" },
|
||||
{ AARCH64_INS_ALIAS_LDNT1B, "ldnt1b" },
|
||||
{ AARCH64_INS_ALIAS_LD1RQB, "ld1rqb" },
|
||||
{ AARCH64_INS_ALIAS_LD1RB, "ld1rb" },
|
||||
{ AARCH64_INS_ALIAS_LDFF1B, "ldff1b" },
|
||||
{ AARCH64_INS_ALIAS_LDNF1B, "ldnf1b" },
|
||||
{ AARCH64_INS_ALIAS_LD2B, "ld2b" },
|
||||
{ AARCH64_INS_ALIAS_LD1SB, "ld1sb" },
|
||||
{ AARCH64_INS_ALIAS_PRFB, "prfb" },
|
||||
{ AARCH64_INS_ALIAS_LDNT1SB, "ldnt1sb" },
|
||||
{ AARCH64_INS_ALIAS_LD1ROB, "ld1rob" },
|
||||
{ AARCH64_INS_ALIAS_LD1Q, "ld1q" },
|
||||
{ AARCH64_INS_ALIAS_ST1Q, "st1q" },
|
||||
{ AARCH64_INS_ALIAS_LD1W, "ld1w" },
|
||||
{ AARCH64_INS_ALIAS_PMOV, "pmov" },
|
||||
{ AARCH64_INS_ALIAS_SMSTART, "smstart" },
|
||||
{ AARCH64_INS_ALIAS_SMSTOP, "smstop" },
|
||||
{ AARCH64_INS_ALIAS_ZERO, "zero" },
|
||||
{ AARCH64_INS_ALIAS_MOVT, "movt" },
|
||||
{ AARCH64_INS_ALIAS_NOP, "nop" },
|
||||
{ AARCH64_INS_ALIAS_YIELD, "yield" },
|
||||
{ AARCH64_INS_ALIAS_WFE, "wfe" },
|
||||
{ AARCH64_INS_ALIAS_WFI, "wfi" },
|
||||
{ AARCH64_INS_ALIAS_SEV, "sev" },
|
||||
{ AARCH64_INS_ALIAS_SEVL, "sevl" },
|
||||
{ AARCH64_INS_ALIAS_DGH, "dgh" },
|
||||
{ AARCH64_INS_ALIAS_ESB, "esb" },
|
||||
{ AARCH64_INS_ALIAS_CSDB, "csdb" },
|
||||
{ AARCH64_INS_ALIAS_BTI, "bti" },
|
||||
{ AARCH64_INS_ALIAS_PSB, "psb" },
|
||||
{ AARCH64_INS_ALIAS_CHKFEAT, "chkfeat" },
|
||||
{ AARCH64_INS_ALIAS_PACIAZ, "paciaz" },
|
||||
{ AARCH64_INS_ALIAS_PACIBZ, "pacibz" },
|
||||
{ AARCH64_INS_ALIAS_AUTIAZ, "autiaz" },
|
||||
{ AARCH64_INS_ALIAS_AUTIBZ, "autibz" },
|
||||
{ AARCH64_INS_ALIAS_PACIASP, "paciasp" },
|
||||
{ AARCH64_INS_ALIAS_PACIBSP, "pacibsp" },
|
||||
{ AARCH64_INS_ALIAS_AUTIASP, "autiasp" },
|
||||
{ AARCH64_INS_ALIAS_AUTIBSP, "autibsp" },
|
||||
{ AARCH64_INS_ALIAS_PACIA1716, "pacia1716" },
|
||||
{ AARCH64_INS_ALIAS_PACIB1716, "pacib1716" },
|
||||
{ AARCH64_INS_ALIAS_AUTIA1716, "autia1716" },
|
||||
{ AARCH64_INS_ALIAS_AUTIB1716, "autib1716" },
|
||||
{ AARCH64_INS_ALIAS_XPACLRI, "xpaclri" },
|
||||
{ AARCH64_INS_ALIAS_LDRAB, "ldrab" },
|
||||
{ AARCH64_INS_ALIAS_PACM, "pacm" },
|
||||
{ AARCH64_INS_ALIAS_CLREX, "clrex" },
|
||||
{ AARCH64_INS_ALIAS_ISB, "isb" },
|
||||
{ AARCH64_INS_ALIAS_SSBB, "ssbb" },
|
||||
{ AARCH64_INS_ALIAS_PSSBB, "pssbb" },
|
||||
{ AARCH64_INS_ALIAS_DFB, "dfb" },
|
||||
{ AARCH64_INS_ALIAS_SYS, "sys" },
|
||||
{ AARCH64_INS_ALIAS_MOVN, "movn" },
|
||||
{ AARCH64_INS_ALIAS_MOVZ, "movz" },
|
||||
{ AARCH64_INS_ALIAS_NGC, "ngc" },
|
||||
{ AARCH64_INS_ALIAS_NGCS, "ngcs" },
|
||||
{ AARCH64_INS_ALIAS_SUB, "sub" },
|
||||
{ AARCH64_INS_ALIAS_CMP, "cmp" },
|
||||
{ AARCH64_INS_ALIAS_SUBS, "subs" },
|
||||
{ AARCH64_INS_ALIAS_NEG, "neg" },
|
||||
{ AARCH64_INS_ALIAS_NEGS, "negs" },
|
||||
{ AARCH64_INS_ALIAS_MUL, "mul" },
|
||||
{ AARCH64_INS_ALIAS_MNEG, "mneg" },
|
||||
{ AARCH64_INS_ALIAS_SMULL, "smull" },
|
||||
{ AARCH64_INS_ALIAS_SMNEGL, "smnegl" },
|
||||
{ AARCH64_INS_ALIAS_UMULL, "umull" },
|
||||
{ AARCH64_INS_ALIAS_UMNEGL, "umnegl" },
|
||||
{ AARCH64_INS_ALIAS_STCLRLB, "stclrlb" },
|
||||
{ AARCH64_INS_ALIAS_STCLRLH, "stclrlh" },
|
||||
{ AARCH64_INS_ALIAS_STCLRL, "stclrl" },
|
||||
{ AARCH64_INS_ALIAS_STCLRB, "stclrb" },
|
||||
{ AARCH64_INS_ALIAS_STCLRH, "stclrh" },
|
||||
{ AARCH64_INS_ALIAS_STCLR, "stclr" },
|
||||
{ AARCH64_INS_ALIAS_STEORLB, "steorlb" },
|
||||
{ AARCH64_INS_ALIAS_STEORLH, "steorlh" },
|
||||
{ AARCH64_INS_ALIAS_STEORL, "steorl" },
|
||||
{ AARCH64_INS_ALIAS_STEORB, "steorb" },
|
||||
{ AARCH64_INS_ALIAS_STEORH, "steorh" },
|
||||
{ AARCH64_INS_ALIAS_STEOR, "steor" },
|
||||
{ AARCH64_INS_ALIAS_STSETLB, "stsetlb" },
|
||||
{ AARCH64_INS_ALIAS_STSETLH, "stsetlh" },
|
||||
{ AARCH64_INS_ALIAS_STSETL, "stsetl" },
|
||||
{ AARCH64_INS_ALIAS_STSETB, "stsetb" },
|
||||
{ AARCH64_INS_ALIAS_STSETH, "stseth" },
|
||||
{ AARCH64_INS_ALIAS_STSET, "stset" },
|
||||
{ AARCH64_INS_ALIAS_STSMAXLB, "stsmaxlb" },
|
||||
{ AARCH64_INS_ALIAS_STSMAXLH, "stsmaxlh" },
|
||||
{ AARCH64_INS_ALIAS_STSMAXL, "stsmaxl" },
|
||||
{ AARCH64_INS_ALIAS_STSMAXB, "stsmaxb" },
|
||||
{ AARCH64_INS_ALIAS_STSMAXH, "stsmaxh" },
|
||||
{ AARCH64_INS_ALIAS_STSMAX, "stsmax" },
|
||||
{ AARCH64_INS_ALIAS_STSMINLB, "stsminlb" },
|
||||
{ AARCH64_INS_ALIAS_STSMINLH, "stsminlh" },
|
||||
{ AARCH64_INS_ALIAS_STSMINL, "stsminl" },
|
||||
{ AARCH64_INS_ALIAS_STSMINB, "stsminb" },
|
||||
{ AARCH64_INS_ALIAS_STSMINH, "stsminh" },
|
||||
{ AARCH64_INS_ALIAS_STSMIN, "stsmin" },
|
||||
{ AARCH64_INS_ALIAS_STUMAXLB, "stumaxlb" },
|
||||
{ AARCH64_INS_ALIAS_STUMAXLH, "stumaxlh" },
|
||||
{ AARCH64_INS_ALIAS_STUMAXL, "stumaxl" },
|
||||
{ AARCH64_INS_ALIAS_STUMAXB, "stumaxb" },
|
||||
{ AARCH64_INS_ALIAS_STUMAXH, "stumaxh" },
|
||||
{ AARCH64_INS_ALIAS_STUMAX, "stumax" },
|
||||
{ AARCH64_INS_ALIAS_STUMINLB, "stuminlb" },
|
||||
{ AARCH64_INS_ALIAS_STUMINLH, "stuminlh" },
|
||||
{ AARCH64_INS_ALIAS_STUMINL, "stuminl" },
|
||||
{ AARCH64_INS_ALIAS_STUMINB, "stuminb" },
|
||||
{ AARCH64_INS_ALIAS_STUMINH, "stuminh" },
|
||||
{ AARCH64_INS_ALIAS_STUMIN, "stumin" },
|
||||
{ AARCH64_INS_ALIAS_IRG, "irg" },
|
||||
{ AARCH64_INS_ALIAS_LDG, "ldg" },
|
||||
{ AARCH64_INS_ALIAS_STZG, "stzg" },
|
||||
{ AARCH64_INS_ALIAS_ST2G, "st2g" },
|
||||
{ AARCH64_INS_ALIAS_STZ2G, "stz2g" },
|
||||
{ AARCH64_INS_ALIAS_BICS, "bics" },
|
||||
{ AARCH64_INS_ALIAS_BIC, "bic" },
|
||||
{ AARCH64_INS_ALIAS_EON, "eon" },
|
||||
{ AARCH64_INS_ALIAS_EOR, "eor" },
|
||||
{ AARCH64_INS_ALIAS_ORN, "orn" },
|
||||
{ AARCH64_INS_ALIAS_MVN, "mvn" },
|
||||
{ AARCH64_INS_ALIAS_TST, "tst" },
|
||||
{ AARCH64_INS_ALIAS_ROR, "ror" },
|
||||
{ AARCH64_INS_ALIAS_ASR, "asr" },
|
||||
{ AARCH64_INS_ALIAS_SXTB, "sxtb" },
|
||||
{ AARCH64_INS_ALIAS_SXTH, "sxth" },
|
||||
{ AARCH64_INS_ALIAS_SXTW, "sxtw" },
|
||||
{ AARCH64_INS_ALIAS_LSR, "lsr" },
|
||||
{ AARCH64_INS_ALIAS_UXTB, "uxtb" },
|
||||
{ AARCH64_INS_ALIAS_UXTH, "uxth" },
|
||||
{ AARCH64_INS_ALIAS_UXTW, "uxtw" },
|
||||
{ AARCH64_INS_ALIAS_CSET, "cset" },
|
||||
{ AARCH64_INS_ALIAS_CSETM, "csetm" },
|
||||
{ AARCH64_INS_ALIAS_CINC, "cinc" },
|
||||
{ AARCH64_INS_ALIAS_CINV, "cinv" },
|
||||
{ AARCH64_INS_ALIAS_CNEG, "cneg" },
|
||||
{ AARCH64_INS_ALIAS_RET, "ret" },
|
||||
{ AARCH64_INS_ALIAS_DCPS1, "dcps1" },
|
||||
{ AARCH64_INS_ALIAS_DCPS2, "dcps2" },
|
||||
{ AARCH64_INS_ALIAS_DCPS3, "dcps3" },
|
||||
{ AARCH64_INS_ALIAS_LDPSW, "ldpsw" },
|
||||
{ AARCH64_INS_ALIAS_LDRSH, "ldrsh" },
|
||||
{ AARCH64_INS_ALIAS_LDRSB, "ldrsb" },
|
||||
{ AARCH64_INS_ALIAS_LDRSW, "ldrsw" },
|
||||
{ AARCH64_INS_ALIAS_LDURH, "ldurh" },
|
||||
{ AARCH64_INS_ALIAS_LDURB, "ldurb" },
|
||||
{ AARCH64_INS_ALIAS_LDURSH, "ldursh" },
|
||||
{ AARCH64_INS_ALIAS_LDURSB, "ldursb" },
|
||||
{ AARCH64_INS_ALIAS_LDURSW, "ldursw" },
|
||||
{ AARCH64_INS_ALIAS_LDTRH, "ldtrh" },
|
||||
{ AARCH64_INS_ALIAS_LDTRB, "ldtrb" },
|
||||
{ AARCH64_INS_ALIAS_LDTRSH, "ldtrsh" },
|
||||
{ AARCH64_INS_ALIAS_LDTRSB, "ldtrsb" },
|
||||
{ AARCH64_INS_ALIAS_LDTRSW, "ldtrsw" },
|
||||
{ AARCH64_INS_ALIAS_STP, "stp" },
|
||||
{ AARCH64_INS_ALIAS_STURH, "sturh" },
|
||||
{ AARCH64_INS_ALIAS_STURB, "sturb" },
|
||||
{ AARCH64_INS_ALIAS_STLURH, "stlurh" },
|
||||
{ AARCH64_INS_ALIAS_LDAPURSB, "ldapursb" },
|
||||
{ AARCH64_INS_ALIAS_LDAPURH, "ldapurh" },
|
||||
{ AARCH64_INS_ALIAS_LDAPURSH, "ldapursh" },
|
||||
{ AARCH64_INS_ALIAS_LDAPURSW, "ldapursw" },
|
||||
{ AARCH64_INS_ALIAS_STTRH, "sttrh" },
|
||||
{ AARCH64_INS_ALIAS_STTRB, "sttrb" },
|
||||
{ AARCH64_INS_ALIAS_BIC_4H, "bic_4h" },
|
||||
{ AARCH64_INS_ALIAS_BIC_8H, "bic_8h" },
|
||||
{ AARCH64_INS_ALIAS_BIC_2S, "bic_2s" },
|
||||
{ AARCH64_INS_ALIAS_BIC_4S, "bic_4s" },
|
||||
{ AARCH64_INS_ALIAS_ORR_4H, "orr_4h" },
|
||||
{ AARCH64_INS_ALIAS_ORR_8H, "orr_8h" },
|
||||
{ AARCH64_INS_ALIAS_ORR_2S, "orr_2s" },
|
||||
{ AARCH64_INS_ALIAS_ORR_4S, "orr_4s" },
|
||||
{ AARCH64_INS_ALIAS_SXTL_8H, "sxtl_8h" },
|
||||
{ AARCH64_INS_ALIAS_SXTL, "sxtl" },
|
||||
{ AARCH64_INS_ALIAS_SXTL_4S, "sxtl_4s" },
|
||||
{ AARCH64_INS_ALIAS_SXTL_2D, "sxtl_2d" },
|
||||
{ AARCH64_INS_ALIAS_SXTL2_8H, "sxtl2_8h" },
|
||||
{ AARCH64_INS_ALIAS_SXTL2, "sxtl2" },
|
||||
{ AARCH64_INS_ALIAS_SXTL2_4S, "sxtl2_4s" },
|
||||
{ AARCH64_INS_ALIAS_SXTL2_2D, "sxtl2_2d" },
|
||||
{ AARCH64_INS_ALIAS_UXTL_8H, "uxtl_8h" },
|
||||
{ AARCH64_INS_ALIAS_UXTL, "uxtl" },
|
||||
{ AARCH64_INS_ALIAS_UXTL_4S, "uxtl_4s" },
|
||||
{ AARCH64_INS_ALIAS_UXTL_2D, "uxtl_2d" },
|
||||
{ AARCH64_INS_ALIAS_UXTL2_8H, "uxtl2_8h" },
|
||||
{ AARCH64_INS_ALIAS_UXTL2, "uxtl2" },
|
||||
{ AARCH64_INS_ALIAS_UXTL2_4S, "uxtl2_4s" },
|
||||
{ AARCH64_INS_ALIAS_UXTL2_2D, "uxtl2_2d" },
|
||||
{ AARCH64_INS_ALIAS_LD2, "ld2" },
|
||||
{ AARCH64_INS_ALIAS_LD3, "ld3" },
|
||||
{ AARCH64_INS_ALIAS_LD4, "ld4" },
|
||||
{ AARCH64_INS_ALIAS_ST1, "st1" },
|
||||
{ AARCH64_INS_ALIAS_ST2, "st2" },
|
||||
{ AARCH64_INS_ALIAS_ST3, "st3" },
|
||||
{ AARCH64_INS_ALIAS_ST4, "st4" },
|
||||
{ AARCH64_INS_ALIAS_LD2R, "ld2r" },
|
||||
{ AARCH64_INS_ALIAS_LD3R, "ld3r" },
|
||||
{ AARCH64_INS_ALIAS_LD4R, "ld4r" },
|
||||
{ AARCH64_INS_ALIAS_CLRBHB, "clrbhb" },
|
||||
{ AARCH64_INS_ALIAS_STILP, "stilp" },
|
||||
{ AARCH64_INS_ALIAS_STL1, "stl1" },
|
||||
{ AARCH64_INS_ALIAS_SYSP, "sysp" },
|
||||
{ AARCH64_INS_ALIAS_LD1SW, "ld1sw" },
|
||||
{ AARCH64_INS_ALIAS_LD1H, "ld1h" },
|
||||
{ AARCH64_INS_ALIAS_LD1SH, "ld1sh" },
|
||||
{ AARCH64_INS_ALIAS_LD1D, "ld1d" },
|
||||
{ AARCH64_INS_ALIAS_LD1RSW, "ld1rsw" },
|
||||
{ AARCH64_INS_ALIAS_LD1RH, "ld1rh" },
|
||||
{ AARCH64_INS_ALIAS_LD1RSH, "ld1rsh" },
|
||||
{ AARCH64_INS_ALIAS_LD1RW, "ld1rw" },
|
||||
{ AARCH64_INS_ALIAS_LD1RSB, "ld1rsb" },
|
||||
{ AARCH64_INS_ALIAS_LD1RD, "ld1rd" },
|
||||
{ AARCH64_INS_ALIAS_LD1RQH, "ld1rqh" },
|
||||
{ AARCH64_INS_ALIAS_LD1RQW, "ld1rqw" },
|
||||
{ AARCH64_INS_ALIAS_LD1RQD, "ld1rqd" },
|
||||
{ AARCH64_INS_ALIAS_LDNF1SW, "ldnf1sw" },
|
||||
{ AARCH64_INS_ALIAS_LDNF1H, "ldnf1h" },
|
||||
{ AARCH64_INS_ALIAS_LDNF1SH, "ldnf1sh" },
|
||||
{ AARCH64_INS_ALIAS_LDNF1W, "ldnf1w" },
|
||||
{ AARCH64_INS_ALIAS_LDNF1SB, "ldnf1sb" },
|
||||
{ AARCH64_INS_ALIAS_LDNF1D, "ldnf1d" },
|
||||
{ AARCH64_INS_ALIAS_LDFF1SW, "ldff1sw" },
|
||||
{ AARCH64_INS_ALIAS_LDFF1H, "ldff1h" },
|
||||
{ AARCH64_INS_ALIAS_LDFF1SH, "ldff1sh" },
|
||||
{ AARCH64_INS_ALIAS_LDFF1W, "ldff1w" },
|
||||
{ AARCH64_INS_ALIAS_LDFF1SB, "ldff1sb" },
|
||||
{ AARCH64_INS_ALIAS_LDFF1D, "ldff1d" },
|
||||
{ AARCH64_INS_ALIAS_LD3B, "ld3b" },
|
||||
{ AARCH64_INS_ALIAS_LD4B, "ld4b" },
|
||||
{ AARCH64_INS_ALIAS_LD2H, "ld2h" },
|
||||
{ AARCH64_INS_ALIAS_LD3H, "ld3h" },
|
||||
{ AARCH64_INS_ALIAS_LD4H, "ld4h" },
|
||||
{ AARCH64_INS_ALIAS_LD2W, "ld2w" },
|
||||
{ AARCH64_INS_ALIAS_LD3W, "ld3w" },
|
||||
{ AARCH64_INS_ALIAS_LD4W, "ld4w" },
|
||||
{ AARCH64_INS_ALIAS_LD2D, "ld2d" },
|
||||
{ AARCH64_INS_ALIAS_LD3D, "ld3d" },
|
||||
{ AARCH64_INS_ALIAS_LD4D, "ld4d" },
|
||||
{ AARCH64_INS_ALIAS_LD2Q, "ld2q" },
|
||||
{ AARCH64_INS_ALIAS_LD3Q, "ld3q" },
|
||||
{ AARCH64_INS_ALIAS_LD4Q, "ld4q" },
|
||||
{ AARCH64_INS_ALIAS_LDNT1H, "ldnt1h" },
|
||||
{ AARCH64_INS_ALIAS_LDNT1W, "ldnt1w" },
|
||||
{ AARCH64_INS_ALIAS_LDNT1D, "ldnt1d" },
|
||||
{ AARCH64_INS_ALIAS_ST1H, "st1h" },
|
||||
{ AARCH64_INS_ALIAS_ST1W, "st1w" },
|
||||
{ AARCH64_INS_ALIAS_ST1D, "st1d" },
|
||||
{ AARCH64_INS_ALIAS_ST3B, "st3b" },
|
||||
{ AARCH64_INS_ALIAS_ST4B, "st4b" },
|
||||
{ AARCH64_INS_ALIAS_ST2H, "st2h" },
|
||||
{ AARCH64_INS_ALIAS_ST3H, "st3h" },
|
||||
{ AARCH64_INS_ALIAS_ST4H, "st4h" },
|
||||
{ AARCH64_INS_ALIAS_ST2W, "st2w" },
|
||||
{ AARCH64_INS_ALIAS_ST3W, "st3w" },
|
||||
{ AARCH64_INS_ALIAS_ST4W, "st4w" },
|
||||
{ AARCH64_INS_ALIAS_ST2D, "st2d" },
|
||||
{ AARCH64_INS_ALIAS_ST3D, "st3d" },
|
||||
{ AARCH64_INS_ALIAS_ST4D, "st4d" },
|
||||
{ AARCH64_INS_ALIAS_ST3Q, "st3q" },
|
||||
{ AARCH64_INS_ALIAS_ST4Q, "st4q" },
|
||||
{ AARCH64_INS_ALIAS_STNT1H, "stnt1h" },
|
||||
{ AARCH64_INS_ALIAS_STNT1W, "stnt1w" },
|
||||
{ AARCH64_INS_ALIAS_STNT1D, "stnt1d" },
|
||||
{ AARCH64_INS_ALIAS_PRFH, "prfh" },
|
||||
{ AARCH64_INS_ALIAS_PRFW, "prfw" },
|
||||
{ AARCH64_INS_ALIAS_PRFD, "prfd" },
|
||||
{ AARCH64_INS_ALIAS_CNTH, "cnth" },
|
||||
{ AARCH64_INS_ALIAS_CNTW, "cntw" },
|
||||
{ AARCH64_INS_ALIAS_CNTD, "cntd" },
|
||||
{ AARCH64_INS_ALIAS_DECB, "decb" },
|
||||
{ AARCH64_INS_ALIAS_INCH, "inch" },
|
||||
{ AARCH64_INS_ALIAS_DECH, "dech" },
|
||||
{ AARCH64_INS_ALIAS_INCW, "incw" },
|
||||
{ AARCH64_INS_ALIAS_DECW, "decw" },
|
||||
{ AARCH64_INS_ALIAS_INCD, "incd" },
|
||||
{ AARCH64_INS_ALIAS_DECD, "decd" },
|
||||
{ AARCH64_INS_ALIAS_SQDECB, "sqdecb" },
|
||||
{ AARCH64_INS_ALIAS_UQDECB, "uqdecb" },
|
||||
{ AARCH64_INS_ALIAS_UQINCH, "uqinch" },
|
||||
{ AARCH64_INS_ALIAS_SQDECH, "sqdech" },
|
||||
{ AARCH64_INS_ALIAS_UQDECH, "uqdech" },
|
||||
{ AARCH64_INS_ALIAS_SQINCW, "sqincw" },
|
||||
{ AARCH64_INS_ALIAS_UQINCW, "uqincw" },
|
||||
{ AARCH64_INS_ALIAS_SQDECW, "sqdecw" },
|
||||
{ AARCH64_INS_ALIAS_UQDECW, "uqdecw" },
|
||||
{ AARCH64_INS_ALIAS_SQINCD, "sqincd" },
|
||||
{ AARCH64_INS_ALIAS_UQINCD, "uqincd" },
|
||||
{ AARCH64_INS_ALIAS_SQDECD, "sqdecd" },
|
||||
{ AARCH64_INS_ALIAS_UQDECD, "uqdecd" },
|
||||
{ AARCH64_INS_ALIAS_MOVS, "movs" },
|
||||
{ AARCH64_INS_ALIAS_NOT, "not" },
|
||||
{ AARCH64_INS_ALIAS_NOTS, "nots" },
|
||||
{ AARCH64_INS_ALIAS_LD1ROH, "ld1roh" },
|
||||
{ AARCH64_INS_ALIAS_LD1ROW, "ld1row" },
|
||||
{ AARCH64_INS_ALIAS_LD1ROD, "ld1rod" },
|
||||
{ AARCH64_INS_ALIAS_BCAX, "bcax" },
|
||||
{ AARCH64_INS_ALIAS_BSL, "bsl" },
|
||||
{ AARCH64_INS_ALIAS_BSL1N, "bsl1n" },
|
||||
{ AARCH64_INS_ALIAS_BSL2N, "bsl2n" },
|
||||
{ AARCH64_INS_ALIAS_NBSL, "nbsl" },
|
||||
{ AARCH64_INS_ALIAS_LDNT1SH, "ldnt1sh" },
|
||||
{ AARCH64_INS_ALIAS_LDNT1SW, "ldnt1sw" },
|
136
thirdparty/capstone/arch/AArch64/AArch64GenCSFeatureName.inc
vendored
Normal file
136
thirdparty/capstone/arch/AArch64/AArch64GenCSFeatureName.inc
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
/* Capstone Disassembly Engine, https://www.capstone-engine.org */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */
|
||||
/* Rot127 <unisono@quyllur.org> 2022-2024 */
|
||||
/* Automatically generated file by Capstone's LLVM TableGen Disassembler Backend. */
|
||||
|
||||
/* LLVM-commit: <commit> */
|
||||
/* LLVM-tag: <tag> */
|
||||
|
||||
/* Do not edit. */
|
||||
|
||||
/* Capstone's LLVM TableGen Backends: */
|
||||
/* https://github.com/capstone-engine/llvm-capstone */
|
||||
|
||||
{ AARCH64_FEATURE_HASV8_0A, "HasV8_0a" },
|
||||
{ AARCH64_FEATURE_HASV8_1A, "HasV8_1a" },
|
||||
{ AARCH64_FEATURE_HASV8_2A, "HasV8_2a" },
|
||||
{ AARCH64_FEATURE_HASV8_3A, "HasV8_3a" },
|
||||
{ AARCH64_FEATURE_HASV8_4A, "HasV8_4a" },
|
||||
{ AARCH64_FEATURE_HASV8_5A, "HasV8_5a" },
|
||||
{ AARCH64_FEATURE_HASV8_6A, "HasV8_6a" },
|
||||
{ AARCH64_FEATURE_HASV8_7A, "HasV8_7a" },
|
||||
{ AARCH64_FEATURE_HASV8_8A, "HasV8_8a" },
|
||||
{ AARCH64_FEATURE_HASV8_9A, "HasV8_9a" },
|
||||
{ AARCH64_FEATURE_HASV9_0A, "HasV9_0a" },
|
||||
{ AARCH64_FEATURE_HASV9_1A, "HasV9_1a" },
|
||||
{ AARCH64_FEATURE_HASV9_2A, "HasV9_2a" },
|
||||
{ AARCH64_FEATURE_HASV9_3A, "HasV9_3a" },
|
||||
{ AARCH64_FEATURE_HASV9_4A, "HasV9_4a" },
|
||||
{ AARCH64_FEATURE_HASV8_0R, "HasV8_0r" },
|
||||
{ AARCH64_FEATURE_HASEL2VMSA, "HasEL2VMSA" },
|
||||
{ AARCH64_FEATURE_HASEL3, "HasEL3" },
|
||||
{ AARCH64_FEATURE_HASVH, "HasVH" },
|
||||
{ AARCH64_FEATURE_HASLOR, "HasLOR" },
|
||||
{ AARCH64_FEATURE_HASPAUTH, "HasPAuth" },
|
||||
{ AARCH64_FEATURE_HASPAUTHLR, "HasPAuthLR" },
|
||||
{ AARCH64_FEATURE_HASJS, "HasJS" },
|
||||
{ AARCH64_FEATURE_HASCCIDX, "HasCCIDX" },
|
||||
{ AARCH64_FEATURE_HASCOMPLXNUM, "HasComplxNum" },
|
||||
{ AARCH64_FEATURE_HASNV, "HasNV" },
|
||||
{ AARCH64_FEATURE_HASMPAM, "HasMPAM" },
|
||||
{ AARCH64_FEATURE_HASDIT, "HasDIT" },
|
||||
{ AARCH64_FEATURE_HASTRACEV8_4, "HasTRACEV8_4" },
|
||||
{ AARCH64_FEATURE_HASAM, "HasAM" },
|
||||
{ AARCH64_FEATURE_HASSEL2, "HasSEL2" },
|
||||
{ AARCH64_FEATURE_HASTLB_RMI, "HasTLB_RMI" },
|
||||
{ AARCH64_FEATURE_HASFLAGM, "HasFlagM" },
|
||||
{ AARCH64_FEATURE_HASRCPC_IMMO, "HasRCPC_IMMO" },
|
||||
{ AARCH64_FEATURE_HASFPARMV8, "HasFPARMv8" },
|
||||
{ AARCH64_FEATURE_HASNEON, "HasNEON" },
|
||||
{ AARCH64_FEATURE_HASSM4, "HasSM4" },
|
||||
{ AARCH64_FEATURE_HASSHA3, "HasSHA3" },
|
||||
{ AARCH64_FEATURE_HASSHA2, "HasSHA2" },
|
||||
{ AARCH64_FEATURE_HASAES, "HasAES" },
|
||||
{ AARCH64_FEATURE_HASDOTPROD, "HasDotProd" },
|
||||
{ AARCH64_FEATURE_HASCRC, "HasCRC" },
|
||||
{ AARCH64_FEATURE_HASCSSC, "HasCSSC" },
|
||||
{ AARCH64_FEATURE_HASLSE, "HasLSE" },
|
||||
{ AARCH64_FEATURE_HASRAS, "HasRAS" },
|
||||
{ AARCH64_FEATURE_HASRDM, "HasRDM" },
|
||||
{ AARCH64_FEATURE_HASFULLFP16, "HasFullFP16" },
|
||||
{ AARCH64_FEATURE_HASFP16FML, "HasFP16FML" },
|
||||
{ AARCH64_FEATURE_HASSPE, "HasSPE" },
|
||||
{ AARCH64_FEATURE_HASFUSEAES, "HasFuseAES" },
|
||||
{ AARCH64_FEATURE_HASSVE, "HasSVE" },
|
||||
{ AARCH64_FEATURE_HASSVE2, "HasSVE2" },
|
||||
{ AARCH64_FEATURE_HASSVE2P1, "HasSVE2p1" },
|
||||
{ AARCH64_FEATURE_HASSVE2AES, "HasSVE2AES" },
|
||||
{ AARCH64_FEATURE_HASSVE2SM4, "HasSVE2SM4" },
|
||||
{ AARCH64_FEATURE_HASSVE2SHA3, "HasSVE2SHA3" },
|
||||
{ AARCH64_FEATURE_HASSVE2BITPERM, "HasSVE2BitPerm" },
|
||||
{ AARCH64_FEATURE_HASB16B16, "HasB16B16" },
|
||||
{ AARCH64_FEATURE_HASSME, "HasSME" },
|
||||
{ AARCH64_FEATURE_HASSMEF64F64, "HasSMEF64F64" },
|
||||
{ AARCH64_FEATURE_HASSMEF16F16, "HasSMEF16F16" },
|
||||
{ AARCH64_FEATURE_HASSMEFA64, "HasSMEFA64" },
|
||||
{ AARCH64_FEATURE_HASSMEI16I64, "HasSMEI16I64" },
|
||||
{ AARCH64_FEATURE_HASSME2, "HasSME2" },
|
||||
{ AARCH64_FEATURE_HASSME2P1, "HasSME2p1" },
|
||||
{ AARCH64_FEATURE_HASFPMR, "HasFPMR" },
|
||||
{ AARCH64_FEATURE_HASFP8, "HasFP8" },
|
||||
{ AARCH64_FEATURE_HASFAMINMAX, "HasFAMINMAX" },
|
||||
{ AARCH64_FEATURE_HASFP8FMA, "HasFP8FMA" },
|
||||
{ AARCH64_FEATURE_HASSSVE_FP8FMA, "HasSSVE_FP8FMA" },
|
||||
{ AARCH64_FEATURE_HASFP8DOT2, "HasFP8DOT2" },
|
||||
{ AARCH64_FEATURE_HASSSVE_FP8DOT2, "HasSSVE_FP8DOT2" },
|
||||
{ AARCH64_FEATURE_HASFP8DOT4, "HasFP8DOT4" },
|
||||
{ AARCH64_FEATURE_HASSSVE_FP8DOT4, "HasSSVE_FP8DOT4" },
|
||||
{ AARCH64_FEATURE_HASLUT, "HasLUT" },
|
||||
{ AARCH64_FEATURE_HASSME_LUTV2, "HasSME_LUTv2" },
|
||||
{ AARCH64_FEATURE_HASSMEF8F16, "HasSMEF8F16" },
|
||||
{ AARCH64_FEATURE_HASSMEF8F32, "HasSMEF8F32" },
|
||||
{ AARCH64_FEATURE_HASSVEORSME, "HasSVEorSME" },
|
||||
{ AARCH64_FEATURE_HASSVE2ORSME, "HasSVE2orSME" },
|
||||
{ AARCH64_FEATURE_HASSVE2ORSME2, "HasSVE2orSME2" },
|
||||
{ AARCH64_FEATURE_HASSVE2P1_OR_HASSME, "HasSVE2p1_or_HasSME" },
|
||||
{ AARCH64_FEATURE_HASSVE2P1_OR_HASSME2, "HasSVE2p1_or_HasSME2" },
|
||||
{ AARCH64_FEATURE_HASSVE2P1_OR_HASSME2P1, "HasSVE2p1_or_HasSME2p1" },
|
||||
{ AARCH64_FEATURE_HASNEONORSME, "HasNEONorSME" },
|
||||
{ AARCH64_FEATURE_HASRCPC, "HasRCPC" },
|
||||
{ AARCH64_FEATURE_HASALTNZCV, "HasAltNZCV" },
|
||||
{ AARCH64_FEATURE_HASFRINT3264, "HasFRInt3264" },
|
||||
{ AARCH64_FEATURE_HASSB, "HasSB" },
|
||||
{ AARCH64_FEATURE_HASPREDRES, "HasPredRes" },
|
||||
{ AARCH64_FEATURE_HASCCDP, "HasCCDP" },
|
||||
{ AARCH64_FEATURE_HASBTI, "HasBTI" },
|
||||
{ AARCH64_FEATURE_HASMTE, "HasMTE" },
|
||||
{ AARCH64_FEATURE_HASTME, "HasTME" },
|
||||
{ AARCH64_FEATURE_HASETE, "HasETE" },
|
||||
{ AARCH64_FEATURE_HASTRBE, "HasTRBE" },
|
||||
{ AARCH64_FEATURE_HASBF16, "HasBF16" },
|
||||
{ AARCH64_FEATURE_HASMATMULINT8, "HasMatMulInt8" },
|
||||
{ AARCH64_FEATURE_HASMATMULFP32, "HasMatMulFP32" },
|
||||
{ AARCH64_FEATURE_HASMATMULFP64, "HasMatMulFP64" },
|
||||
{ AARCH64_FEATURE_HASXS, "HasXS" },
|
||||
{ AARCH64_FEATURE_HASWFXT, "HasWFxT" },
|
||||
{ AARCH64_FEATURE_HASLS64, "HasLS64" },
|
||||
{ AARCH64_FEATURE_HASBRBE, "HasBRBE" },
|
||||
{ AARCH64_FEATURE_HASSPE_EEF, "HasSPE_EEF" },
|
||||
{ AARCH64_FEATURE_HASHBC, "HasHBC" },
|
||||
{ AARCH64_FEATURE_HASMOPS, "HasMOPS" },
|
||||
{ AARCH64_FEATURE_HASCLRBHB, "HasCLRBHB" },
|
||||
{ AARCH64_FEATURE_HASSPECRES2, "HasSPECRES2" },
|
||||
{ AARCH64_FEATURE_HASITE, "HasITE" },
|
||||
{ AARCH64_FEATURE_HASTHE, "HasTHE" },
|
||||
{ AARCH64_FEATURE_HASRCPC3, "HasRCPC3" },
|
||||
{ AARCH64_FEATURE_HASLSE128, "HasLSE128" },
|
||||
{ AARCH64_FEATURE_HASD128, "HasD128" },
|
||||
{ AARCH64_FEATURE_HASCHK, "HasCHK" },
|
||||
{ AARCH64_FEATURE_HASGCS, "HasGCS" },
|
||||
{ AARCH64_FEATURE_HASCPA, "HasCPA" },
|
||||
{ AARCH64_FEATURE_USENEGATIVEIMMEDIATES, "UseNegativeImmediates" },
|
||||
{ AARCH64_FEATURE_HASCCPP, "HasCCPP" },
|
||||
{ AARCH64_FEATURE_HASPAN, "HasPAN" },
|
||||
{ AARCH64_FEATURE_HASPSUAO, "HasPsUAO" },
|
||||
{ AARCH64_FEATURE_HASPAN_RWV, "HasPAN_RWV" },
|
||||
{ AARCH64_FEATURE_HASCONTEXTIDREL2, "HasCONTEXTIDREL2" },
|
64420
thirdparty/capstone/arch/AArch64/AArch64GenCSMappingInsn.inc
vendored
Normal file
64420
thirdparty/capstone/arch/AArch64/AArch64GenCSMappingInsn.inc
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1403
thirdparty/capstone/arch/AArch64/AArch64GenCSMappingInsnName.inc
vendored
Normal file
1403
thirdparty/capstone/arch/AArch64/AArch64GenCSMappingInsnName.inc
vendored
Normal file
File diff suppressed because it is too large
Load Diff
55596
thirdparty/capstone/arch/AArch64/AArch64GenCSMappingInsnOp.inc
vendored
Normal file
55596
thirdparty/capstone/arch/AArch64/AArch64GenCSMappingInsnOp.inc
vendored
Normal file
File diff suppressed because it is too large
Load Diff
180
thirdparty/capstone/arch/AArch64/AArch64GenCSOpGroup.inc
vendored
Normal file
180
thirdparty/capstone/arch/AArch64/AArch64GenCSOpGroup.inc
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
/* Capstone Disassembly Engine, https://www.capstone-engine.org */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */
|
||||
/* Rot127 <unisono@quyllur.org> 2022-2024 */
|
||||
/* Automatically generated file by Capstone's LLVM TableGen Disassembler Backend. */
|
||||
|
||||
/* LLVM-commit: <commit> */
|
||||
/* LLVM-tag: <tag> */
|
||||
|
||||
/* Do not edit. */
|
||||
|
||||
/* Capstone's LLVM TableGen Backends: */
|
||||
/* https://github.com/capstone-engine/llvm-capstone */
|
||||
|
||||
AArch64_OP_GROUP_AMNoIndex = 0,
|
||||
AArch64_OP_GROUP_AdrLabel = 1,
|
||||
AArch64_OP_GROUP_AdrpLabel = 2,
|
||||
AArch64_OP_GROUP_BTIHintOp = 3,
|
||||
AArch64_OP_GROUP_ImplicitlyTypedVectorList = 4,
|
||||
AArch64_OP_GROUP_InverseCondCode = 5,
|
||||
AArch64_OP_GROUP_LogicalImm_int16_t = 6,
|
||||
AArch64_OP_GROUP_LogicalImm_int8_t = 7,
|
||||
AArch64_OP_GROUP_MatrixIndex_0 = 8,
|
||||
AArch64_OP_GROUP_MatrixIndex_1 = 9,
|
||||
AArch64_OP_GROUP_MatrixIndex_8 = 10,
|
||||
AArch64_OP_GROUP_PSBHintOp = 11,
|
||||
AArch64_OP_GROUP_PrefetchOp_1 = 12,
|
||||
AArch64_OP_GROUP_SVELogicalImm_int16_t = 13,
|
||||
AArch64_OP_GROUP_SVELogicalImm_int32_t = 14,
|
||||
AArch64_OP_GROUP_SVELogicalImm_int64_t = 15,
|
||||
AArch64_OP_GROUP_SVERegOp_0 = 16,
|
||||
AArch64_OP_GROUP_VectorIndex_8 = 17,
|
||||
AArch64_OP_GROUP_ZPRasFPR_128 = 18,
|
||||
AArch64_OP_GROUP_Operand = 19,
|
||||
AArch64_OP_GROUP_SVERegOp_b = 20,
|
||||
AArch64_OP_GROUP_SVERegOp_d = 21,
|
||||
AArch64_OP_GROUP_SVERegOp_h = 22,
|
||||
AArch64_OP_GROUP_SVERegOp_s = 23,
|
||||
AArch64_OP_GROUP_TypedVectorList_0_d = 24,
|
||||
AArch64_OP_GROUP_TypedVectorList_0_s = 25,
|
||||
AArch64_OP_GROUP_VRegOperand = 26,
|
||||
AArch64_OP_GROUP_TypedVectorList_0_h = 27,
|
||||
AArch64_OP_GROUP_VectorIndex_1 = 28,
|
||||
AArch64_OP_GROUP_ImmRangeScale_2_1 = 29,
|
||||
AArch64_OP_GROUP_AlignedLabel = 30,
|
||||
AArch64_OP_GROUP_CondCode = 31,
|
||||
AArch64_OP_GROUP_ExactFPImm_AArch64ExactFPImm_half_AArch64ExactFPImm_one = 32,
|
||||
AArch64_OP_GROUP_TypedVectorList_0_b = 33,
|
||||
AArch64_OP_GROUP_ExactFPImm_AArch64ExactFPImm_zero_AArch64ExactFPImm_one = 34,
|
||||
AArch64_OP_GROUP_ImmRangeScale_4_3 = 35,
|
||||
AArch64_OP_GROUP_ExactFPImm_AArch64ExactFPImm_half_AArch64ExactFPImm_two = 36,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_8_x_d = 37,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_1_8_w_d = 38,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_8_w_d = 39,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_1_8_w_s = 40,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_8_w_s = 41,
|
||||
AArch64_OP_GROUP_ImmScale_8 = 42,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_64_x_d = 43,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_1_64_w_d = 44,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_64_w_d = 45,
|
||||
AArch64_OP_GROUP_ImmScale_2 = 46,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_16_x_d = 47,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_1_16_w_d = 48,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_16_w_d = 49,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_1_16_w_s = 50,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_16_w_s = 51,
|
||||
AArch64_OP_GROUP_ImmScale_4 = 52,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_32_x_d = 53,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_1_32_w_d = 54,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_32_w_d = 55,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_1_32_w_s = 56,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_32_w_s = 57,
|
||||
AArch64_OP_GROUP_PredicateAsCounter_0 = 58,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_8_x_0 = 59,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_64_x_0 = 60,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_16_x_0 = 61,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_32_x_0 = 62,
|
||||
AArch64_OP_GROUP_SVCROp = 63,
|
||||
AArch64_OP_GROUP_ImmScale_16 = 64,
|
||||
AArch64_OP_GROUP_MatrixTile = 65,
|
||||
AArch64_OP_GROUP_Shifter = 66,
|
||||
AArch64_OP_GROUP_AddSubImm = 67,
|
||||
AArch64_OP_GROUP_ShiftedRegister = 68,
|
||||
AArch64_OP_GROUP_ExtendedRegister = 69,
|
||||
AArch64_OP_GROUP_ArithExtend = 70,
|
||||
AArch64_OP_GROUP_Matrix_64 = 71,
|
||||
AArch64_OP_GROUP_Matrix_32 = 72,
|
||||
AArch64_OP_GROUP_Imm8OptLsl_uint8_t = 73,
|
||||
AArch64_OP_GROUP_Imm8OptLsl_uint64_t = 74,
|
||||
AArch64_OP_GROUP_Imm8OptLsl_uint16_t = 75,
|
||||
AArch64_OP_GROUP_Imm8OptLsl_uint32_t = 76,
|
||||
AArch64_OP_GROUP_AdrAdrpLabel = 77,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_8_x_s = 78,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_16_x_s = 79,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_32_x_s = 80,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_64_x_s = 81,
|
||||
AArch64_OP_GROUP_LogicalImm_int32_t = 82,
|
||||
AArch64_OP_GROUP_LogicalImm_int64_t = 83,
|
||||
AArch64_OP_GROUP_ZPRasFPR_8 = 84,
|
||||
AArch64_OP_GROUP_ZPRasFPR_64 = 85,
|
||||
AArch64_OP_GROUP_ZPRasFPR_16 = 86,
|
||||
AArch64_OP_GROUP_ZPRasFPR_32 = 87,
|
||||
AArch64_OP_GROUP_Matrix_16 = 88,
|
||||
AArch64_OP_GROUP_Imm = 89,
|
||||
AArch64_OP_GROUP_ImmHex = 90,
|
||||
AArch64_OP_GROUP_ComplexRotationOp_180_90 = 91,
|
||||
AArch64_OP_GROUP_GPRSeqPairsClassOperand_32 = 92,
|
||||
AArch64_OP_GROUP_GPRSeqPairsClassOperand_64 = 93,
|
||||
AArch64_OP_GROUP_ComplexRotationOp_90_0 = 94,
|
||||
AArch64_OP_GROUP_SVEPattern = 95,
|
||||
AArch64_OP_GROUP_PredicateAsCounter_8 = 96,
|
||||
AArch64_OP_GROUP_SVEVecLenSpecifier = 97,
|
||||
AArch64_OP_GROUP_PredicateAsCounter_64 = 98,
|
||||
AArch64_OP_GROUP_PredicateAsCounter_16 = 99,
|
||||
AArch64_OP_GROUP_PredicateAsCounter_32 = 100,
|
||||
AArch64_OP_GROUP_Imm8OptLsl_int8_t = 101,
|
||||
AArch64_OP_GROUP_Imm8OptLsl_int64_t = 102,
|
||||
AArch64_OP_GROUP_Imm8OptLsl_int16_t = 103,
|
||||
AArch64_OP_GROUP_Imm8OptLsl_int32_t = 104,
|
||||
AArch64_OP_GROUP_BarrierOption = 105,
|
||||
AArch64_OP_GROUP_BarriernXSOption = 106,
|
||||
AArch64_OP_GROUP_SVERegOp_q = 107,
|
||||
AArch64_OP_GROUP_MatrixTileVector_0 = 108,
|
||||
AArch64_OP_GROUP_MatrixTileVector_1 = 109,
|
||||
AArch64_OP_GROUP_FPImmOperand = 110,
|
||||
AArch64_OP_GROUP_TypedVectorList_0_q = 111,
|
||||
AArch64_OP_GROUP_SImm_8 = 112,
|
||||
AArch64_OP_GROUP_SImm_16 = 113,
|
||||
AArch64_OP_GROUP_TypedVectorList_16_b = 114,
|
||||
AArch64_OP_GROUP_PostIncOperand_64 = 115,
|
||||
AArch64_OP_GROUP_TypedVectorList_1_d = 116,
|
||||
AArch64_OP_GROUP_PostIncOperand_32 = 117,
|
||||
AArch64_OP_GROUP_TypedVectorList_2_d = 118,
|
||||
AArch64_OP_GROUP_TypedVectorList_2_s = 119,
|
||||
AArch64_OP_GROUP_TypedVectorList_4_h = 120,
|
||||
AArch64_OP_GROUP_TypedVectorList_4_s = 121,
|
||||
AArch64_OP_GROUP_TypedVectorList_8_b = 122,
|
||||
AArch64_OP_GROUP_TypedVectorList_8_h = 123,
|
||||
AArch64_OP_GROUP_PostIncOperand_16 = 124,
|
||||
AArch64_OP_GROUP_PostIncOperand_8 = 125,
|
||||
AArch64_OP_GROUP_ImmScale_32 = 126,
|
||||
AArch64_OP_GROUP_PostIncOperand_1 = 127,
|
||||
AArch64_OP_GROUP_PostIncOperand_4 = 128,
|
||||
AArch64_OP_GROUP_PostIncOperand_2 = 129,
|
||||
AArch64_OP_GROUP_PostIncOperand_48 = 130,
|
||||
AArch64_OP_GROUP_PostIncOperand_24 = 131,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_128_x_0 = 132,
|
||||
AArch64_OP_GROUP_ImmScale_3 = 133,
|
||||
AArch64_OP_GROUP_PostIncOperand_3 = 134,
|
||||
AArch64_OP_GROUP_PostIncOperand_12 = 135,
|
||||
AArch64_OP_GROUP_PostIncOperand_6 = 136,
|
||||
AArch64_OP_GROUP_GPR64x8 = 137,
|
||||
AArch64_OP_GROUP_MemExtend_w_8 = 138,
|
||||
AArch64_OP_GROUP_MemExtend_x_8 = 139,
|
||||
AArch64_OP_GROUP_UImm12Offset_1 = 140,
|
||||
AArch64_OP_GROUP_MemExtend_w_64 = 141,
|
||||
AArch64_OP_GROUP_MemExtend_x_64 = 142,
|
||||
AArch64_OP_GROUP_UImm12Offset_8 = 143,
|
||||
AArch64_OP_GROUP_MemExtend_w_16 = 144,
|
||||
AArch64_OP_GROUP_MemExtend_x_16 = 145,
|
||||
AArch64_OP_GROUP_UImm12Offset_2 = 146,
|
||||
AArch64_OP_GROUP_MemExtend_w_128 = 147,
|
||||
AArch64_OP_GROUP_MemExtend_x_128 = 148,
|
||||
AArch64_OP_GROUP_UImm12Offset_16 = 149,
|
||||
AArch64_OP_GROUP_MemExtend_w_32 = 150,
|
||||
AArch64_OP_GROUP_MemExtend_x_32 = 151,
|
||||
AArch64_OP_GROUP_UImm12Offset_4 = 152,
|
||||
AArch64_OP_GROUP_Matrix_0 = 153,
|
||||
AArch64_OP_GROUP_TypedVectorList_0_0 = 154,
|
||||
AArch64_OP_GROUP_SIMDType10Operand = 155,
|
||||
AArch64_OP_GROUP_MRSSystemRegister = 156,
|
||||
AArch64_OP_GROUP_MSRSystemRegister = 157,
|
||||
AArch64_OP_GROUP_SystemPStateField = 158,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_1_64_w_s = 159,
|
||||
AArch64_OP_GROUP_RegWithShiftExtend_0_64_w_s = 160,
|
||||
AArch64_OP_GROUP_PrefetchOp_0 = 161,
|
||||
AArch64_OP_GROUP_RPRFMOperand = 162,
|
||||
AArch64_OP_GROUP_GPR64as32 = 163,
|
||||
AArch64_OP_GROUP_SysCROperand = 164,
|
||||
AArch64_OP_GROUP_SyspXzrPair = 165,
|
||||
AArch64_OP_GROUP_MatrixTileList = 166,
|
35544
thirdparty/capstone/arch/AArch64/AArch64GenDisassemblerTables.inc
vendored
Normal file
35544
thirdparty/capstone/arch/AArch64/AArch64GenDisassemblerTables.inc
vendored
Normal file
File diff suppressed because it is too large
Load Diff
18230
thirdparty/capstone/arch/AArch64/AArch64GenInstrInfo.inc
vendored
Normal file
18230
thirdparty/capstone/arch/AArch64/AArch64GenInstrInfo.inc
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6160
thirdparty/capstone/arch/AArch64/AArch64GenRegisterInfo.inc
vendored
Normal file
6160
thirdparty/capstone/arch/AArch64/AArch64GenRegisterInfo.inc
vendored
Normal file
File diff suppressed because it is too large
Load Diff
714
thirdparty/capstone/arch/AArch64/AArch64GenRegisterName.inc
vendored
Normal file
714
thirdparty/capstone/arch/AArch64/AArch64GenRegisterName.inc
vendored
Normal file
@@ -0,0 +1,714 @@
|
||||
/* Capstone Disassembly Engine, http://www.capstone-engine.org */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
|
||||
/// getRegisterName - This method is automatically generated by tblgen
|
||||
/// from the register set description. This returns the assembler name
|
||||
/// for the specified register.
|
||||
static const char *getRegisterName(unsigned RegNo, unsigned AltIdx)
|
||||
{
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Woverlength-strings"
|
||||
#endif
|
||||
#ifndef CAPSTONE_DIET
|
||||
static const char AsmStrsNoRegAltName[] = {
|
||||
/* 0 */ "D7_D8_D9_D10\0"
|
||||
/* 13 */ "Q7_Q8_Q9_Q10\0"
|
||||
/* 26 */ "Z7_Z8_Z9_Z10\0"
|
||||
/* 39 */ "b10\0"
|
||||
/* 43 */ "d10\0"
|
||||
/* 47 */ "h10\0"
|
||||
/* 51 */ "p10\0"
|
||||
/* 55 */ "q10\0"
|
||||
/* 59 */ "s10\0"
|
||||
/* 63 */ "w10\0"
|
||||
/* 67 */ "x10\0"
|
||||
/* 71 */ "z10\0"
|
||||
/* 75 */ "D17_D18_D19_D20\0"
|
||||
/* 91 */ "Q17_Q18_Q19_Q20\0"
|
||||
/* 107 */ "Z17_Z18_Z19_Z20\0"
|
||||
/* 123 */ "b20\0"
|
||||
/* 127 */ "d20\0"
|
||||
/* 131 */ "h20\0"
|
||||
/* 135 */ "q20\0"
|
||||
/* 139 */ "s20\0"
|
||||
/* 143 */ "w20\0"
|
||||
/* 147 */ "x20\0"
|
||||
/* 151 */ "z20\0"
|
||||
/* 155 */ "D27_D28_D29_D30\0"
|
||||
/* 171 */ "Q27_Q28_Q29_Q30\0"
|
||||
/* 187 */ "Z27_Z28_Z29_Z30\0"
|
||||
/* 203 */ "b30\0"
|
||||
/* 207 */ "d30\0"
|
||||
/* 211 */ "h30\0"
|
||||
/* 215 */ "q30\0"
|
||||
/* 219 */ "s30\0"
|
||||
/* 223 */ "w30\0"
|
||||
/* 227 */ "x30\0"
|
||||
/* 231 */ "z30\0"
|
||||
/* 235 */ "D29_D30_D31_D0\0"
|
||||
/* 250 */ "Q29_Q30_Q31_Q0\0"
|
||||
/* 265 */ "Z29_Z30_Z31_Z0\0"
|
||||
/* 280 */ "b0\0"
|
||||
/* 283 */ "d0\0"
|
||||
/* 286 */ "h0\0"
|
||||
/* 289 */ "p0\0"
|
||||
/* 292 */ "q0\0"
|
||||
/* 295 */ "s0\0"
|
||||
/* 298 */ "w0\0"
|
||||
/* 301 */ "x0\0"
|
||||
/* 304 */ "z0\0"
|
||||
/* 307 */ "D8_D9_D10_D11\0"
|
||||
/* 321 */ "Q8_Q9_Q10_Q11\0"
|
||||
/* 335 */ "W10_W11\0"
|
||||
/* 343 */ "X4_X5_X6_X7_X8_X9_X10_X11\0"
|
||||
/* 369 */ "Z8_Z9_Z10_Z11\0"
|
||||
/* 383 */ "b11\0"
|
||||
/* 387 */ "d11\0"
|
||||
/* 391 */ "h11\0"
|
||||
/* 395 */ "p11\0"
|
||||
/* 399 */ "q11\0"
|
||||
/* 403 */ "s11\0"
|
||||
/* 407 */ "w11\0"
|
||||
/* 411 */ "x11\0"
|
||||
/* 415 */ "z11\0"
|
||||
/* 419 */ "D18_D19_D20_D21\0"
|
||||
/* 435 */ "Q18_Q19_Q20_Q21\0"
|
||||
/* 451 */ "W20_W21\0"
|
||||
/* 459 */ "X14_X15_X16_X17_X18_X19_X20_X21\0"
|
||||
/* 491 */ "Z18_Z19_Z20_Z21\0"
|
||||
/* 507 */ "b21\0"
|
||||
/* 511 */ "d21\0"
|
||||
/* 515 */ "h21\0"
|
||||
/* 519 */ "q21\0"
|
||||
/* 523 */ "s21\0"
|
||||
/* 527 */ "w21\0"
|
||||
/* 531 */ "x21\0"
|
||||
/* 535 */ "z21\0"
|
||||
/* 539 */ "D28_D29_D30_D31\0"
|
||||
/* 555 */ "Q28_Q29_Q30_Q31\0"
|
||||
/* 571 */ "Z28_Z29_Z30_Z31\0"
|
||||
/* 587 */ "b31\0"
|
||||
/* 591 */ "d31\0"
|
||||
/* 595 */ "h31\0"
|
||||
/* 599 */ "q31\0"
|
||||
/* 603 */ "s31\0"
|
||||
/* 607 */ "z31\0"
|
||||
/* 611 */ "D30_D31_D0_D1\0"
|
||||
/* 625 */ "Q30_Q31_Q0_Q1\0"
|
||||
/* 639 */ "W0_W1\0"
|
||||
/* 645 */ "X0_X1\0"
|
||||
/* 651 */ "Z30_Z31_Z0_Z1\0"
|
||||
/* 665 */ "b1\0"
|
||||
/* 668 */ "d1\0"
|
||||
/* 671 */ "h1\0"
|
||||
/* 674 */ "p1\0"
|
||||
/* 677 */ "q1\0"
|
||||
/* 680 */ "s1\0"
|
||||
/* 683 */ "w1\0"
|
||||
/* 686 */ "x1\0"
|
||||
/* 689 */ "z1\0"
|
||||
/* 692 */ "D9_D10_D11_D12\0"
|
||||
/* 707 */ "Q9_Q10_Q11_Q12\0"
|
||||
/* 722 */ "Z9_Z10_Z11_Z12\0"
|
||||
/* 737 */ "b12\0"
|
||||
/* 741 */ "d12\0"
|
||||
/* 745 */ "h12\0"
|
||||
/* 749 */ "p12\0"
|
||||
/* 753 */ "q12\0"
|
||||
/* 757 */ "s12\0"
|
||||
/* 761 */ "w12\0"
|
||||
/* 765 */ "x12\0"
|
||||
/* 769 */ "z12\0"
|
||||
/* 773 */ "D19_D20_D21_D22\0"
|
||||
/* 789 */ "Q19_Q20_Q21_Q22\0"
|
||||
/* 805 */ "Z19_Z20_Z21_Z22\0"
|
||||
/* 821 */ "b22\0"
|
||||
/* 825 */ "d22\0"
|
||||
/* 829 */ "h22\0"
|
||||
/* 833 */ "q22\0"
|
||||
/* 837 */ "s22\0"
|
||||
/* 841 */ "w22\0"
|
||||
/* 845 */ "x22\0"
|
||||
/* 849 */ "z22\0"
|
||||
/* 853 */ "D31_D0_D1_D2\0"
|
||||
/* 866 */ "Q31_Q0_Q1_Q2\0"
|
||||
/* 879 */ "Z31_Z0_Z1_Z2\0"
|
||||
/* 892 */ "b2\0"
|
||||
/* 895 */ "d2\0"
|
||||
/* 898 */ "h2\0"
|
||||
/* 901 */ "p2\0"
|
||||
/* 904 */ "q2\0"
|
||||
/* 907 */ "s2\0"
|
||||
/* 910 */ "w2\0"
|
||||
/* 913 */ "x2\0"
|
||||
/* 916 */ "z2\0"
|
||||
/* 919 */ "D10_D11_D12_D13\0"
|
||||
/* 935 */ "Q10_Q11_Q12_Q13\0"
|
||||
/* 951 */ "W12_W13\0"
|
||||
/* 959 */ "X6_X7_X8_X9_X10_X11_X12_X13\0"
|
||||
/* 987 */ "Z10_Z11_Z12_Z13\0"
|
||||
/* 1003 */ "b13\0"
|
||||
/* 1007 */ "d13\0"
|
||||
/* 1011 */ "h13\0"
|
||||
/* 1015 */ "p13\0"
|
||||
/* 1019 */ "q13\0"
|
||||
/* 1023 */ "s13\0"
|
||||
/* 1027 */ "w13\0"
|
||||
/* 1031 */ "x13\0"
|
||||
/* 1035 */ "z13\0"
|
||||
/* 1039 */ "D20_D21_D22_D23\0"
|
||||
/* 1055 */ "Q20_Q21_Q22_Q23\0"
|
||||
/* 1071 */ "W22_W23\0"
|
||||
/* 1079 */ "X16_X17_X18_X19_X20_X21_X22_X23\0"
|
||||
/* 1111 */ "Z20_Z21_Z22_Z23\0"
|
||||
/* 1127 */ "b23\0"
|
||||
/* 1131 */ "d23\0"
|
||||
/* 1135 */ "h23\0"
|
||||
/* 1139 */ "q23\0"
|
||||
/* 1143 */ "s23\0"
|
||||
/* 1147 */ "w23\0"
|
||||
/* 1151 */ "x23\0"
|
||||
/* 1155 */ "z23\0"
|
||||
/* 1159 */ "D0_D1_D2_D3\0"
|
||||
/* 1171 */ "Q0_Q1_Q2_Q3\0"
|
||||
/* 1183 */ "W2_W3\0"
|
||||
/* 1189 */ "X2_X3\0"
|
||||
/* 1195 */ "Z0_Z1_Z2_Z3\0"
|
||||
/* 1207 */ "b3\0"
|
||||
/* 1210 */ "d3\0"
|
||||
/* 1213 */ "h3\0"
|
||||
/* 1216 */ "p3\0"
|
||||
/* 1219 */ "q3\0"
|
||||
/* 1222 */ "s3\0"
|
||||
/* 1225 */ "w3\0"
|
||||
/* 1228 */ "x3\0"
|
||||
/* 1231 */ "z3\0"
|
||||
/* 1234 */ "D11_D12_D13_D14\0"
|
||||
/* 1250 */ "Q11_Q12_Q13_Q14\0"
|
||||
/* 1266 */ "Z11_Z12_Z13_Z14\0"
|
||||
/* 1282 */ "b14\0"
|
||||
/* 1286 */ "d14\0"
|
||||
/* 1290 */ "h14\0"
|
||||
/* 1294 */ "p14\0"
|
||||
/* 1298 */ "q14\0"
|
||||
/* 1302 */ "s14\0"
|
||||
/* 1306 */ "w14\0"
|
||||
/* 1310 */ "x14\0"
|
||||
/* 1314 */ "z14\0"
|
||||
/* 1318 */ "D21_D22_D23_D24\0"
|
||||
/* 1334 */ "Q21_Q22_Q23_Q24\0"
|
||||
/* 1350 */ "Z21_Z22_Z23_Z24\0"
|
||||
/* 1366 */ "b24\0"
|
||||
/* 1370 */ "d24\0"
|
||||
/* 1374 */ "h24\0"
|
||||
/* 1378 */ "q24\0"
|
||||
/* 1382 */ "s24\0"
|
||||
/* 1386 */ "w24\0"
|
||||
/* 1390 */ "x24\0"
|
||||
/* 1394 */ "z24\0"
|
||||
/* 1398 */ "D1_D2_D3_D4\0"
|
||||
/* 1410 */ "Q1_Q2_Q3_Q4\0"
|
||||
/* 1422 */ "Z1_Z2_Z3_Z4\0"
|
||||
/* 1434 */ "b4\0"
|
||||
/* 1437 */ "d4\0"
|
||||
/* 1440 */ "h4\0"
|
||||
/* 1443 */ "p4\0"
|
||||
/* 1446 */ "q4\0"
|
||||
/* 1449 */ "s4\0"
|
||||
/* 1452 */ "w4\0"
|
||||
/* 1455 */ "x4\0"
|
||||
/* 1458 */ "z4\0"
|
||||
/* 1461 */ "D12_D13_D14_D15\0"
|
||||
/* 1477 */ "Q12_Q13_Q14_Q15\0"
|
||||
/* 1493 */ "W14_W15\0"
|
||||
/* 1501 */ "X8_X9_X10_X11_X12_X13_X14_X15\0"
|
||||
/* 1531 */ "Z12_Z13_Z14_Z15\0"
|
||||
/* 1547 */ "b15\0"
|
||||
/* 1551 */ "d15\0"
|
||||
/* 1555 */ "h15\0"
|
||||
/* 1559 */ "p15\0"
|
||||
/* 1563 */ "q15\0"
|
||||
/* 1567 */ "s15\0"
|
||||
/* 1571 */ "w15\0"
|
||||
/* 1575 */ "x15\0"
|
||||
/* 1579 */ "z15\0"
|
||||
/* 1583 */ "D22_D23_D24_D25\0"
|
||||
/* 1599 */ "Q22_Q23_Q24_Q25\0"
|
||||
/* 1615 */ "W24_W25\0"
|
||||
/* 1623 */ "X18_X19_X20_X21_X22_X23_X24_X25\0"
|
||||
/* 1655 */ "Z22_Z23_Z24_Z25\0"
|
||||
/* 1671 */ "b25\0"
|
||||
/* 1675 */ "d25\0"
|
||||
/* 1679 */ "h25\0"
|
||||
/* 1683 */ "q25\0"
|
||||
/* 1687 */ "s25\0"
|
||||
/* 1691 */ "w25\0"
|
||||
/* 1695 */ "x25\0"
|
||||
/* 1699 */ "z25\0"
|
||||
/* 1703 */ "D2_D3_D4_D5\0"
|
||||
/* 1715 */ "Q2_Q3_Q4_Q5\0"
|
||||
/* 1727 */ "W4_W5\0"
|
||||
/* 1733 */ "X4_X5\0"
|
||||
/* 1739 */ "Z2_Z3_Z4_Z5\0"
|
||||
/* 1751 */ "b5\0"
|
||||
/* 1754 */ "d5\0"
|
||||
/* 1757 */ "h5\0"
|
||||
/* 1760 */ "p5\0"
|
||||
/* 1763 */ "q5\0"
|
||||
/* 1766 */ "s5\0"
|
||||
/* 1769 */ "w5\0"
|
||||
/* 1772 */ "x5\0"
|
||||
/* 1775 */ "z5\0"
|
||||
/* 1778 */ "D13_D14_D15_D16\0"
|
||||
/* 1794 */ "Q13_Q14_Q15_Q16\0"
|
||||
/* 1810 */ "Z13_Z14_Z15_Z16\0"
|
||||
/* 1826 */ "b16\0"
|
||||
/* 1830 */ "d16\0"
|
||||
/* 1834 */ "h16\0"
|
||||
/* 1838 */ "q16\0"
|
||||
/* 1842 */ "s16\0"
|
||||
/* 1846 */ "w16\0"
|
||||
/* 1850 */ "x16\0"
|
||||
/* 1854 */ "z16\0"
|
||||
/* 1858 */ "D23_D24_D25_D26\0"
|
||||
/* 1874 */ "Q23_Q24_Q25_Q26\0"
|
||||
/* 1890 */ "Z23_Z24_Z25_Z26\0"
|
||||
/* 1906 */ "b26\0"
|
||||
/* 1910 */ "d26\0"
|
||||
/* 1914 */ "h26\0"
|
||||
/* 1918 */ "q26\0"
|
||||
/* 1922 */ "s26\0"
|
||||
/* 1926 */ "w26\0"
|
||||
/* 1930 */ "x26\0"
|
||||
/* 1934 */ "z26\0"
|
||||
/* 1938 */ "D3_D4_D5_D6\0"
|
||||
/* 1950 */ "Q3_Q4_Q5_Q6\0"
|
||||
/* 1962 */ "Z3_Z4_Z5_Z6\0"
|
||||
/* 1974 */ "b6\0"
|
||||
/* 1977 */ "d6\0"
|
||||
/* 1980 */ "h6\0"
|
||||
/* 1983 */ "p6\0"
|
||||
/* 1986 */ "q6\0"
|
||||
/* 1989 */ "s6\0"
|
||||
/* 1992 */ "w6\0"
|
||||
/* 1995 */ "x6\0"
|
||||
/* 1998 */ "z6\0"
|
||||
/* 2001 */ "D14_D15_D16_D17\0"
|
||||
/* 2017 */ "Q14_Q15_Q16_Q17\0"
|
||||
/* 2033 */ "W16_W17\0"
|
||||
/* 2041 */ "X10_X11_X12_X13_X14_X15_X16_X17\0"
|
||||
/* 2073 */ "Z14_Z15_Z16_Z17\0"
|
||||
/* 2089 */ "b17\0"
|
||||
/* 2093 */ "d17\0"
|
||||
/* 2097 */ "h17\0"
|
||||
/* 2101 */ "q17\0"
|
||||
/* 2105 */ "s17\0"
|
||||
/* 2109 */ "w17\0"
|
||||
/* 2113 */ "x17\0"
|
||||
/* 2117 */ "z17\0"
|
||||
/* 2121 */ "D24_D25_D26_D27\0"
|
||||
/* 2137 */ "Q24_Q25_Q26_Q27\0"
|
||||
/* 2153 */ "W26_W27\0"
|
||||
/* 2161 */ "X20_X21_X22_X23_X24_X25_X26_X27\0"
|
||||
/* 2193 */ "Z24_Z25_Z26_Z27\0"
|
||||
/* 2209 */ "b27\0"
|
||||
/* 2213 */ "d27\0"
|
||||
/* 2217 */ "h27\0"
|
||||
/* 2221 */ "q27\0"
|
||||
/* 2225 */ "s27\0"
|
||||
/* 2229 */ "w27\0"
|
||||
/* 2233 */ "x27\0"
|
||||
/* 2237 */ "z27\0"
|
||||
/* 2241 */ "D4_D5_D6_D7\0"
|
||||
/* 2253 */ "Q4_Q5_Q6_Q7\0"
|
||||
/* 2265 */ "W6_W7\0"
|
||||
/* 2271 */ "X0_X1_X2_X3_X4_X5_X6_X7\0"
|
||||
/* 2295 */ "Z4_Z5_Z6_Z7\0"
|
||||
/* 2307 */ "b7\0"
|
||||
/* 2310 */ "d7\0"
|
||||
/* 2313 */ "h7\0"
|
||||
/* 2316 */ "p7\0"
|
||||
/* 2319 */ "q7\0"
|
||||
/* 2322 */ "s7\0"
|
||||
/* 2325 */ "w7\0"
|
||||
/* 2328 */ "x7\0"
|
||||
/* 2331 */ "z7\0"
|
||||
/* 2334 */ "D15_D16_D17_D18\0"
|
||||
/* 2350 */ "Q15_Q16_Q17_Q18\0"
|
||||
/* 2366 */ "Z15_Z16_Z17_Z18\0"
|
||||
/* 2382 */ "b18\0"
|
||||
/* 2386 */ "d18\0"
|
||||
/* 2390 */ "h18\0"
|
||||
/* 2394 */ "q18\0"
|
||||
/* 2398 */ "s18\0"
|
||||
/* 2402 */ "w18\0"
|
||||
/* 2406 */ "x18\0"
|
||||
/* 2410 */ "z18\0"
|
||||
/* 2414 */ "D25_D26_D27_D28\0"
|
||||
/* 2430 */ "Q25_Q26_Q27_Q28\0"
|
||||
/* 2446 */ "Z25_Z26_Z27_Z28\0"
|
||||
/* 2462 */ "b28\0"
|
||||
/* 2466 */ "d28\0"
|
||||
/* 2470 */ "h28\0"
|
||||
/* 2474 */ "q28\0"
|
||||
/* 2478 */ "s28\0"
|
||||
/* 2482 */ "w28\0"
|
||||
/* 2486 */ "x28\0"
|
||||
/* 2490 */ "z28\0"
|
||||
/* 2494 */ "D5_D6_D7_D8\0"
|
||||
/* 2506 */ "Q5_Q6_Q7_Q8\0"
|
||||
/* 2518 */ "Z5_Z6_Z7_Z8\0"
|
||||
/* 2530 */ "b8\0"
|
||||
/* 2533 */ "d8\0"
|
||||
/* 2536 */ "h8\0"
|
||||
/* 2539 */ "p8\0"
|
||||
/* 2542 */ "q8\0"
|
||||
/* 2545 */ "s8\0"
|
||||
/* 2548 */ "w8\0"
|
||||
/* 2551 */ "x8\0"
|
||||
/* 2554 */ "z8\0"
|
||||
/* 2557 */ "D16_D17_D18_D19\0"
|
||||
/* 2573 */ "Q16_Q17_Q18_Q19\0"
|
||||
/* 2589 */ "W18_W19\0"
|
||||
/* 2597 */ "X12_X13_X14_X15_X16_X17_X18_X19\0"
|
||||
/* 2629 */ "Z16_Z17_Z18_Z19\0"
|
||||
/* 2645 */ "b19\0"
|
||||
/* 2649 */ "d19\0"
|
||||
/* 2653 */ "h19\0"
|
||||
/* 2657 */ "q19\0"
|
||||
/* 2661 */ "s19\0"
|
||||
/* 2665 */ "w19\0"
|
||||
/* 2669 */ "x19\0"
|
||||
/* 2673 */ "z19\0"
|
||||
/* 2677 */ "D26_D27_D28_D29\0"
|
||||
/* 2693 */ "Q26_Q27_Q28_Q29\0"
|
||||
/* 2709 */ "W28_W29\0"
|
||||
/* 2717 */ "Z26_Z27_Z28_Z29\0"
|
||||
/* 2733 */ "b29\0"
|
||||
/* 2737 */ "d29\0"
|
||||
/* 2741 */ "h29\0"
|
||||
/* 2745 */ "q29\0"
|
||||
/* 2749 */ "s29\0"
|
||||
/* 2753 */ "w29\0"
|
||||
/* 2757 */ "x29\0"
|
||||
/* 2761 */ "z29\0"
|
||||
/* 2765 */ "D6_D7_D8_D9\0"
|
||||
/* 2777 */ "Q6_Q7_Q8_Q9\0"
|
||||
/* 2789 */ "W8_W9\0"
|
||||
/* 2795 */ "X2_X3_X4_X5_X6_X7_X8_X9\0"
|
||||
/* 2819 */ "Z6_Z7_Z8_Z9\0"
|
||||
/* 2831 */ "b9\0"
|
||||
/* 2834 */ "d9\0"
|
||||
/* 2837 */ "h9\0"
|
||||
/* 2840 */ "p9\0"
|
||||
/* 2843 */ "q9\0"
|
||||
/* 2846 */ "s9\0"
|
||||
/* 2849 */ "w9\0"
|
||||
/* 2852 */ "x9\0"
|
||||
/* 2855 */ "z9\0"
|
||||
/* 2858 */ "X22_X23_X24_X25_X26_X27_X28_FP\0"
|
||||
/* 2889 */ "W30_WZR\0"
|
||||
/* 2897 */ "LR_XZR\0"
|
||||
/* 2904 */ "za\0"
|
||||
/* 2907 */ "za0.b\0"
|
||||
/* 2913 */ "za0.d\0"
|
||||
/* 2919 */ "za1.d\0"
|
||||
/* 2925 */ "za2.d\0"
|
||||
/* 2931 */ "za3.d\0"
|
||||
/* 2937 */ "za4.d\0"
|
||||
/* 2943 */ "za5.d\0"
|
||||
/* 2949 */ "za6.d\0"
|
||||
/* 2955 */ "za7.d\0"
|
||||
/* 2961 */ "vg\0"
|
||||
/* 2964 */ "za0.h\0"
|
||||
/* 2970 */ "za1.h\0"
|
||||
/* 2976 */ "z10_hi\0"
|
||||
/* 2983 */ "z20_hi\0"
|
||||
/* 2990 */ "z30_hi\0"
|
||||
/* 2997 */ "z0_hi\0"
|
||||
/* 3003 */ "z11_hi\0"
|
||||
/* 3010 */ "z21_hi\0"
|
||||
/* 3017 */ "z31_hi\0"
|
||||
/* 3024 */ "z1_hi\0"
|
||||
/* 3030 */ "z12_hi\0"
|
||||
/* 3037 */ "z22_hi\0"
|
||||
/* 3044 */ "z2_hi\0"
|
||||
/* 3050 */ "z13_hi\0"
|
||||
/* 3057 */ "z23_hi\0"
|
||||
/* 3064 */ "z3_hi\0"
|
||||
/* 3070 */ "z14_hi\0"
|
||||
/* 3077 */ "z24_hi\0"
|
||||
/* 3084 */ "z4_hi\0"
|
||||
/* 3090 */ "z15_hi\0"
|
||||
/* 3097 */ "z25_hi\0"
|
||||
/* 3104 */ "z5_hi\0"
|
||||
/* 3110 */ "z16_hi\0"
|
||||
/* 3117 */ "z26_hi\0"
|
||||
/* 3124 */ "z6_hi\0"
|
||||
/* 3130 */ "z17_hi\0"
|
||||
/* 3137 */ "z27_hi\0"
|
||||
/* 3144 */ "z7_hi\0"
|
||||
/* 3150 */ "z18_hi\0"
|
||||
/* 3157 */ "z28_hi\0"
|
||||
/* 3164 */ "z8_hi\0"
|
||||
/* 3170 */ "z19_hi\0"
|
||||
/* 3177 */ "z29_hi\0"
|
||||
/* 3184 */ "z9_hi\0"
|
||||
/* 3190 */ "wsp\0"
|
||||
/* 3194 */ "za10.q\0"
|
||||
/* 3201 */ "za0.q\0"
|
||||
/* 3207 */ "za11.q\0"
|
||||
/* 3214 */ "za1.q\0"
|
||||
/* 3220 */ "za12.q\0"
|
||||
/* 3227 */ "za2.q\0"
|
||||
/* 3233 */ "za13.q\0"
|
||||
/* 3240 */ "za3.q\0"
|
||||
/* 3246 */ "za14.q\0"
|
||||
/* 3253 */ "za4.q\0"
|
||||
/* 3259 */ "za15.q\0"
|
||||
/* 3266 */ "za5.q\0"
|
||||
/* 3272 */ "za6.q\0"
|
||||
/* 3278 */ "za7.q\0"
|
||||
/* 3284 */ "za8.q\0"
|
||||
/* 3290 */ "za9.q\0"
|
||||
/* 3296 */ "ffr\0"
|
||||
/* 3300 */ "wzr\0"
|
||||
/* 3304 */ "xzr\0"
|
||||
/* 3308 */ "za0.s\0"
|
||||
/* 3314 */ "za1.s\0"
|
||||
/* 3320 */ "za2.s\0"
|
||||
/* 3326 */ "za3.s\0"
|
||||
/* 3332 */ "nzcv\0"
|
||||
};
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
static const uint16_t RegAsmOffsetNoRegAltName[] = {
|
||||
3296, 2757, 227, 3332, 3191, 2961, 3190, 3300, 3304, 2904, 280, 665, 892, 1207,
|
||||
1434, 1751, 1974, 2307, 2530, 2831, 39, 383, 737, 1003, 1282, 1547, 1826, 2089,
|
||||
2382, 2645, 123, 507, 821, 1127, 1366, 1671, 1906, 2209, 2462, 2733, 203, 587,
|
||||
283, 668, 895, 1210, 1437, 1754, 1977, 2310, 2533, 2834, 43, 387, 741, 1007,
|
||||
1286, 1551, 1830, 2093, 2386, 2649, 127, 511, 825, 1131, 1370, 1675, 1910, 2213,
|
||||
2466, 2737, 207, 591, 286, 671, 898, 1213, 1440, 1757, 1980, 2313, 2536, 2837,
|
||||
47, 391, 745, 1011, 1290, 1555, 1834, 2097, 2390, 2653, 131, 515, 829, 1135,
|
||||
1374, 1679, 1914, 2217, 2470, 2741, 211, 595, 289, 674, 901, 1216, 1443, 1760,
|
||||
1983, 2316, 2539, 2840, 51, 395, 749, 1015, 1294, 1559, 292, 677, 904, 1219,
|
||||
1446, 1763, 1986, 2319, 2542, 2843, 55, 399, 753, 1019, 1298, 1563, 1838, 2101,
|
||||
2394, 2657, 135, 519, 833, 1139, 1378, 1683, 1918, 2221, 2474, 2745, 215, 599,
|
||||
295, 680, 907, 1222, 1449, 1766, 1989, 2322, 2545, 2846, 59, 403, 757, 1023,
|
||||
1302, 1567, 1842, 2105, 2398, 2661, 139, 523, 837, 1143, 1382, 1687, 1922, 2225,
|
||||
2478, 2749, 219, 603, 298, 683, 910, 1225, 1452, 1769, 1992, 2325, 2548, 2849,
|
||||
63, 407, 761, 1027, 1306, 1571, 1846, 2109, 2402, 2665, 143, 527, 841, 1147,
|
||||
1386, 1691, 1926, 2229, 2482, 2753, 223, 301, 686, 913, 1228, 1455, 1772, 1995,
|
||||
2328, 2551, 2852, 67, 411, 765, 1031, 1310, 1575, 1850, 2113, 2406, 2669, 147,
|
||||
531, 845, 1151, 1390, 1695, 1930, 2233, 2486, 304, 689, 916, 1231, 1458, 1775,
|
||||
1998, 2331, 2554, 2855, 71, 415, 769, 1035, 1314, 1579, 1854, 2117, 2410, 2673,
|
||||
151, 535, 849, 1155, 1394, 1699, 1934, 2237, 2490, 2761, 231, 607, 2907, 2913,
|
||||
2919, 2925, 2931, 2937, 2943, 2949, 2955, 2964, 2970, 3201, 3214, 3227, 3240, 3253,
|
||||
3266, 3272, 3278, 3284, 3290, 3194, 3207, 3220, 3233, 3246, 3259, 3308, 3314, 3320,
|
||||
3326, 2997, 3024, 3044, 3064, 3084, 3104, 3124, 3144, 3164, 3184, 2976, 3003, 3030,
|
||||
3050, 3070, 3090, 3110, 3130, 3150, 3170, 2983, 3010, 3037, 3057, 3077, 3097, 3117,
|
||||
3137, 3157, 3177, 2990, 3017, 619, 860, 1165, 1404, 1709, 1944, 2247, 2500, 2771,
|
||||
6, 313, 699, 927, 1242, 1469, 1786, 2009, 2342, 2565, 83, 427, 781, 1047,
|
||||
1326, 1591, 1866, 2129, 2422, 2685, 163, 547, 243, 1159, 1398, 1703, 1938, 2241,
|
||||
2494, 2765, 0, 307, 692, 919, 1234, 1461, 1778, 2001, 2334, 2557, 75, 419,
|
||||
773, 1039, 1318, 1583, 1858, 2121, 2414, 2677, 155, 539, 235, 611, 853, 857,
|
||||
1162, 1401, 1706, 1941, 2244, 2497, 2768, 3, 310, 695, 923, 1238, 1465, 1782,
|
||||
2005, 2338, 2561, 79, 423, 777, 1043, 1322, 1587, 1862, 2125, 2418, 2681, 159,
|
||||
543, 239, 615, 633, 873, 1177, 1416, 1721, 1956, 2259, 2512, 2783, 19, 327,
|
||||
714, 943, 1258, 1485, 1802, 2025, 2358, 2581, 99, 443, 797, 1063, 1342, 1607,
|
||||
1882, 2145, 2438, 2701, 179, 563, 258, 1171, 1410, 1715, 1950, 2253, 2506, 2777,
|
||||
13, 321, 707, 935, 1250, 1477, 1794, 2017, 2350, 2573, 91, 435, 789, 1055,
|
||||
1334, 1599, 1874, 2137, 2430, 2693, 171, 555, 250, 625, 866, 870, 1174, 1413,
|
||||
1718, 1953, 2256, 2509, 2780, 16, 324, 710, 939, 1254, 1481, 1798, 2021, 2354,
|
||||
2577, 95, 439, 793, 1059, 1338, 1603, 1878, 2141, 2434, 2697, 175, 559, 254,
|
||||
629, 2858, 2271, 2795, 343, 959, 1501, 2041, 2597, 459, 1079, 1623, 2161, 2889,
|
||||
639, 1183, 1727, 2265, 2789, 335, 951, 1493, 2033, 2589, 451, 1071, 1615, 2153,
|
||||
2709, 2897, 2882, 645, 1189, 1733, 2289, 2813, 361, 979, 1523, 2065, 2621, 483,
|
||||
1103, 1647, 2185, 659, 886, 1201, 1428, 1745, 1968, 2301, 2524, 2825, 32, 375,
|
||||
729, 995, 1274, 1539, 1818, 2081, 2374, 2637, 115, 499, 813, 1119, 1358, 1663,
|
||||
1898, 2201, 2454, 2725, 195, 579, 273, 1195, 1422, 1739, 1962, 2295, 2518, 2819,
|
||||
26, 369, 722, 987, 1266, 1531, 1810, 2073, 2366, 2629, 107, 491, 805, 1111,
|
||||
1350, 1655, 1890, 2193, 2446, 2717, 187, 571, 265, 651, 879, 883, 1198, 1425,
|
||||
1742, 1965, 2298, 2521, 2822, 29, 372, 725, 991, 1270, 1535, 1814, 2077, 2370,
|
||||
2633, 111, 495, 809, 1115, 1354, 1659, 1894, 2197, 2450, 2721, 191, 575, 269,
|
||||
655,
|
||||
};
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Woverlength-strings"
|
||||
#endif
|
||||
static const char AsmStrsvlist1[] = {
|
||||
/* 0 */ "\0"
|
||||
};
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
static const uint8_t RegAsmOffsetvlist1[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0,
|
||||
};
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Woverlength-strings"
|
||||
#endif
|
||||
static const char AsmStrsvreg[] = {
|
||||
/* 0 */ "v10\0"
|
||||
/* 4 */ "v20\0"
|
||||
/* 8 */ "v30\0"
|
||||
/* 12 */ "v0\0"
|
||||
/* 15 */ "v11\0"
|
||||
/* 19 */ "v21\0"
|
||||
/* 23 */ "v31\0"
|
||||
/* 27 */ "v1\0"
|
||||
/* 30 */ "v12\0"
|
||||
/* 34 */ "v22\0"
|
||||
/* 38 */ "v2\0"
|
||||
/* 41 */ "v13\0"
|
||||
/* 45 */ "v23\0"
|
||||
/* 49 */ "v3\0"
|
||||
/* 52 */ "v14\0"
|
||||
/* 56 */ "v24\0"
|
||||
/* 60 */ "v4\0"
|
||||
/* 63 */ "v15\0"
|
||||
/* 67 */ "v25\0"
|
||||
/* 71 */ "v5\0"
|
||||
/* 74 */ "v16\0"
|
||||
/* 78 */ "v26\0"
|
||||
/* 82 */ "v6\0"
|
||||
/* 85 */ "v17\0"
|
||||
/* 89 */ "v27\0"
|
||||
/* 93 */ "v7\0"
|
||||
/* 96 */ "v18\0"
|
||||
/* 100 */ "v28\0"
|
||||
/* 104 */ "v8\0"
|
||||
/* 107 */ "v19\0"
|
||||
/* 111 */ "v29\0"
|
||||
/* 115 */ "v9\0"
|
||||
};
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
static const uint8_t RegAsmOffsetvreg[] = {
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
12, 27, 38, 49, 60, 71, 82, 93, 104, 115, 0, 15, 30, 41,
|
||||
52, 63, 74, 85, 96, 107, 4, 19, 34, 45, 56, 67, 78, 89,
|
||||
100, 111, 8, 23, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 12, 27, 38, 49,
|
||||
60, 71, 82, 93, 104, 115, 0, 15, 30, 41, 52, 63, 74, 85,
|
||||
96, 107, 4, 19, 34, 45, 56, 67, 78, 89, 100, 111, 8, 23,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 12, 27, 38, 49, 60, 71, 82, 93, 104,
|
||||
115, 0, 15, 30, 41, 52, 63, 74, 85, 96, 107, 4, 19, 34,
|
||||
45, 56, 67, 78, 89, 100, 111, 8, 23, 12, 27, 38, 49, 60,
|
||||
71, 82, 93, 104, 115, 0, 15, 30, 41, 52, 63, 74, 85, 96,
|
||||
107, 4, 19, 34, 45, 56, 67, 78, 89, 100, 111, 8, 23, 12,
|
||||
27, 38, 49, 60, 71, 82, 93, 104, 115, 0, 15, 30, 41, 52,
|
||||
63, 74, 85, 96, 107, 4, 19, 34, 45, 56, 67, 78, 89, 100,
|
||||
111, 8, 23, 12, 27, 38, 49, 60, 71, 82, 93, 104, 115, 0,
|
||||
15, 30, 41, 52, 63, 74, 85, 96, 107, 4, 19, 34, 45, 56,
|
||||
67, 78, 89, 100, 111, 8, 23, 12, 27, 38, 49, 60, 71, 82,
|
||||
93, 104, 115, 0, 15, 30, 41, 52, 63, 74, 85, 96, 107, 4,
|
||||
19, 34, 45, 56, 67, 78, 89, 100, 111, 8, 23, 12, 27, 38,
|
||||
49, 60, 71, 82, 93, 104, 115, 0, 15, 30, 41, 52, 63, 74,
|
||||
85, 96, 107, 4, 19, 34, 45, 56, 67, 78, 89, 100, 111, 8,
|
||||
23, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3,
|
||||
};
|
||||
|
||||
switch(AltIdx) {
|
||||
default:
|
||||
return (const char *)(sizeof(RegAsmOffsetvreg)/sizeof(RegAsmOffsetvreg[0]));
|
||||
case AArch64_NoRegAltName:
|
||||
return AsmStrsNoRegAltName+RegAsmOffsetNoRegAltName[RegNo-1];
|
||||
case AArch64_vlist1:
|
||||
return AsmStrsvlist1+RegAsmOffsetvlist1[RegNo-1];
|
||||
case AArch64_vreg:
|
||||
return AsmStrsvreg+RegAsmOffsetvreg[RegNo-1];
|
||||
}
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
298
thirdparty/capstone/arch/AArch64/AArch64GenSubtargetInfo.inc
vendored
Normal file
298
thirdparty/capstone/arch/AArch64/AArch64GenSubtargetInfo.inc
vendored
Normal file
@@ -0,0 +1,298 @@
|
||||
/* Capstone Disassembly Engine, https://www.capstone-engine.org */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */
|
||||
/* Rot127 <unisono@quyllur.org> 2022-2024 */
|
||||
/* Automatically generated file by Capstone's LLVM TableGen Disassembler Backend. */
|
||||
|
||||
/* LLVM-commit: <commit> */
|
||||
/* LLVM-tag: <tag> */
|
||||
|
||||
/* Do not edit. */
|
||||
|
||||
/* Capstone's LLVM TableGen Backends: */
|
||||
/* https://github.com/capstone-engine/llvm-capstone */
|
||||
|
||||
#ifdef GET_SUBTARGETINFO_ENUM
|
||||
#undef GET_SUBTARGETINFO_ENUM
|
||||
|
||||
enum {
|
||||
AArch64_FeatureAES = 0,
|
||||
AArch64_FeatureALULSLFast = 1,
|
||||
AArch64_FeatureAM = 2,
|
||||
AArch64_FeatureAMVS = 3,
|
||||
AArch64_FeatureAddrLSLFast = 4,
|
||||
AArch64_FeatureAggressiveFMA = 5,
|
||||
AArch64_FeatureAll = 6,
|
||||
AArch64_FeatureAltFPCmp = 7,
|
||||
AArch64_FeatureAlternateSExtLoadCVTF32Pattern = 8,
|
||||
AArch64_FeatureAppleA7SysReg = 9,
|
||||
AArch64_FeatureArithmeticBccFusion = 10,
|
||||
AArch64_FeatureArithmeticCbzFusion = 11,
|
||||
AArch64_FeatureAscendStoreAddress = 12,
|
||||
AArch64_FeatureB16B16 = 13,
|
||||
AArch64_FeatureBF16 = 14,
|
||||
AArch64_FeatureBRBE = 15,
|
||||
AArch64_FeatureBalanceFPOps = 16,
|
||||
AArch64_FeatureBranchTargetId = 17,
|
||||
AArch64_FeatureCCIDX = 18,
|
||||
AArch64_FeatureCCPP = 19,
|
||||
AArch64_FeatureCHK = 20,
|
||||
AArch64_FeatureCLRBHB = 21,
|
||||
AArch64_FeatureCONTEXTIDREL2 = 22,
|
||||
AArch64_FeatureCPA = 23,
|
||||
AArch64_FeatureCRC = 24,
|
||||
AArch64_FeatureCSSC = 25,
|
||||
AArch64_FeatureCacheDeepPersist = 26,
|
||||
AArch64_FeatureCallSavedX8 = 27,
|
||||
AArch64_FeatureCallSavedX9 = 28,
|
||||
AArch64_FeatureCallSavedX10 = 29,
|
||||
AArch64_FeatureCallSavedX11 = 30,
|
||||
AArch64_FeatureCallSavedX12 = 31,
|
||||
AArch64_FeatureCallSavedX13 = 32,
|
||||
AArch64_FeatureCallSavedX14 = 33,
|
||||
AArch64_FeatureCallSavedX15 = 34,
|
||||
AArch64_FeatureCallSavedX18 = 35,
|
||||
AArch64_FeatureCmpBccFusion = 36,
|
||||
AArch64_FeatureComplxNum = 37,
|
||||
AArch64_FeatureCrypto = 38,
|
||||
AArch64_FeatureD128 = 39,
|
||||
AArch64_FeatureDIT = 40,
|
||||
AArch64_FeatureDisableLatencySchedHeuristic = 41,
|
||||
AArch64_FeatureDisableLdp = 42,
|
||||
AArch64_FeatureDisableStp = 43,
|
||||
AArch64_FeatureDotProd = 44,
|
||||
AArch64_FeatureEL2VMSA = 45,
|
||||
AArch64_FeatureEL3 = 46,
|
||||
AArch64_FeatureETE = 47,
|
||||
AArch64_FeatureEnableSelectOptimize = 48,
|
||||
AArch64_FeatureEnhancedCounterVirtualization = 49,
|
||||
AArch64_FeatureExperimentalZeroingPseudos = 50,
|
||||
AArch64_FeatureExynosCheapAsMoveHandling = 51,
|
||||
AArch64_FeatureFAMINMAX = 52,
|
||||
AArch64_FeatureFMV = 53,
|
||||
AArch64_FeatureFP8 = 54,
|
||||
AArch64_FeatureFP8DOT2 = 55,
|
||||
AArch64_FeatureFP8DOT4 = 56,
|
||||
AArch64_FeatureFP8FMA = 57,
|
||||
AArch64_FeatureFP16FML = 58,
|
||||
AArch64_FeatureFPARMv8 = 59,
|
||||
AArch64_FeatureFPMR = 60,
|
||||
AArch64_FeatureFRInt3264 = 61,
|
||||
AArch64_FeatureFineGrainedTraps = 62,
|
||||
AArch64_FeatureFixCortexA53_835769 = 63,
|
||||
AArch64_FeatureFlagM = 64,
|
||||
AArch64_FeatureForce32BitJumpTables = 65,
|
||||
AArch64_FeatureFullFP16 = 66,
|
||||
AArch64_FeatureFuseAES = 67,
|
||||
AArch64_FeatureFuseAddSub2RegAndConstOne = 68,
|
||||
AArch64_FeatureFuseAddress = 69,
|
||||
AArch64_FeatureFuseAdrpAdd = 70,
|
||||
AArch64_FeatureFuseArithmeticLogic = 71,
|
||||
AArch64_FeatureFuseCCSelect = 72,
|
||||
AArch64_FeatureFuseCryptoEOR = 73,
|
||||
AArch64_FeatureFuseLiterals = 74,
|
||||
AArch64_FeatureGCS = 75,
|
||||
AArch64_FeatureHBC = 76,
|
||||
AArch64_FeatureHCX = 77,
|
||||
AArch64_FeatureHardenSlsBlr = 78,
|
||||
AArch64_FeatureHardenSlsNoComdat = 79,
|
||||
AArch64_FeatureHardenSlsRetBr = 80,
|
||||
AArch64_FeatureITE = 81,
|
||||
AArch64_FeatureJS = 82,
|
||||
AArch64_FeatureLOR = 83,
|
||||
AArch64_FeatureLS64 = 84,
|
||||
AArch64_FeatureLSE = 85,
|
||||
AArch64_FeatureLSE2 = 86,
|
||||
AArch64_FeatureLSE128 = 87,
|
||||
AArch64_FeatureLUT = 88,
|
||||
AArch64_FeatureLdpAlignedOnly = 89,
|
||||
AArch64_FeatureMEC = 90,
|
||||
AArch64_FeatureMOPS = 91,
|
||||
AArch64_FeatureMPAM = 92,
|
||||
AArch64_FeatureMTE = 93,
|
||||
AArch64_FeatureMatMulFP32 = 94,
|
||||
AArch64_FeatureMatMulFP64 = 95,
|
||||
AArch64_FeatureMatMulInt8 = 96,
|
||||
AArch64_FeatureNEON = 97,
|
||||
AArch64_FeatureNMI = 98,
|
||||
AArch64_FeatureNV = 99,
|
||||
AArch64_FeatureNoBTIAtReturnTwice = 100,
|
||||
AArch64_FeatureNoNegativeImmediates = 101,
|
||||
AArch64_FeatureNoSVEFPLD1R = 102,
|
||||
AArch64_FeatureNoZCZeroingFP = 103,
|
||||
AArch64_FeatureOutlineAtomics = 104,
|
||||
AArch64_FeaturePAN = 105,
|
||||
AArch64_FeaturePAN_RWV = 106,
|
||||
AArch64_FeaturePAuth = 107,
|
||||
AArch64_FeaturePAuthLR = 108,
|
||||
AArch64_FeaturePRFM_SLC = 109,
|
||||
AArch64_FeaturePerfMon = 110,
|
||||
AArch64_FeaturePostRAScheduler = 111,
|
||||
AArch64_FeaturePredRes = 112,
|
||||
AArch64_FeaturePredictableSelectIsExpensive = 113,
|
||||
AArch64_FeaturePsUAO = 114,
|
||||
AArch64_FeatureRAS = 115,
|
||||
AArch64_FeatureRASv2 = 116,
|
||||
AArch64_FeatureRCPC = 117,
|
||||
AArch64_FeatureRCPC3 = 118,
|
||||
AArch64_FeatureRCPC_IMMO = 119,
|
||||
AArch64_FeatureRDM = 120,
|
||||
AArch64_FeatureRME = 121,
|
||||
AArch64_FeatureRandGen = 122,
|
||||
AArch64_FeatureReserveX1 = 123,
|
||||
AArch64_FeatureReserveX2 = 124,
|
||||
AArch64_FeatureReserveX3 = 125,
|
||||
AArch64_FeatureReserveX4 = 126,
|
||||
AArch64_FeatureReserveX5 = 127,
|
||||
AArch64_FeatureReserveX6 = 128,
|
||||
AArch64_FeatureReserveX7 = 129,
|
||||
AArch64_FeatureReserveX9 = 130,
|
||||
AArch64_FeatureReserveX10 = 131,
|
||||
AArch64_FeatureReserveX11 = 132,
|
||||
AArch64_FeatureReserveX12 = 133,
|
||||
AArch64_FeatureReserveX13 = 134,
|
||||
AArch64_FeatureReserveX14 = 135,
|
||||
AArch64_FeatureReserveX15 = 136,
|
||||
AArch64_FeatureReserveX18 = 137,
|
||||
AArch64_FeatureReserveX20 = 138,
|
||||
AArch64_FeatureReserveX21 = 139,
|
||||
AArch64_FeatureReserveX22 = 140,
|
||||
AArch64_FeatureReserveX23 = 141,
|
||||
AArch64_FeatureReserveX24 = 142,
|
||||
AArch64_FeatureReserveX25 = 143,
|
||||
AArch64_FeatureReserveX26 = 144,
|
||||
AArch64_FeatureReserveX27 = 145,
|
||||
AArch64_FeatureReserveX28 = 146,
|
||||
AArch64_FeatureReserveX30 = 147,
|
||||
AArch64_FeatureSB = 148,
|
||||
AArch64_FeatureSEL2 = 149,
|
||||
AArch64_FeatureSHA2 = 150,
|
||||
AArch64_FeatureSHA3 = 151,
|
||||
AArch64_FeatureSM4 = 152,
|
||||
AArch64_FeatureSME = 153,
|
||||
AArch64_FeatureSME2 = 154,
|
||||
AArch64_FeatureSME2p1 = 155,
|
||||
AArch64_FeatureSMEF8F16 = 156,
|
||||
AArch64_FeatureSMEF8F32 = 157,
|
||||
AArch64_FeatureSMEF16F16 = 158,
|
||||
AArch64_FeatureSMEF64F64 = 159,
|
||||
AArch64_FeatureSMEFA64 = 160,
|
||||
AArch64_FeatureSMEI16I64 = 161,
|
||||
AArch64_FeatureSME_LUTv2 = 162,
|
||||
AArch64_FeatureSPE = 163,
|
||||
AArch64_FeatureSPECRES2 = 164,
|
||||
AArch64_FeatureSPE_EEF = 165,
|
||||
AArch64_FeatureSSBS = 166,
|
||||
AArch64_FeatureSSVE_FP8DOT2 = 167,
|
||||
AArch64_FeatureSSVE_FP8DOT4 = 168,
|
||||
AArch64_FeatureSSVE_FP8FMA = 169,
|
||||
AArch64_FeatureSVE = 170,
|
||||
AArch64_FeatureSVE2 = 171,
|
||||
AArch64_FeatureSVE2AES = 172,
|
||||
AArch64_FeatureSVE2BitPerm = 173,
|
||||
AArch64_FeatureSVE2SHA3 = 174,
|
||||
AArch64_FeatureSVE2SM4 = 175,
|
||||
AArch64_FeatureSVE2p1 = 176,
|
||||
AArch64_FeatureSlowMisaligned128Store = 177,
|
||||
AArch64_FeatureSlowPaired128 = 178,
|
||||
AArch64_FeatureSlowSTRQro = 179,
|
||||
AArch64_FeatureSpecRestrict = 180,
|
||||
AArch64_FeatureStorePairSuppress = 181,
|
||||
AArch64_FeatureStpAlignedOnly = 182,
|
||||
AArch64_FeatureStrictAlign = 183,
|
||||
AArch64_FeatureTHE = 184,
|
||||
AArch64_FeatureTLBIW = 185,
|
||||
AArch64_FeatureTLB_RMI = 186,
|
||||
AArch64_FeatureTME = 187,
|
||||
AArch64_FeatureTRACEV8_4 = 188,
|
||||
AArch64_FeatureTRBE = 189,
|
||||
AArch64_FeatureTaggedGlobals = 190,
|
||||
AArch64_FeatureUseEL1ForTP = 191,
|
||||
AArch64_FeatureUseEL2ForTP = 192,
|
||||
AArch64_FeatureUseEL3ForTP = 193,
|
||||
AArch64_FeatureUseROEL0ForTP = 194,
|
||||
AArch64_FeatureUseRSqrt = 195,
|
||||
AArch64_FeatureUseScalarIncVL = 196,
|
||||
AArch64_FeatureVH = 197,
|
||||
AArch64_FeatureWFxT = 198,
|
||||
AArch64_FeatureXS = 199,
|
||||
AArch64_FeatureZCRegMove = 200,
|
||||
AArch64_FeatureZCZeroing = 201,
|
||||
AArch64_FeatureZCZeroingFPWorkaround = 202,
|
||||
AArch64_FeatureZCZeroingGP = 203,
|
||||
AArch64_HasV8_0aOps = 204,
|
||||
AArch64_HasV8_0rOps = 205,
|
||||
AArch64_HasV8_1aOps = 206,
|
||||
AArch64_HasV8_2aOps = 207,
|
||||
AArch64_HasV8_3aOps = 208,
|
||||
AArch64_HasV8_4aOps = 209,
|
||||
AArch64_HasV8_5aOps = 210,
|
||||
AArch64_HasV8_6aOps = 211,
|
||||
AArch64_HasV8_7aOps = 212,
|
||||
AArch64_HasV8_8aOps = 213,
|
||||
AArch64_HasV8_9aOps = 214,
|
||||
AArch64_HasV9_0aOps = 215,
|
||||
AArch64_HasV9_1aOps = 216,
|
||||
AArch64_HasV9_2aOps = 217,
|
||||
AArch64_HasV9_3aOps = 218,
|
||||
AArch64_HasV9_4aOps = 219,
|
||||
AArch64_HasV9_5aOps = 220,
|
||||
AArch64_TuneA35 = 221,
|
||||
AArch64_TuneA53 = 222,
|
||||
AArch64_TuneA55 = 223,
|
||||
AArch64_TuneA57 = 224,
|
||||
AArch64_TuneA64FX = 225,
|
||||
AArch64_TuneA65 = 226,
|
||||
AArch64_TuneA72 = 227,
|
||||
AArch64_TuneA73 = 228,
|
||||
AArch64_TuneA75 = 229,
|
||||
AArch64_TuneA76 = 230,
|
||||
AArch64_TuneA77 = 231,
|
||||
AArch64_TuneA78 = 232,
|
||||
AArch64_TuneA78C = 233,
|
||||
AArch64_TuneA510 = 234,
|
||||
AArch64_TuneA520 = 235,
|
||||
AArch64_TuneA710 = 236,
|
||||
AArch64_TuneA715 = 237,
|
||||
AArch64_TuneA720 = 238,
|
||||
AArch64_TuneAmpere1 = 239,
|
||||
AArch64_TuneAmpere1A = 240,
|
||||
AArch64_TuneAmpere1B = 241,
|
||||
AArch64_TuneAppleA7 = 242,
|
||||
AArch64_TuneAppleA10 = 243,
|
||||
AArch64_TuneAppleA11 = 244,
|
||||
AArch64_TuneAppleA12 = 245,
|
||||
AArch64_TuneAppleA13 = 246,
|
||||
AArch64_TuneAppleA14 = 247,
|
||||
AArch64_TuneAppleA15 = 248,
|
||||
AArch64_TuneAppleA16 = 249,
|
||||
AArch64_TuneAppleA17 = 250,
|
||||
AArch64_TuneCarmel = 251,
|
||||
AArch64_TuneExynosM3 = 252,
|
||||
AArch64_TuneExynosM4 = 253,
|
||||
AArch64_TuneFalkor = 254,
|
||||
AArch64_TuneKryo = 255,
|
||||
AArch64_TuneNeoverse512TVB = 256,
|
||||
AArch64_TuneNeoverseE1 = 257,
|
||||
AArch64_TuneNeoverseN1 = 258,
|
||||
AArch64_TuneNeoverseN2 = 259,
|
||||
AArch64_TuneNeoverseV1 = 260,
|
||||
AArch64_TuneNeoverseV2 = 261,
|
||||
AArch64_TuneR82 = 262,
|
||||
AArch64_TuneSaphira = 263,
|
||||
AArch64_TuneTSV110 = 264,
|
||||
AArch64_TuneThunderX = 265,
|
||||
AArch64_TuneThunderX2T99 = 266,
|
||||
AArch64_TuneThunderX3T110 = 267,
|
||||
AArch64_TuneThunderXT81 = 268,
|
||||
AArch64_TuneThunderXT83 = 269,
|
||||
AArch64_TuneThunderXT88 = 270,
|
||||
AArch64_TuneX1 = 271,
|
||||
AArch64_TuneX2 = 272,
|
||||
AArch64_TuneX3 = 273,
|
||||
AArch64_TuneX4 = 274,
|
||||
AArch64_NumSubtargetFeatures = 275
|
||||
};
|
||||
#endif // GET_SUBTARGETINFO_ENUM
|
||||
|
||||
|
||||
|
5379
thirdparty/capstone/arch/AArch64/AArch64GenSystemOperands.inc
vendored
Normal file
5379
thirdparty/capstone/arch/AArch64/AArch64GenSystemOperands.inc
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2554
thirdparty/capstone/arch/AArch64/AArch64InstPrinter.c
vendored
Normal file
2554
thirdparty/capstone/arch/AArch64/AArch64InstPrinter.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
350
thirdparty/capstone/arch/AArch64/AArch64InstPrinter.h
vendored
Normal file
350
thirdparty/capstone/arch/AArch64/AArch64InstPrinter.h
vendored
Normal file
@@ -0,0 +1,350 @@
|
||||
/* Capstone Disassembly Engine, http://www.capstone-engine.org */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */
|
||||
/* Rot127 <unisono@quyllur.org> 2022-2023 */
|
||||
/* Automatically translated source file from LLVM. */
|
||||
|
||||
/* LLVM-commit: <commit> */
|
||||
/* LLVM-tag: <tag> */
|
||||
|
||||
/* Only small edits allowed. */
|
||||
/* For multiple similar edits, please create a Patch for the translator. */
|
||||
|
||||
/* Capstone's C++ file translator: */
|
||||
/* https://github.com/capstone-engine/capstone/tree/next/suite/auto-sync */
|
||||
|
||||
//===-- AArch64InstPrinter.h - Convert AArch64 MCInst to assembly syntax --===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This class prints an AArch64 MCInst to a .s file.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64INSTPRINTER_H
|
||||
#define LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64INSTPRINTER_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <capstone/platform.h>
|
||||
|
||||
#include "AArch64Mapping.h"
|
||||
|
||||
#include "../../MCInst.h"
|
||||
#include "../../MCRegisterInfo.h"
|
||||
#include "../../MCInstPrinter.h"
|
||||
#include "../../SStream.h"
|
||||
#include "../../utils.h"
|
||||
|
||||
#define CONCAT(a, b) CONCAT_(a, b)
|
||||
#define CONCAT_(a, b) a##_##b
|
||||
#define CHAR(c) #c[0]
|
||||
|
||||
void printInst(MCInst *MI, uint64_t Address, const char *Annot, SStream *O);
|
||||
void printRegName(SStream *OS, unsigned Reg);
|
||||
void printRegNameAlt(SStream *OS, unsigned Reg, unsigned AltIdx);
|
||||
// Autogenerated by tblgen.
|
||||
const char *getRegName(unsigned Reg);
|
||||
bool printSysAlias(MCInst *MI, SStream *O);
|
||||
bool printSyspAlias(MCInst *MI, SStream *O);
|
||||
bool printRangePrefetchAlias(MCInst *MI, SStream *O, const char *Annot);
|
||||
// Operand printers
|
||||
void printOperand(MCInst *MI, unsigned OpNo, SStream *O);
|
||||
void printImm(MCInst *MI, unsigned OpNo, SStream *O);
|
||||
void printImmHex(MCInst *MI, unsigned OpNo, SStream *O);
|
||||
#define DECLARE_printSImm(Size) \
|
||||
void CONCAT(printSImm, Size)(MCInst * MI, unsigned OpNo, SStream *O);
|
||||
DECLARE_printSImm(16);
|
||||
DECLARE_printSImm(8);
|
||||
|
||||
#define DECLARE_printImmSVE(T) void CONCAT(printImmSVE, T)(T Val, SStream * O);
|
||||
DECLARE_printImmSVE(int16_t);
|
||||
DECLARE_printImmSVE(int8_t);
|
||||
DECLARE_printImmSVE(int64_t);
|
||||
DECLARE_printImmSVE(int32_t);
|
||||
DECLARE_printImmSVE(uint16_t);
|
||||
DECLARE_printImmSVE(uint8_t);
|
||||
DECLARE_printImmSVE(uint64_t);
|
||||
DECLARE_printImmSVE(uint32_t);
|
||||
|
||||
void printPostIncOperand(MCInst *MI, unsigned OpNo, unsigned Imm, SStream *O);
|
||||
#define DEFINE_printPostIncOperand(Amount) \
|
||||
static inline void CONCAT(printPostIncOperand, Amount)( \
|
||||
MCInst * MI, unsigned OpNo, SStream *O) \
|
||||
{ \
|
||||
add_cs_detail(MI, \
|
||||
CONCAT(AArch64_OP_GROUP_PostIncOperand, Amount), \
|
||||
OpNo, Amount); \
|
||||
printPostIncOperand(MI, OpNo, Amount, O); \
|
||||
}
|
||||
DEFINE_printPostIncOperand(64);
|
||||
DEFINE_printPostIncOperand(32);
|
||||
DEFINE_printPostIncOperand(16);
|
||||
DEFINE_printPostIncOperand(8);
|
||||
DEFINE_printPostIncOperand(1);
|
||||
DEFINE_printPostIncOperand(4);
|
||||
DEFINE_printPostIncOperand(2);
|
||||
DEFINE_printPostIncOperand(48);
|
||||
DEFINE_printPostIncOperand(24);
|
||||
DEFINE_printPostIncOperand(3);
|
||||
DEFINE_printPostIncOperand(12);
|
||||
DEFINE_printPostIncOperand(6);
|
||||
|
||||
void printVRegOperand(MCInst *MI, unsigned OpNo, SStream *O);
|
||||
void printSysCROperand(MCInst *MI, unsigned OpNo, SStream *O);
|
||||
void printAddSubImm(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
#define DECLARE_printLogicalImm(T) \
|
||||
void CONCAT(printLogicalImm, T)(MCInst * MI, unsigned OpNum, \
|
||||
SStream *O);
|
||||
DECLARE_printLogicalImm(int64_t);
|
||||
DECLARE_printLogicalImm(int32_t);
|
||||
DECLARE_printLogicalImm(int8_t);
|
||||
DECLARE_printLogicalImm(int16_t);
|
||||
|
||||
void printShifter(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
void printShiftedRegister(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
void printExtendedRegister(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
void printArithExtend(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
|
||||
void printMemExtend(MCInst *MI, unsigned OpNum, SStream *O, char SrcRegKind,
|
||||
unsigned Width);
|
||||
void printMemExtend(MCInst *MI, unsigned OpNum, SStream *O, char SrcRegKind,
|
||||
unsigned Width);
|
||||
#define DEFINE_printMemExtend(SrcRegKind, Width) \
|
||||
static inline void CONCAT(printMemExtend, CONCAT(SrcRegKind, Width))( \
|
||||
MCInst * MI, unsigned OpNum, SStream *O) \
|
||||
{ \
|
||||
add_cs_detail( \
|
||||
MI, \
|
||||
CONCAT(CONCAT(AArch64_OP_GROUP_MemExtend, SrcRegKind), \
|
||||
Width), \
|
||||
OpNum, CHAR(SrcRegKind), Width); \
|
||||
printMemExtend(MI, OpNum, O, CHAR(SrcRegKind), Width); \
|
||||
}
|
||||
DEFINE_printMemExtend(w, 8);
|
||||
DEFINE_printMemExtend(x, 8);
|
||||
DEFINE_printMemExtend(w, 64);
|
||||
DEFINE_printMemExtend(x, 64);
|
||||
DEFINE_printMemExtend(w, 16);
|
||||
DEFINE_printMemExtend(x, 16);
|
||||
DEFINE_printMemExtend(w, 128);
|
||||
DEFINE_printMemExtend(x, 128);
|
||||
DEFINE_printMemExtend(w, 32);
|
||||
DEFINE_printMemExtend(x, 32);
|
||||
|
||||
#define DECLARE_printRegWithShiftExtend(SignedExtend, ExtWidth, SrcRegKind, \
|
||||
Suffix) \
|
||||
void CONCAT(printRegWithShiftExtend, \
|
||||
CONCAT(SignedExtend, \
|
||||
CONCAT(ExtWidth, CONCAT(SrcRegKind, Suffix))))( \
|
||||
MCInst * MI, unsigned OpNum, SStream *O);
|
||||
DECLARE_printRegWithShiftExtend(false, 8, x, d);
|
||||
DECLARE_printRegWithShiftExtend(true, 8, w, d);
|
||||
DECLARE_printRegWithShiftExtend(false, 8, w, d);
|
||||
DECLARE_printRegWithShiftExtend(false, 8, x, 0);
|
||||
DECLARE_printRegWithShiftExtend(true, 8, w, s);
|
||||
DECLARE_printRegWithShiftExtend(false, 8, w, s);
|
||||
DECLARE_printRegWithShiftExtend(false, 64, x, d);
|
||||
DECLARE_printRegWithShiftExtend(true, 64, w, d);
|
||||
DECLARE_printRegWithShiftExtend(false, 64, w, d);
|
||||
DECLARE_printRegWithShiftExtend(false, 64, x, 0);
|
||||
DECLARE_printRegWithShiftExtend(true, 64, w, s);
|
||||
DECLARE_printRegWithShiftExtend(false, 64, w, s);
|
||||
DECLARE_printRegWithShiftExtend(false, 16, x, d);
|
||||
DECLARE_printRegWithShiftExtend(true, 16, w, d);
|
||||
DECLARE_printRegWithShiftExtend(false, 16, w, d);
|
||||
DECLARE_printRegWithShiftExtend(false, 16, x, 0);
|
||||
DECLARE_printRegWithShiftExtend(true, 16, w, s);
|
||||
DECLARE_printRegWithShiftExtend(false, 16, w, s);
|
||||
DECLARE_printRegWithShiftExtend(false, 32, x, d);
|
||||
DECLARE_printRegWithShiftExtend(true, 32, w, d);
|
||||
DECLARE_printRegWithShiftExtend(false, 32, w, d);
|
||||
DECLARE_printRegWithShiftExtend(false, 32, x, 0);
|
||||
DECLARE_printRegWithShiftExtend(true, 32, w, s);
|
||||
DECLARE_printRegWithShiftExtend(false, 32, w, s);
|
||||
DECLARE_printRegWithShiftExtend(false, 8, x, s);
|
||||
DECLARE_printRegWithShiftExtend(false, 16, x, s);
|
||||
DECLARE_printRegWithShiftExtend(false, 32, x, s);
|
||||
DECLARE_printRegWithShiftExtend(false, 64, x, s);
|
||||
DECLARE_printRegWithShiftExtend(false, 128, x, 0);
|
||||
|
||||
void printCondCode(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
void printInverseCondCode(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
void printAlignedLabel(MCInst *MI, uint64_t Address, unsigned OpNum,
|
||||
SStream *O);
|
||||
void printUImm12Offset(MCInst *MI, unsigned OpNum, unsigned Scale, SStream *O);
|
||||
void printAMIndexedWB(MCInst *MI, unsigned OpNum, unsigned Scale, SStream *O);
|
||||
#define DEFINE_printUImm12Offset(Scale) \
|
||||
static inline void CONCAT(printUImm12Offset, Scale)( \
|
||||
MCInst * MI, unsigned OpNum, SStream *O) \
|
||||
{ \
|
||||
add_cs_detail(MI, \
|
||||
CONCAT(AArch64_OP_GROUP_UImm12Offset, Scale), \
|
||||
OpNum, Scale); \
|
||||
printUImm12Offset(MI, OpNum, Scale, O); \
|
||||
}
|
||||
DEFINE_printUImm12Offset(1);
|
||||
DEFINE_printUImm12Offset(8);
|
||||
DEFINE_printUImm12Offset(2);
|
||||
DEFINE_printUImm12Offset(16);
|
||||
DEFINE_printUImm12Offset(4);
|
||||
|
||||
void printAMNoIndex(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
#define DECLARE_printImmScale(Scale) \
|
||||
void CONCAT(printImmScale, Scale)(MCInst * MI, unsigned OpNum, \
|
||||
SStream *O);
|
||||
DECLARE_printImmScale(8);
|
||||
DECLARE_printImmScale(2);
|
||||
DECLARE_printImmScale(4);
|
||||
DECLARE_printImmScale(16);
|
||||
DECLARE_printImmScale(32);
|
||||
DECLARE_printImmScale(3);
|
||||
|
||||
#define DECLARE_printImmRangeScale(Scale, Offset) \
|
||||
void CONCAT(printImmRangeScale, CONCAT(Scale, Offset))( \
|
||||
MCInst * MI, unsigned OpNum, SStream *O);
|
||||
DECLARE_printImmRangeScale(2, 1);
|
||||
DECLARE_printImmRangeScale(4, 3);
|
||||
|
||||
#define DECLARE_printPrefetchOp(IsSVEPrefetch) \
|
||||
void CONCAT(printPrefetchOp, \
|
||||
IsSVEPrefetch)(MCInst * MI, unsigned OpNum, SStream *O);
|
||||
DECLARE_printPrefetchOp(true);
|
||||
DECLARE_printPrefetchOp(false);
|
||||
|
||||
void printRPRFMOperand(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
void printPSBHintOp(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
void printBTIHintOp(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
void printVectorList(MCInst *MI, unsigned OpNum, SStream *O,
|
||||
const char *LayoutSuffix);
|
||||
void printMatrixTileList(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
/// (i.e. attached to the instruction rather than the registers).
|
||||
/// Print a list of vector registers where the type suffix is implicit
|
||||
void printImplicitlyTypedVectorList(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
#define DECLARE_printTypedVectorList(NumLanes, LaneKind) \
|
||||
void CONCAT(printTypedVectorList, CONCAT(NumLanes, LaneKind))( \
|
||||
MCInst * MI, unsigned OpNum, SStream *O);
|
||||
DECLARE_printTypedVectorList(0, b);
|
||||
DECLARE_printTypedVectorList(0, d);
|
||||
DECLARE_printTypedVectorList(0, h);
|
||||
DECLARE_printTypedVectorList(0, s);
|
||||
DECLARE_printTypedVectorList(0, q);
|
||||
DECLARE_printTypedVectorList(16, b);
|
||||
DECLARE_printTypedVectorList(1, d);
|
||||
DECLARE_printTypedVectorList(2, d);
|
||||
DECLARE_printTypedVectorList(2, s);
|
||||
DECLARE_printTypedVectorList(4, h);
|
||||
DECLARE_printTypedVectorList(4, s);
|
||||
DECLARE_printTypedVectorList(8, b);
|
||||
DECLARE_printTypedVectorList(8, h);
|
||||
DECLARE_printTypedVectorList(0, 0);
|
||||
|
||||
#define DECLARE_printVectorIndex(Scale) \
|
||||
void CONCAT(printVectorIndex, Scale)(MCInst * MI, unsigned OpNum, \
|
||||
SStream *O);
|
||||
DECLARE_printVectorIndex(1);
|
||||
DECLARE_printVectorIndex(8);
|
||||
|
||||
void printAdrAdrpLabel(MCInst *MI, uint64_t Address, unsigned OpNum,
|
||||
SStream *O);
|
||||
void printBarrierOption(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
void printBarriernXSOption(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
void printMSRSystemRegister(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
void printMRSSystemRegister(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
void printSystemPStateField(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
void printSIMDType10Operand(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
#define DECLARE_printPredicateAsCounter(EltSize) \
|
||||
void CONCAT(printPredicateAsCounter, \
|
||||
EltSize)(MCInst * MI, unsigned OpNum, SStream *O);
|
||||
DECLARE_printPredicateAsCounter(8);
|
||||
DECLARE_printPredicateAsCounter(64);
|
||||
DECLARE_printPredicateAsCounter(16);
|
||||
DECLARE_printPredicateAsCounter(32);
|
||||
DECLARE_printPredicateAsCounter(0);
|
||||
|
||||
#define DECLARE_printGPRSeqPairsClassOperand(size) \
|
||||
void CONCAT(printGPRSeqPairsClassOperand, \
|
||||
size)(MCInst * MI, unsigned OpNum, SStream *O);
|
||||
DECLARE_printGPRSeqPairsClassOperand(32);
|
||||
DECLARE_printGPRSeqPairsClassOperand(64);
|
||||
|
||||
#define DECLARE_printImm8OptLsl(T) \
|
||||
void CONCAT(printImm8OptLsl, T)(MCInst * MI, unsigned OpNum, \
|
||||
SStream *O);
|
||||
DECLARE_printImm8OptLsl(int16_t);
|
||||
DECLARE_printImm8OptLsl(int8_t);
|
||||
DECLARE_printImm8OptLsl(int64_t);
|
||||
DECLARE_printImm8OptLsl(int32_t);
|
||||
DECLARE_printImm8OptLsl(uint16_t);
|
||||
DECLARE_printImm8OptLsl(uint8_t);
|
||||
DECLARE_printImm8OptLsl(uint64_t);
|
||||
DECLARE_printImm8OptLsl(uint32_t);
|
||||
|
||||
#define DECLARE_printSVELogicalImm(T) \
|
||||
void CONCAT(printSVELogicalImm, T)(MCInst * MI, unsigned OpNum, \
|
||||
SStream *O);
|
||||
DECLARE_printSVELogicalImm(int16_t);
|
||||
DECLARE_printSVELogicalImm(int32_t);
|
||||
DECLARE_printSVELogicalImm(int64_t);
|
||||
|
||||
void printSVEPattern(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
void printSVEVecLenSpecifier(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
#define DECLARE_printMatrixTileVector(IsVertical) \
|
||||
void CONCAT(printMatrixTileVector, \
|
||||
IsVertical)(MCInst * MI, unsigned OpNum, SStream *O);
|
||||
DECLARE_printMatrixTileVector(0);
|
||||
DECLARE_printMatrixTileVector(1);
|
||||
|
||||
void printMatrixTile(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
#define DECLARE_printMatrix(EltSize) \
|
||||
void CONCAT(printMatrix, EltSize)(MCInst * MI, unsigned OpNum, \
|
||||
SStream *O);
|
||||
DECLARE_printMatrix(64);
|
||||
DECLARE_printMatrix(32);
|
||||
DECLARE_printMatrix(16);
|
||||
DECLARE_printMatrix(0);
|
||||
|
||||
void printSVCROp(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
#define DECLARE_printSVERegOp(char) \
|
||||
void CONCAT(printSVERegOp, char)(MCInst * MI, unsigned OpNum, \
|
||||
SStream *O);
|
||||
DECLARE_printSVERegOp(b);
|
||||
DECLARE_printSVERegOp(d);
|
||||
DECLARE_printSVERegOp(h);
|
||||
DECLARE_printSVERegOp(s);
|
||||
DECLARE_printSVERegOp(0);
|
||||
DECLARE_printSVERegOp(q);
|
||||
|
||||
void printGPR64as32(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
void printGPR64x8(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
void printSyspXzrPair(MCInst *MI, unsigned OpNum, SStream *O);
|
||||
#define DECLARE_printZPRasFPR(Width) \
|
||||
void CONCAT(printZPRasFPR, Width)(MCInst * MI, unsigned OpNum, \
|
||||
SStream *O);
|
||||
DECLARE_printZPRasFPR(8);
|
||||
DECLARE_printZPRasFPR(64);
|
||||
DECLARE_printZPRasFPR(16);
|
||||
DECLARE_printZPRasFPR(32);
|
||||
DECLARE_printZPRasFPR(128);
|
||||
|
||||
#define DECLARE_printExactFPImm(ImmIs0, ImmIs1) \
|
||||
void CONCAT(printExactFPImm, CONCAT(ImmIs0, ImmIs1))( \
|
||||
MCInst * MI, unsigned OpNum, SStream *O);
|
||||
DECLARE_printExactFPImm(AArch64ExactFPImm_half, AArch64ExactFPImm_one);
|
||||
DECLARE_printExactFPImm(AArch64ExactFPImm_zero, AArch64ExactFPImm_one);
|
||||
DECLARE_printExactFPImm(AArch64ExactFPImm_half, AArch64ExactFPImm_two);
|
||||
|
||||
#define DECLARE_printMatrixIndex(Scale) \
|
||||
void CONCAT(printMatrixIndex, Scale)(MCInst * MI, unsigned OpNum, \
|
||||
SStream *O);
|
||||
DECLARE_printMatrixIndex(8);
|
||||
DECLARE_printMatrixIndex(0);
|
||||
DECLARE_printMatrixIndex(1);
|
||||
|
||||
// end namespace llvm
|
||||
|
||||
#endif // LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64INSTPRINTER_H
|
23
thirdparty/capstone/arch/AArch64/AArch64Linkage.h
vendored
Normal file
23
thirdparty/capstone/arch/AArch64/AArch64Linkage.h
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Rot127 <unisono@quyllur.org> 2022-2023 */
|
||||
|
||||
#ifndef CS_AARCH64_LINKAGE_H
|
||||
#define CS_AARCH64_LINKAGE_H
|
||||
|
||||
// Function definitions to call static LLVM functions.
|
||||
|
||||
#include "../../MCDisassembler.h"
|
||||
#include "../../MCInst.h"
|
||||
#include "../../MCRegisterInfo.h"
|
||||
#include "../../SStream.h"
|
||||
#include "capstone/capstone.h"
|
||||
|
||||
DecodeStatus AArch64_LLVM_getInstruction(csh handle, const uint8_t *Bytes,
|
||||
size_t ByteLen, MCInst *MI,
|
||||
uint16_t *Size, uint64_t Address,
|
||||
void *Info);
|
||||
const char *AArch64_LLVM_getRegisterName(unsigned RegNo, unsigned AltIdx);
|
||||
void AArch64_LLVM_printInstruction(MCInst *MI, SStream *O,
|
||||
void * /* MCRegisterInfo* */ info);
|
||||
|
||||
#endif // CS_AARCH64_LINKAGE_H
|
2899
thirdparty/capstone/arch/AArch64/AArch64Mapping.c
vendored
Normal file
2899
thirdparty/capstone/arch/AArch64/AArch64Mapping.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
82
thirdparty/capstone/arch/AArch64/AArch64Mapping.h
vendored
Normal file
82
thirdparty/capstone/arch/AArch64/AArch64Mapping.h
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
||||
|
||||
#ifndef CS_AARCH64_MAP_H
|
||||
#define CS_AARCH64_MAP_H
|
||||
|
||||
#include "capstone/capstone.h"
|
||||
#include "../../MCInst.h"
|
||||
#include "../../SStream.h"
|
||||
|
||||
typedef enum {
|
||||
#include "AArch64GenCSOpGroup.inc"
|
||||
} aarch64_op_group;
|
||||
|
||||
// return name of register in friendly string
|
||||
const char *AArch64_reg_name(csh handle, unsigned int reg);
|
||||
|
||||
// given internal insn id, return public instruction info
|
||||
void AArch64_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id);
|
||||
|
||||
const char *AArch64_insn_name(csh handle, unsigned int id);
|
||||
|
||||
const char *AArch64_group_name(csh handle, unsigned int id);
|
||||
|
||||
void AArch64_reg_access(const cs_insn *insn, cs_regs regs_read,
|
||||
uint8_t *regs_read_count, cs_regs regs_write,
|
||||
uint8_t *regs_write_count);
|
||||
|
||||
void AArch64_add_cs_detail(MCInst *MI, int /* aarch64_op_group */ op_group,
|
||||
va_list args);
|
||||
|
||||
static inline void add_cs_detail(MCInst *MI,
|
||||
int /* aarch64_op_group */ op_group, ...)
|
||||
{
|
||||
if (!MI->flat_insn->detail)
|
||||
return;
|
||||
va_list args;
|
||||
va_start(args, op_group);
|
||||
AArch64_add_cs_detail(MI, op_group, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void AArch64_init_mri(MCRegisterInfo *MRI);
|
||||
|
||||
void AArch64_init_cs_detail(MCInst *MI);
|
||||
|
||||
void AArch64_set_instr_map_data(MCInst *MI);
|
||||
|
||||
bool AArch64_getInstruction(csh handle, const uint8_t *code, size_t code_len,
|
||||
MCInst *instr, uint16_t *size, uint64_t address,
|
||||
void *info);
|
||||
|
||||
void AArch64_printer(MCInst *MI, SStream *O, void * /* MCRegisterInfo* */ info);
|
||||
|
||||
void AArch64_set_detail_op_reg(MCInst *MI, unsigned OpNum, aarch64_reg Reg);
|
||||
void AArch64_set_detail_op_imm(MCInst *MI, unsigned OpNum,
|
||||
aarch64_op_type ImmType, int64_t Imm);
|
||||
void AArch64_set_detail_op_imm_range(MCInst *MI, unsigned OpNum,
|
||||
uint32_t FirstImm, uint32_t offset);
|
||||
void AArch64_set_detail_op_mem(MCInst *MI, unsigned OpNum, uint64_t Val);
|
||||
void AArch64_set_detail_op_mem_offset(MCInst *MI, unsigned OpNum, uint64_t Val);
|
||||
void AArch64_set_detail_shift_ext(MCInst *MI, unsigned OpNum, bool SignExtend,
|
||||
bool DoShift, unsigned ExtWidth,
|
||||
char SrcRegKind);
|
||||
void AArch64_set_detail_op_float(MCInst *MI, unsigned OpNum, float Val);
|
||||
void AArch64_set_detail_op_sys(MCInst *MI, unsigned OpNum, aarch64_sysop sys_op,
|
||||
aarch64_op_type type);
|
||||
void AArch64_set_detail_op_sme(MCInst *MI, unsigned OpNum,
|
||||
aarch64_sme_op_part part,
|
||||
AArch64Layout_VectorLayout vas, ...);
|
||||
void AArch64_set_detail_op_pred(MCInst *MI, unsigned OpNum);
|
||||
void AArch64_insert_detail_op_reg_at(MCInst *MI, unsigned index,
|
||||
aarch64_reg Reg, cs_ac_type access);
|
||||
void AArch64_insert_detail_op_float_at(MCInst *MI, unsigned index, double val,
|
||||
cs_ac_type access);
|
||||
void AArch64_insert_detail_op_imm_at(MCInst *MI, unsigned index, int64_t Imm);
|
||||
void AArch64_insert_detail_op_sys(MCInst *MI, unsigned index, aarch64_sysop sys_op,
|
||||
aarch64_op_type type);
|
||||
void AArch64_insert_detail_op_sme(MCInst *MI, unsigned index, aarch64_op_sme sme_op);
|
||||
void AArch64_add_vas(MCInst *MI, const SStream *OS);
|
||||
|
||||
#endif
|
46
thirdparty/capstone/arch/AArch64/AArch64Module.c
vendored
Normal file
46
thirdparty/capstone/arch/AArch64/AArch64Module.c
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Dang Hoang Vu <danghvu@gmail.com> 2013 */
|
||||
|
||||
#ifdef CAPSTONE_HAS_AARCH64
|
||||
|
||||
#include "../../utils.h"
|
||||
#include "../../MCRegisterInfo.h"
|
||||
#include "AArch64InstPrinter.h"
|
||||
#include "AArch64Mapping.h"
|
||||
#include "AArch64Module.h"
|
||||
|
||||
cs_err AArch64_global_init(cs_struct *ud)
|
||||
{
|
||||
MCRegisterInfo *mri;
|
||||
mri = cs_mem_malloc(sizeof(*mri));
|
||||
|
||||
AArch64_init_mri(mri);
|
||||
ud->printer = AArch64_printer;
|
||||
ud->printer_info = mri;
|
||||
ud->getinsn_info = mri;
|
||||
ud->disasm = AArch64_getInstruction;
|
||||
ud->reg_name = AArch64_reg_name;
|
||||
ud->insn_id = AArch64_get_insn_id;
|
||||
ud->insn_name = AArch64_insn_name;
|
||||
ud->group_name = AArch64_group_name;
|
||||
ud->post_printer = NULL;
|
||||
#ifndef CAPSTONE_DIET
|
||||
ud->reg_access = AArch64_reg_access;
|
||||
#endif
|
||||
|
||||
return CS_ERR_OK;
|
||||
}
|
||||
|
||||
cs_err AArch64_option(cs_struct *handle, cs_opt_type type, size_t value)
|
||||
{
|
||||
if (type == CS_OPT_SYNTAX)
|
||||
handle->syntax |= (int)value;
|
||||
|
||||
if (type == CS_OPT_MODE) {
|
||||
handle->mode |= (cs_mode)value;
|
||||
}
|
||||
|
||||
return CS_ERR_OK;
|
||||
}
|
||||
|
||||
#endif
|
12
thirdparty/capstone/arch/AArch64/AArch64Module.h
vendored
Normal file
12
thirdparty/capstone/arch/AArch64/AArch64Module.h
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Travis Finkenauer <tmfinken@gmail.com>, 2018 */
|
||||
|
||||
#ifndef CS_AARCH64_MODULE_H
|
||||
#define CS_AARCH64_MODULE_H
|
||||
|
||||
#include "../../utils.h"
|
||||
|
||||
cs_err AArch64_global_init(cs_struct *ud);
|
||||
cs_err AArch64_option(cs_struct *handle, cs_opt_type type, size_t value);
|
||||
|
||||
#endif
|
113
thirdparty/capstone/arch/Alpha/AlphaDisassembler.c
vendored
Normal file
113
thirdparty/capstone/arch/Alpha/AlphaDisassembler.c
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Dmitry Sibirtsev <sibirtsevdl@gmail.com>, 2023 */
|
||||
|
||||
#ifdef CAPSTONE_HAS_ALPHA
|
||||
|
||||
#include <stdio.h> // DEBUG
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../../utils.h"
|
||||
|
||||
#include "../../MCFixedLenDisassembler.h"
|
||||
#include "../../Mapping.h"
|
||||
|
||||
#include "AlphaDisassembler.h"
|
||||
#include "AlphaLinkage.h"
|
||||
|
||||
static DecodeStatus DecodeGPRCRegisterClass(MCInst *Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
|
||||
static DecodeStatus DecodeF4RCRegisterClass(MCInst *Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
|
||||
static DecodeStatus DecodeF8RCRegisterClass(MCInst *Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder);
|
||||
|
||||
#include "AlphaGenDisassemblerTables.inc"
|
||||
|
||||
#define GET_REGINFO_ENUM
|
||||
#define GET_REGINFO_MC_DESC
|
||||
|
||||
#include "AlphaGenRegisterInfo.inc"
|
||||
|
||||
static DecodeStatus DecodeGPRCRegisterClass(MCInst *Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder)
|
||||
{
|
||||
if (RegNo > 31)
|
||||
return MCDisassembler_Fail;
|
||||
|
||||
unsigned Register = GPRC[RegNo];
|
||||
MCOperand_CreateReg0(Inst, (Register));
|
||||
return MCDisassembler_Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeF4RCRegisterClass(MCInst *Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder)
|
||||
{
|
||||
if (RegNo > 31)
|
||||
return MCDisassembler_Fail;
|
||||
|
||||
unsigned Register = F4RC[RegNo];
|
||||
MCOperand_CreateReg0(Inst, (Register));
|
||||
return MCDisassembler_Success;
|
||||
}
|
||||
|
||||
static DecodeStatus DecodeF8RCRegisterClass(MCInst *Inst, unsigned RegNo,
|
||||
uint64_t Address,
|
||||
const void *Decoder)
|
||||
{
|
||||
if (RegNo > 31)
|
||||
return MCDisassembler_Fail;
|
||||
|
||||
unsigned Register = F8RC[RegNo];
|
||||
MCOperand_CreateReg0(Inst, (Register));
|
||||
return MCDisassembler_Success;
|
||||
}
|
||||
|
||||
#define GET_SUBTARGETINFO_ENUM
|
||||
|
||||
#include "AlphaGenInstrInfo.inc"
|
||||
|
||||
DecodeStatus Alpha_LLVM_getInstruction(csh handle, const uint8_t *Bytes,
|
||||
size_t ByteLen, MCInst *MI,
|
||||
uint16_t *Size, uint64_t Address,
|
||||
void *Info)
|
||||
{
|
||||
if (!handle) {
|
||||
return MCDisassembler_Fail;
|
||||
}
|
||||
|
||||
if (ByteLen < 4) {
|
||||
*Size = 0;
|
||||
return MCDisassembler_Fail;
|
||||
}
|
||||
|
||||
uint32_t Insn = readBytes32(MI, Bytes);
|
||||
// Calling the auto-generated decoder function.
|
||||
DecodeStatus Result =
|
||||
decodeInstruction_4(DecoderTable32, MI, Insn, Address, NULL);
|
||||
|
||||
if (Result != MCDisassembler_Fail) {
|
||||
*Size = 4;
|
||||
return Result;
|
||||
}
|
||||
|
||||
*Size = 4;
|
||||
return MCDisassembler_Fail;
|
||||
}
|
||||
|
||||
void Alpha_init(MCRegisterInfo *MRI)
|
||||
{
|
||||
MCRegisterInfo_InitMCRegisterInfo(
|
||||
MRI, AlphaRegDesc, ARR_SIZE(AlphaRegDesc), 0, 0, AlphaMCRegisterClasses,
|
||||
ARR_SIZE(AlphaMCRegisterClasses), 0, 0, AlphaRegDiffLists, 0,
|
||||
AlphaSubRegIdxLists, 1, 0);
|
||||
}
|
||||
|
||||
#endif
|
18
thirdparty/capstone/arch/Alpha/AlphaDisassembler.h
vendored
Normal file
18
thirdparty/capstone/arch/Alpha/AlphaDisassembler.h
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/* Capstone Disassembly Engine */
|
||||
/* By Dmitry Sibirtsev <sibirtsevdl@gmail.com>, 2023 */
|
||||
|
||||
#ifndef CS_ALPHADISASSEMBLER_H
|
||||
#define CS_ALPHADISASSEMBLER_H
|
||||
|
||||
#if !defined(_MSC_VER) || !defined(_KERNEL_MODE)
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include "../../MCDisassembler.h"
|
||||
#include "../../MCInst.h"
|
||||
#include "../../MCRegisterInfo.h"
|
||||
#include <capstone/capstone.h>
|
||||
|
||||
void Alpha_init(MCRegisterInfo *MRI);
|
||||
|
||||
#endif // CS_ALPHADISASSEMBLER_H
|
1507
thirdparty/capstone/arch/Alpha/AlphaGenAsmWriter.inc
vendored
Normal file
1507
thirdparty/capstone/arch/Alpha/AlphaGenAsmWriter.inc
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3800
thirdparty/capstone/arch/Alpha/AlphaGenCSMappingInsn.inc
vendored
Normal file
3800
thirdparty/capstone/arch/Alpha/AlphaGenCSMappingInsn.inc
vendored
Normal file
File diff suppressed because it is too large
Load Diff
164
thirdparty/capstone/arch/Alpha/AlphaGenCSMappingInsnName.inc
vendored
Normal file
164
thirdparty/capstone/arch/Alpha/AlphaGenCSMappingInsnName.inc
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
/* Capstone Disassembly Engine, https://www.capstone-engine.org */
|
||||
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */
|
||||
/* Rot127 <unisono@quyllur.org> 2022-2023 */
|
||||
/* Automatically generated file by Capstone's LLVM TableGen Disassembler Backend. */
|
||||
|
||||
/* LLVM-commit: 083d57d0731afc1746680d828bdfe2fa41f62a61 */
|
||||
/* LLVM-tag: llvmorg-3.0.0-2-g083d57d0731a */
|
||||
|
||||
/* Do not edit. */
|
||||
|
||||
/* Capstone's LLVM TableGen Backends: */
|
||||
/* https://github.com/capstone-engine/llvm-capstone */
|
||||
|
||||
"invalid", // Alpha_INS_INVALID
|
||||
"addl", // Alpha_INS_ADDL
|
||||
"addq", // Alpha_INS_ADDQ
|
||||
"adds/su", // Alpha_INS_ADDSsSU
|
||||
"addt/su", // Alpha_INS_ADDTsSU
|
||||
"and", // Alpha_INS_AND
|
||||
"beq", // Alpha_INS_BEQ
|
||||
"bge", // Alpha_INS_BGE
|
||||
"bgt", // Alpha_INS_BGT
|
||||
"bic", // Alpha_INS_BIC
|
||||
"bis", // Alpha_INS_BIS
|
||||
"blbc", // Alpha_INS_BLBC
|
||||
"blbs", // Alpha_INS_BLBS
|
||||
"ble", // Alpha_INS_BLE
|
||||
"blt", // Alpha_INS_BLT
|
||||
"bne", // Alpha_INS_BNE
|
||||
"br", // Alpha_INS_BR
|
||||
"bsr", // Alpha_INS_BSR
|
||||
"cmoveq", // Alpha_INS_CMOVEQ
|
||||
"cmovge", // Alpha_INS_CMOVGE
|
||||
"cmovgt", // Alpha_INS_CMOVGT
|
||||
"cmovlbc", // Alpha_INS_CMOVLBC
|
||||
"cmovlbs", // Alpha_INS_CMOVLBS
|
||||
"cmovle", // Alpha_INS_CMOVLE
|
||||
"cmovlt", // Alpha_INS_CMOVLT
|
||||
"cmovne", // Alpha_INS_CMOVNE
|
||||
"cmpbge", // Alpha_INS_CMPBGE
|
||||
"cmpeq", // Alpha_INS_CMPEQ
|
||||
"cmple", // Alpha_INS_CMPLE
|
||||
"cmplt", // Alpha_INS_CMPLT
|
||||
"cmpteq/su", // Alpha_INS_CMPTEQsSU
|
||||
"cmptle/su", // Alpha_INS_CMPTLEsSU
|
||||
"cmptlt/su", // Alpha_INS_CMPTLTsSU
|
||||
"cmptun/su", // Alpha_INS_CMPTUNsSU
|
||||
"cmpule", // Alpha_INS_CMPULE
|
||||
"cmpult", // Alpha_INS_CMPULT
|
||||
"COND_BRANCH", // Alpha_INS_COND_BRANCH
|
||||
"cpyse", // Alpha_INS_CPYSE
|
||||
"cpysn", // Alpha_INS_CPYSN
|
||||
"cpys", // Alpha_INS_CPYS
|
||||
"ctlz", // Alpha_INS_CTLZ
|
||||
"ctpop", // Alpha_INS_CTPOP
|
||||
"cttz", // Alpha_INS_CTTZ
|
||||
"cvtqs/sui", // Alpha_INS_CVTQSsSUI
|
||||
"cvtqt/sui", // Alpha_INS_CVTQTsSUI
|
||||
"cvtst/s", // Alpha_INS_CVTSTsS
|
||||
"cvttq/svc", // Alpha_INS_CVTTQsSVC
|
||||
"cvtts/sui", // Alpha_INS_CVTTSsSUI
|
||||
"divs/su", // Alpha_INS_DIVSsSU
|
||||
"divt/su", // Alpha_INS_DIVTsSU
|
||||
"ecb", // Alpha_INS_ECB
|
||||
"eqv", // Alpha_INS_EQV
|
||||
"excb", // Alpha_INS_EXCB
|
||||
"extbl", // Alpha_INS_EXTBL
|
||||
"extlh", // Alpha_INS_EXTLH
|
||||
"extll", // Alpha_INS_EXTLL
|
||||
"extqh", // Alpha_INS_EXTQH
|
||||
"extql", // Alpha_INS_EXTQL
|
||||
"extwh", // Alpha_INS_EXTWH
|
||||
"extwl", // Alpha_INS_EXTWL
|
||||
"fbeq", // Alpha_INS_FBEQ
|
||||
"fbge", // Alpha_INS_FBGE
|
||||
"fbgt", // Alpha_INS_FBGT
|
||||
"fble", // Alpha_INS_FBLE
|
||||
"fblt", // Alpha_INS_FBLT
|
||||
"fbne", // Alpha_INS_FBNE
|
||||
"fcmoveq", // Alpha_INS_FCMOVEQ
|
||||
"fcmovge", // Alpha_INS_FCMOVGE
|
||||
"fcmovgt", // Alpha_INS_FCMOVGT
|
||||
"fcmovle", // Alpha_INS_FCMOVLE
|
||||
"fcmovlt", // Alpha_INS_FCMOVLT
|
||||
"fcmovne", // Alpha_INS_FCMOVNE
|
||||
"fetch", // Alpha_INS_FETCH
|
||||
"fetch_m", // Alpha_INS_FETCH_M
|
||||
"ftois", // Alpha_INS_FTOIS
|
||||
"ftoit", // Alpha_INS_FTOIT
|
||||
"insbl", // Alpha_INS_INSBL
|
||||
"inslh", // Alpha_INS_INSLH
|
||||
"insll", // Alpha_INS_INSLL
|
||||
"insqh", // Alpha_INS_INSQH
|
||||
"insql", // Alpha_INS_INSQL
|
||||
"inswh", // Alpha_INS_INSWH
|
||||
"inswl", // Alpha_INS_INSWL
|
||||
"itofs", // Alpha_INS_ITOFS
|
||||
"itoft", // Alpha_INS_ITOFT
|
||||
"jmp", // Alpha_INS_JMP
|
||||
"jsr", // Alpha_INS_JSR
|
||||
"jsr_coroutine", // Alpha_INS_JSR_COROUTINE
|
||||
"lda", // Alpha_INS_LDA
|
||||
"ldah", // Alpha_INS_LDAH
|
||||
"ldbu", // Alpha_INS_LDBU
|
||||
"ldl", // Alpha_INS_LDL
|
||||
"ldl_l", // Alpha_INS_LDL_L
|
||||
"ldq", // Alpha_INS_LDQ
|
||||
"ldq_l", // Alpha_INS_LDQ_L
|
||||
"ldq_u", // Alpha_INS_LDQ_U
|
||||
"lds", // Alpha_INS_LDS
|
||||
"ldt", // Alpha_INS_LDT
|
||||
"ldwu", // Alpha_INS_LDWU
|
||||
"mb", // Alpha_INS_MB
|
||||
"mskbl", // Alpha_INS_MSKBL
|
||||
"msklh", // Alpha_INS_MSKLH
|
||||
"mskll", // Alpha_INS_MSKLL
|
||||
"mskqh", // Alpha_INS_MSKQH
|
||||
"mskql", // Alpha_INS_MSKQL
|
||||
"mskwh", // Alpha_INS_MSKWH
|
||||
"mskwl", // Alpha_INS_MSKWL
|
||||
"mull", // Alpha_INS_MULL
|
||||
"mulq", // Alpha_INS_MULQ
|
||||
"muls/su", // Alpha_INS_MULSsSU
|
||||
"mult/su", // Alpha_INS_MULTsSU
|
||||
"ornot", // Alpha_INS_ORNOT
|
||||
"rc", // Alpha_INS_RC
|
||||
"ret", // Alpha_INS_RET
|
||||
"rpcc", // Alpha_INS_RPCC
|
||||
"rs", // Alpha_INS_RS
|
||||
"s4addl", // Alpha_INS_S4ADDL
|
||||
"s4addq", // Alpha_INS_S4ADDQ
|
||||
"s4subl", // Alpha_INS_S4SUBL
|
||||
"s4subq", // Alpha_INS_S4SUBQ
|
||||
"s8addl", // Alpha_INS_S8ADDL
|
||||
"s8addq", // Alpha_INS_S8ADDQ
|
||||
"s8subl", // Alpha_INS_S8SUBL
|
||||
"s8subq", // Alpha_INS_S8SUBQ
|
||||
"sextb", // Alpha_INS_SEXTB
|
||||
"sextw", // Alpha_INS_SEXTW
|
||||
"sll", // Alpha_INS_SLL
|
||||
"sqrts/su", // Alpha_INS_SQRTSsSU
|
||||
"sqrtt/su", // Alpha_INS_SQRTTsSU
|
||||
"sra", // Alpha_INS_SRA
|
||||
"srl", // Alpha_INS_SRL
|
||||
"stb", // Alpha_INS_STB
|
||||
"stl", // Alpha_INS_STL
|
||||
"stl_c", // Alpha_INS_STL_C
|
||||
"stq", // Alpha_INS_STQ
|
||||
"stq_c", // Alpha_INS_STQ_C
|
||||
"stq_u", // Alpha_INS_STQ_U
|
||||
"sts", // Alpha_INS_STS
|
||||
"stt", // Alpha_INS_STT
|
||||
"stw", // Alpha_INS_STW
|
||||
"subl", // Alpha_INS_SUBL
|
||||
"subq", // Alpha_INS_SUBQ
|
||||
"subs/su", // Alpha_INS_SUBSsSU
|
||||
"subt/su", // Alpha_INS_SUBTsSU
|
||||
"trapb", // Alpha_INS_TRAPB
|
||||
"umulh", // Alpha_INS_UMULH
|
||||
"wh64", // Alpha_INS_WH64
|
||||
"wh64en", // Alpha_INS_WH64EN
|
||||
"wmb", // Alpha_INS_WMB
|
||||
"xor", // Alpha_INS_XOR
|
||||
"zapnot", // Alpha_INS_ZAPNOT
|
2467
thirdparty/capstone/arch/Alpha/AlphaGenCSMappingInsnOp.inc
vendored
Normal file
2467
thirdparty/capstone/arch/Alpha/AlphaGenCSMappingInsnOp.inc
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user