diff --git a/Examples/DemoDll/DemoDll.vcxproj b/Examples/DemoDll/DemoDll.vcxproj
new file mode 100644
index 0000000..f826192
--- /dev/null
+++ b/Examples/DemoDll/DemoDll.vcxproj
@@ -0,0 +1,109 @@
+
+
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ {19B2E75C-385A-40BF-8FAE-2F5E1E24E2EC}
+ {1bc93793-694f-48fe-9372-81e2b05556fd}
+ v4.5
+ 12.0
+ Debug
+ Win32
+ DemoDrv
+ 10.0
+
+
+
+ Windows10
+ true
+ ClangCL
+ StaticLibrary
+ KMDF
+ Universal
+ false
+
+
+ Windows10
+ false
+ ClangCL
+ StaticLibrary
+ KMDF
+ Universal
+ false
+
+
+
+
+
+
+
+
+
+
+ DbgengKernelDebugger
+ false
+ $(IncludePath);$(KMDF_INC_PATH)$(KMDF_VER_PATH)
+ $(LLVMInstallDir)\bin;$(ExecutablePath);
+
+
+ DbgengKernelDebugger
+ false
+ $(SolutionDir)$(Platform)\$(Configuration)\
+ $(IncludePath);$(KMDF_INC_PATH)$(KMDF_VER_PATH)
+ $(LLVMInstallDir)\bin;$(ExecutablePath);
+
+
+
+ stdcpp17
+ false
+ false
+ false
+ -mcmodel=large -c %(AdditionalOptions)
+ false
+
+
+ DriverEntry
+
+
+
+
+ stdcpp17
+ false
+ Disabled
+ false
+ false
+ -mcmodel=large %(AdditionalOptions)
+ Async
+ true
+ false
+ Default
+ Default
+
+
+ DriverEntry
+
+
+ $(IntDir)ignore\$(MSBuildProjectName).log
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Examples/DemoDll/DemoDll.vcxproj.filters b/Examples/DemoDll/DemoDll.vcxproj.filters
new file mode 100644
index 0000000..102fcae
--- /dev/null
+++ b/Examples/DemoDll/DemoDll.vcxproj.filters
@@ -0,0 +1,22 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {92e25b44-aaeb-40a2-b8c9-7eab6c210e8d}
+
+
+
+
+ Header Files
+
+
+
+
+ Source Files
+
+
+
\ No newline at end of file
diff --git a/DemoDrv/DemoDrv.vcxproj.user b/Examples/DemoDll/DemoDll.vcxproj.user
similarity index 100%
rename from DemoDrv/DemoDrv.vcxproj.user
rename to Examples/DemoDll/DemoDll.vcxproj.user
diff --git a/DemoDrv/Theodosius.h b/Examples/DemoDll/Theodosius.h
similarity index 100%
rename from DemoDrv/Theodosius.h
rename to Examples/DemoDll/Theodosius.h
diff --git a/Examples/DemoDll/main.cpp b/Examples/DemoDll/main.cpp
new file mode 100644
index 0000000..6075d4c
--- /dev/null
+++ b/Examples/DemoDll/main.cpp
@@ -0,0 +1,28 @@
+#include "Theodosius.h"
+
+extern "C" int MessageBoxA(
+ unsigned hWnd,
+ char* lpText,
+ char* lpCaption,
+ unsigned uType
+);
+
+void UsermodeNoObfuscation()
+{
+ for (auto idx = 0u; idx < 5; ++idx)
+ MessageBoxA(0, "Demo", "Hello From Non-Obfuscated Routine!", 0);
+}
+
+MutateRoutine
+void UsermodeMutateDemo()
+{
+ MessageBoxA(0, "Demo", "Hello From Mutated Routine!", 0);
+}
+
+ObfuscateRoutine
+extern "C" int ModuleEntry()
+{
+ MessageBoxA(0, "Demo", "Hello From Obfuscated Routine!", 0);
+ UsermodeMutateDemo();
+ UsermodeNoObfuscation();
+}
\ No newline at end of file
diff --git a/DemoDrv/DemoDrv.vcxproj b/Examples/DemoDrv/DemoDrv.vcxproj
similarity index 98%
rename from DemoDrv/DemoDrv.vcxproj
rename to Examples/DemoDrv/DemoDrv.vcxproj
index a9c8224..938b631 100644
--- a/DemoDrv/DemoDrv.vcxproj
+++ b/Examples/DemoDrv/DemoDrv.vcxproj
@@ -25,7 +25,7 @@
Windows10trueClangCL
- DynamicLibrary
+ StaticLibraryKMDFUniversalfalse
diff --git a/DemoDrv/DemoDrv.vcxproj.filters b/Examples/DemoDrv/DemoDrv.vcxproj.filters
similarity index 100%
rename from DemoDrv/DemoDrv.vcxproj.filters
rename to Examples/DemoDrv/DemoDrv.vcxproj.filters
diff --git a/Examples/DemoDrv/DemoDrv.vcxproj.user b/Examples/DemoDrv/DemoDrv.vcxproj.user
new file mode 100644
index 0000000..88a5509
--- /dev/null
+++ b/Examples/DemoDrv/DemoDrv.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/DemoDrv/DriverEntry.cpp b/Examples/DemoDrv/DriverEntry.cpp
similarity index 100%
rename from DemoDrv/DriverEntry.cpp
rename to Examples/DemoDrv/DriverEntry.cpp
diff --git a/Examples/DemoDrv/Theodosius.h b/Examples/DemoDrv/Theodosius.h
new file mode 100644
index 0000000..a1d30bc
--- /dev/null
+++ b/Examples/DemoDrv/Theodosius.h
@@ -0,0 +1,3 @@
+#pragma once
+#define ObfuscateRoutine __declspec(code_seg(".theo"), noinline)
+#define MutateRoutine __declspec(code_seg(".theo1"), noinline)
\ No newline at end of file
diff --git a/DemoDrv/Types.h b/Examples/DemoDrv/Types.h
similarity index 100%
rename from DemoDrv/Types.h
rename to Examples/DemoDrv/Types.h
diff --git a/Examples/Theodosius-Examples.sln b/Examples/Theodosius-Examples.sln
new file mode 100644
index 0000000..96cc6c6
--- /dev/null
+++ b/Examples/Theodosius-Examples.sln
@@ -0,0 +1,43 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30907.101
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DemoDll", "DemoDll\DemoDll.vcxproj", "{19B2E75C-385A-40BF-8FAE-2F5E1E24E2EC}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DemoDrv", "DemoDrv\DemoDrv.vcxproj", "{A9959D7F-E405-4380-A1B4-4CE8DD929397}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Theodosius-VDM", "Theodosius-Kernel\Theodosius-VDM\Theodosius-VDM.vcxproj", "{B3A57EE2-364D-42FA-A827-33F43136B549}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Theodosius-MSREXEC", "Theodosius-Kernel\Theodosius-MSREXEC\Theodosius-MSREXEC.vcxproj", "{0043C2E6-7080-4363-BD50-298A4C51562F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {19B2E75C-385A-40BF-8FAE-2F5E1E24E2EC}.Debug|x64.ActiveCfg = Debug|x64
+ {19B2E75C-385A-40BF-8FAE-2F5E1E24E2EC}.Debug|x64.Build.0 = Debug|x64
+ {19B2E75C-385A-40BF-8FAE-2F5E1E24E2EC}.Release|x64.ActiveCfg = Release|x64
+ {19B2E75C-385A-40BF-8FAE-2F5E1E24E2EC}.Release|x64.Build.0 = Release|x64
+ {A9959D7F-E405-4380-A1B4-4CE8DD929397}.Debug|x64.ActiveCfg = Debug|x64
+ {A9959D7F-E405-4380-A1B4-4CE8DD929397}.Debug|x64.Build.0 = Debug|x64
+ {A9959D7F-E405-4380-A1B4-4CE8DD929397}.Release|x64.ActiveCfg = Release|x64
+ {A9959D7F-E405-4380-A1B4-4CE8DD929397}.Release|x64.Build.0 = Release|x64
+ {B3A57EE2-364D-42FA-A827-33F43136B549}.Debug|x64.ActiveCfg = Debug|x64
+ {B3A57EE2-364D-42FA-A827-33F43136B549}.Debug|x64.Build.0 = Debug|x64
+ {B3A57EE2-364D-42FA-A827-33F43136B549}.Release|x64.ActiveCfg = Release|x64
+ {B3A57EE2-364D-42FA-A827-33F43136B549}.Release|x64.Build.0 = Release|x64
+ {0043C2E6-7080-4363-BD50-298A4C51562F}.Debug|x64.ActiveCfg = Debug|x64
+ {0043C2E6-7080-4363-BD50-298A4C51562F}.Debug|x64.Build.0 = Debug|x64
+ {0043C2E6-7080-4363-BD50-298A4C51562F}.Release|x64.ActiveCfg = Release|x64
+ {0043C2E6-7080-4363-BD50-298A4C51562F}.Release|x64.Build.0 = Release|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {4E9E0E63-4158-4F7F-A1A9-B81A0C57E1D1}
+ EndGlobalSection
+EndGlobal
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Theodosius-MSREXEC.vcxproj b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Theodosius-MSREXEC.vcxproj
new file mode 100644
index 0000000..48f8190
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Theodosius-MSREXEC.vcxproj
@@ -0,0 +1,278 @@
+
+
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {0043C2E6-7080-4363-BD50-298A4C51562F}
+ Theodosius
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(ProjectDir);$(IncludePath)
+
+
+ false
+ $(ProjectDir);$(IncludePath)
+
+
+
+ Level3
+ true
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions);ZYAN_NO_LIBC;ZYDIS_NO_LIBC;ZYCORE_STATIC_DEFINE;ZYDIS_STATIC_DEFINE;_CRT_SECURE_NO_WARNINGS
+ true
+ stdcpp17
+
+
+ Console
+ true
+ Zydis.lib;Zycore.lib;%(AdditionalDependencies)
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions);ZYAN_NO_LIBC;ZYDIS_NO_LIBC;ZYCORE_STATIC_DEFINE;ZYDIS_STATIC_DEFINE;_CRT_SECURE_NO_WARNINGS
+ true
+ stdcpp17
+
+
+ Console
+ true
+ true
+ true
+ Zydis.lib;Zycore.lib;%(AdditionalDependencies)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Document
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Theodosius-MSREXEC.vcxproj.filters b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Theodosius-MSREXEC.vcxproj.filters
new file mode 100644
index 0000000..d9502c7
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Theodosius-MSREXEC.vcxproj.filters
@@ -0,0 +1,589 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {8d07ce7e-3b56-4b27-bb05-d12987f22384}
+
+
+ {77c3f715-9d9f-488e-a1d5-542124a490b0}
+
+
+ {c89c1fbb-39b5-4954-9774-0c2600773705}
+
+
+ {db8b5110-ec16-4fc2-80cc-7241ccbfec1c}
+
+
+ {c51e3b93-1496-49d7-838f-825d75b29ee6}
+
+
+ {d28d9202-4139-42a0-9f49-71beb5e01670}
+
+
+ {a847dc8c-08a3-4ea7-a20d-157963dd41a8}
+
+
+ {706001e9-56f5-41d2-b209-9f5543d0bd11}
+
+
+ {a8e52093-e1b2-4ef3-b427-ebea8772bbbf}
+
+
+ {da6ded33-7d62-4f83-b8e7-4d343fe49cd7}
+
+
+ {244a52bf-80cb-43ac-ac0d-a6aad89b9eb0}
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\core
+
+
+ Source Files\asmjit\x86
+
+
+ Source Files\asmjit\x86
+
+
+ Source Files\asmjit\x86
+
+
+ Source Files\asmjit\x86
+
+
+ Source Files\asmjit\x86
+
+
+ Source Files\asmjit\x86
+
+
+ Source Files\asmjit\x86
+
+
+ Source Files\asmjit\x86
+
+
+ Source Files\asmjit\x86
+
+
+ Source Files\asmjit\x86
+
+
+ Source Files\asmjit\x86
+
+
+ Source Files
+
+
+ Source Files
+
+
+
+
+ Header Files\Zydis\Generated
+
+
+ Header Files\Zydis\Generated
+
+
+ Header Files\Zydis\Generated
+
+
+ Header Files\Zydis\Generated
+
+
+ Header Files\Zydis\Generated
+
+
+ Header Files\Zydis\Internal
+
+
+ Header Files\Zydis\Internal
+
+
+ Header Files\Zydis\Internal
+
+
+ Header Files\Zydis\Internal
+
+
+ Header Files\Zydis\Internal
+
+
+ Header Files\Zydis\Internal
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files\Zydis
+
+
+ Header Files\Zydis
+
+
+ Header Files\Zydis
+
+
+ Header Files\Zydis
+
+
+ Header Files\Zydis
+
+
+ Header Files\Zydis
+
+
+ Header Files\Zydis
+
+
+ Header Files\Zydis
+
+
+ Header Files\Zydis
+
+
+ Header Files\Zydis
+
+
+ Header Files\Zydis
+
+
+ Header Files\Zydis
+
+
+ Header Files\Zycore
+
+
+ Header Files\Zycore
+
+
+ Header Files\Zycore
+
+
+ Header Files\Zycore
+
+
+ Header Files\Zycore
+
+
+ Header Files\Zycore
+
+
+ Header Files\Zycore
+
+
+ Header Files\Zycore
+
+
+ Header Files\Zycore
+
+
+ Header Files\Zycore
+
+
+ Header Files\Zycore
+
+
+ Header Files\Zycore
+
+
+ Header Files\Zycore
+
+
+ Header Files\Zycore
+
+
+ Header Files\Zycore\API
+
+
+ Header Files\Zycore\API
+
+
+ Header Files\Zycore\API
+
+
+ Header Files\Zycore\API
+
+
+ Header Files\Zycore\API
+
+
+ Header Files\Zydis
+
+
+ Header Files\Zycore
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files\asmjit
+
+
+ Header Files\asmjit
+
+
+ Header Files\asmjit
+
+
+ Header Files\asmjit
+
+
+ Header Files\asmjit
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\core
+
+
+ Header Files\asmjit\x86
+
+
+ Header Files\asmjit\x86
+
+
+ Header Files\asmjit\x86
+
+
+ Header Files\asmjit\x86
+
+
+ Header Files\asmjit\x86
+
+
+ Header Files\asmjit\x86
+
+
+ Header Files\asmjit\x86
+
+
+ Header Files\asmjit\x86
+
+
+ Header Files\asmjit\x86
+
+
+ Header Files\asmjit\x86
+
+
+ Header Files\asmjit\x86
+
+
+ Header Files\asmjit\x86
+
+
+ Header Files\asmjit\x86
+
+
+ Header Files\asmjit\x86
+
+
+ Header Files\asmjit\x86
+
+
+ Header Files\asmjit\x86
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+
+
+ Source Files
+
+
+
\ No newline at end of file
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Theodosius-MSREXEC.vcxproj.user b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Theodosius-MSREXEC.vcxproj.user
new file mode 100644
index 0000000..e9f3ec8
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Theodosius-MSREXEC.vcxproj.user
@@ -0,0 +1,13 @@
+
+
+
+
+
+ WindowsLocalDebugger
+
+
+
+
+ WindowsLocalDebugger
+
+
\ No newline at end of file
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore.lib b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore.lib
new file mode 100644
index 0000000..b36a938
Binary files /dev/null and b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore.lib differ
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/API/Memory.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/API/Memory.h
new file mode 100644
index 0000000..c5fa8a9
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/API/Memory.h
@@ -0,0 +1,134 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zycore-C)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * @brief
+ */
+
+#ifndef ZYCORE_API_MEMORY_H
+#define ZYCORE_API_MEMORY_H
+
+#include
+#include
+#include
+#include
+
+#if defined(ZYAN_WINDOWS)
+# include
+#elif defined(ZYAN_POSIX)
+# include
+#else
+# error "Unsupported platform detected"
+#endif
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+/**
+ * Defines the `ZyanMemoryPageProtection` enum.
+ */
+typedef enum ZyanMemoryPageProtection_
+{
+#if defined(ZYAN_WINDOWS)
+
+ ZYAN_PAGE_READONLY = PAGE_READONLY,
+ ZYAN_PAGE_READWRITE = PAGE_READWRITE,
+ ZYAN_PAGE_EXECUTE = PAGE_EXECUTE,
+ ZYAN_PAGE_EXECUTE_READ = PAGE_EXECUTE_READ,
+ ZYAN_PAGE_EXECUTE_READWRITE = PAGE_EXECUTE_READWRITE
+
+#elif defined(ZYAN_POSIX)
+
+ ZYAN_PAGE_READONLY = PROT_READ,
+ ZYAN_PAGE_READWRITE = PROT_READ | PROT_WRITE,
+ ZYAN_PAGE_EXECUTE = PROT_EXEC,
+ ZYAN_PAGE_EXECUTE_READ = PROT_EXEC | PROT_READ,
+ ZYAN_PAGE_EXECUTE_READWRITE = PROT_EXEC | PROT_READ | PROT_WRITE
+
+#endif
+} ZyanMemoryPageProtection;
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* General */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the system page size.
+ *
+ * @return The system page size.
+ */
+ZYCORE_EXPORT ZyanU32 ZyanMemoryGetSystemPageSize();
+
+/**
+ * Returns the system allocation granularity.
+ *
+ * The system allocation granularity specifies the minimum amount of bytes which can be allocated
+ * at a specific address by a single call of `ZyanMemoryVirtualAlloc`.
+ *
+ * This value is typically 64KiB on Windows systems and equal to the page size on most POSIX
+ * platforms.
+ *
+ * @return The system allocation granularity.
+ */
+ZYCORE_EXPORT ZyanU32 ZyanMemoryGetSystemAllocationGranularity();
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Memory management */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Changes the memory protection value of one or more pages.
+ *
+ * @param address The start address aligned to a page boundary.
+ * @param size The size.
+ * @param protection The new page protection value.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanMemoryVirtualProtect(void* address, ZyanUSize size,
+ ZyanMemoryPageProtection protection);
+
+/**
+ * Releases one or more memory pages starting at the given address.
+ *
+ * @param address The start address aligned to a page boundary.
+ * @param size The size.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanMemoryVirtualFree(void* address, ZyanUSize size);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#endif /* ZYCORE_API_MEMORY_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/API/Process.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/API/Process.h
new file mode 100644
index 0000000..0b6a5c6
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/API/Process.h
@@ -0,0 +1,67 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zycore-C)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * @brief
+ */
+
+#ifndef ZYCORE_API_PROCESS_H
+#define ZYCORE_API_PROCESS_H
+
+#include
+#include
+#include
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* General */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * @brief Flushes the process instruction cache.
+ *
+ * @param address The address.
+ * @param size The size.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanProcessFlushInstructionCache(void* address, ZyanUSize size);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#endif /* ZYCORE_API_PROCESS_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/API/Synchronization.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/API/Synchronization.h
new file mode 100644
index 0000000..8414a44
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/API/Synchronization.h
@@ -0,0 +1,133 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zycore-C)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * @brief
+ */
+
+#ifndef ZYCORE_API_SYNCHRONIZATION_H
+#define ZYCORE_API_SYNCHRONIZATION_H
+
+#ifndef ZYAN_NO_LIBC
+
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+#if defined(ZYAN_POSIX)
+
+#include
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Critical Section */
+/* ---------------------------------------------------------------------------------------------- */
+
+typedef pthread_mutex_t ZyanCriticalSection;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+#elif defined(ZYAN_WINDOWS)
+
+#include
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Critical Section */
+/* ---------------------------------------------------------------------------------------------- */
+
+typedef CRITICAL_SECTION ZyanCriticalSection;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+#else
+# error "Unsupported platform detected"
+#endif
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Critical Section */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Initializes a critical section.
+ *
+ * @param critical_section A pointer to the `ZyanCriticalSection` struct.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanCriticalSectionInitialize(ZyanCriticalSection* critical_section);
+
+/**
+ * Enters a critical section.
+ *
+ * @param critical_section A pointer to the `ZyanCriticalSection` struct.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanCriticalSectionEnter(ZyanCriticalSection* critical_section);
+
+/**
+ * Tries to enter a critical section.
+ *
+ * @param critical_section A pointer to the `ZyanCriticalSection` struct.
+ *
+ * @return Returns `ZYAN_TRUE` if the critical section was successfully entered or `ZYAN_FALSE`,
+ * if not.
+ */
+ZYCORE_EXPORT ZyanBool ZyanCriticalSectionTryEnter(ZyanCriticalSection* critical_section);
+
+/**
+ * Leaves a critical section.
+ *
+ * @param critical_section A pointer to the `ZyanCriticalSection` struct.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanCriticalSectionLeave(ZyanCriticalSection* critical_section);
+
+/**
+ * Deletes a critical section.
+ *
+ * @param critical_section A pointer to the `ZyanCriticalSection` struct.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanCriticalSectionDelete(ZyanCriticalSection* critical_section);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYAN_NO_LIBC */
+
+#endif /* ZYCORE_API_SYNCHRONIZATION_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/API/Terminal.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/API/Terminal.h
new file mode 100644
index 0000000..17dc384
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/API/Terminal.h
@@ -0,0 +1,163 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zycore-C)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file Provides cross-platform terminal helper functions.
+ * @brief
+ */
+
+#ifndef ZYCORE_API_TERMINAL_H
+#define ZYCORE_API_TERMINAL_H
+
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef ZYAN_NO_LIBC
+
+/* ============================================================================================== */
+/* VT100 CSI SGR sequences */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* General */
+/* ---------------------------------------------------------------------------------------------- */
+
+#define ZYAN_VT100SGR_RESET "\033[0m"
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Foreground colors */
+/* ---------------------------------------------------------------------------------------------- */
+
+#define ZYAN_VT100SGR_FG_DEFAULT "\033[39m"
+
+#define ZYAN_VT100SGR_FG_BLACK "\033[30m"
+#define ZYAN_VT100SGR_FG_RED "\033[31m"
+#define ZYAN_VT100SGR_FG_GREEN "\033[32m"
+#define ZYAN_VT100SGR_FG_YELLOW "\033[33m"
+#define ZYAN_VT100SGR_FG_BLUE "\033[34m"
+#define ZYAN_VT100SGR_FG_MAGENTA "\033[35m"
+#define ZYAN_VT100SGR_FG_CYAN "\033[36m"
+#define ZYAN_VT100SGR_FG_WHITE "\033[37m"
+#define ZYAN_VT100SGR_FG_BRIGHT_BLACK "\033[90m"
+#define ZYAN_VT100SGR_FG_BRIGHT_RED "\033[91m"
+#define ZYAN_VT100SGR_FG_BRIGHT_GREEN "\033[92m"
+#define ZYAN_VT100SGR_FG_BRIGHT_YELLOW "\033[93m"
+#define ZYAN_VT100SGR_FG_BRIGHT_BLUE "\033[94m"
+#define ZYAN_VT100SGR_FG_BRIGHT_MAGENTA "\033[95m"
+#define ZYAN_VT100SGR_FG_BRIGHT_CYAN "\033[96m"
+#define ZYAN_VT100SGR_FG_BRIGHT_WHITE "\033[97m"
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Background color */
+/* ---------------------------------------------------------------------------------------------- */
+
+#define ZYAN_VT100SGR_BG_DEFAULT "\033[49m"
+
+#define ZYAN_VT100SGR_BG_BLACK "\033[40m"
+#define ZYAN_VT100SGR_BG_RED "\033[41m"
+#define ZYAN_VT100SGR_BG_GREEN "\033[42m"
+#define ZYAN_VT100SGR_BG_YELLOW "\033[43m"
+#define ZYAN_VT100SGR_BG_BLUE "\033[44m"
+#define ZYAN_VT100SGR_BG_MAGENTA "\033[45m"
+#define ZYAN_VT100SGR_BG_CYAN "\033[46m"
+#define ZYAN_VT100SGR_BG_WHITE "\033[47m"
+#define ZYAN_VT100SGR_BG_BRIGHT_BLACK "\033[100m"
+#define ZYAN_VT100SGR_BG_BRIGHT_RED "\033[101m"
+#define ZYAN_VT100SGR_BG_BRIGHT_GREEN "\033[102m"
+#define ZYAN_VT100SGR_BG_BRIGHT_YELLOW "\033[103m"
+#define ZYAN_VT100SGR_BG_BRIGHT_BLUE "\033[104m"
+#define ZYAN_VT100SGR_BG_BRIGHT_MAGENTA "\033[105m"
+#define ZYAN_VT100SGR_BG_BRIGHT_CYAN "\033[106m"
+#define ZYAN_VT100SGR_BG_BRIGHT_WHITE "\033[107m"
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+/**
+ * Declares the `ZyanStandardStream` enum.
+ */
+typedef enum ZyanStandardStream_
+{
+ /**
+ * The default input stream.
+ */
+ ZYAN_STDSTREAM_IN,
+ /**
+ * The default output stream.
+ */
+ ZYAN_STDSTREAM_OUT,
+ /**
+ * The default error stream.
+ */
+ ZYAN_STDSTREAM_ERR
+} ZyanStandardStream;
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/**
+ * Enables VT100 ansi escape codes for the given stream.
+ *
+ * @param stream Either `ZYAN_STDSTREAM_OUT` or `ZYAN_STDSTREAM_ERR`.
+ *
+ * @return A zyan status code.
+ *
+ * This functions returns `ZYAN_STATUS_SUCCESS` on all non-Windows systems without performing any
+ * operations, assuming that VT100 is supported by default.
+ *
+ * On Windows systems, VT100 functionality is only supported on Windows 10 build 1607 (anniversary
+ * update) and later.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanTerminalEnableVT100(ZyanStandardStream stream);
+
+/**
+ * Checks, if the given standard stream reads from or writes to a terminal.
+ *
+ * @param stream The standard stream to check.
+ *
+ * @return `ZYAN_STATUS_TRUE`, if the stream is bound to a terminal, `ZYAN_STATUS_FALSE` if not,
+ * or another zyan status code if an error occured.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanTerminalIsTTY(ZyanStandardStream stream);
+
+/* ============================================================================================== */
+
+#endif // ZYAN_NO_LIBC
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYCORE_API_TERMINAL_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/API/Thread.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/API/Thread.h
new file mode 100644
index 0000000..b1ec085
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/API/Thread.h
@@ -0,0 +1,244 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zycore-C)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * @brief
+ */
+
+#ifndef ZYCORE_API_THREAD_H
+#define ZYCORE_API_THREAD_H
+
+#ifndef ZYAN_NO_LIBC
+
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+#if defined(ZYAN_POSIX)
+
+#include
+
+/* ---------------------------------------------------------------------------------------------- */
+/* General */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZyanThread` data-type.
+ */
+typedef pthread_t ZyanThread;
+
+/**
+ * Defines the `ZyanThreadId` data-type.
+ */
+typedef ZyanU64 ZyanThreadId;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Thread Local Storage (TLS) */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZyanThreadTlsIndex` data-type.
+ */
+typedef pthread_key_t ZyanThreadTlsIndex;
+
+/**
+ * Defines the `ZyanThreadTlsCallback` function prototype.
+ */
+typedef void(*ZyanThreadTlsCallback)(void* data);
+
+/**
+ * Declares a Thread Local Storage (TLS) callback function.
+ *
+ * @param name The callback function name.
+ * @param param_type The callback data parameter type.
+ * @param param_name The callback data parameter name.
+ */
+#define ZYAN_THREAD_DECLARE_TLS_CALLBACK(name, param_type, param_name) \
+ void name(param_type* param_name)
+
+/* ---------------------------------------------------------------------------------------------- */
+
+#elif defined(ZYAN_WINDOWS)
+
+#include
+
+/* ---------------------------------------------------------------------------------------------- */
+/* General */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZyanThread` data-type.
+ */
+typedef HANDLE ZyanThread;
+
+/**
+ * Defines the `ZyanThreadId` data-type.
+ */
+typedef DWORD ZyanThreadId;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Thread Local Storage (TLS) */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZyanThreadTlsIndex` data-type.
+ */
+typedef DWORD ZyanThreadTlsIndex;
+
+/**
+ * Defines the `ZyanThreadTlsCallback` function prototype.
+ */
+typedef PFLS_CALLBACK_FUNCTION ZyanThreadTlsCallback;
+
+/**
+ * Declares a Thread Local Storage (TLS) callback function.
+ *
+ * @param name The callback function name.
+ * @param param_type The callback data parameter type.
+ * @param param_name The callback data parameter name.
+ */
+#define ZYAN_THREAD_DECLARE_TLS_CALLBACK(name, param_type, param_name) \
+ VOID NTAPI name(param_type* param_name)
+
+/* ---------------------------------------------------------------------------------------------- */
+
+#else
+# error "Unsupported platform detected"
+#endif
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* General */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the handle of the current thread.
+ *
+ * @param thread Receives the handle of the current thread.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanThreadGetCurrentThread(ZyanThread* thread);
+
+/**
+ * Returns the unique id of the current thread.
+ *
+ * @param thread_id Receives the unique id of the current thread.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanThreadGetCurrentThreadId(ZyanThreadId* thread_id);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Thread Local Storage (TLS) */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Allocates a new Thread Local Storage (TLS) slot.
+ *
+ * @param index Receives the TLS slot index.
+ * @param destructor A pointer to a destructor callback which is invoked to finalize the data
+ * in the TLS slot or `ZYAN_NULL`, if not needed.
+ *
+ * The maximum available number of TLS slots is implementation specific and different on each
+ * platform:
+ * - Windows
+ * - A total amount of 128 slots per process are guaranteed
+ * - POSIX
+ * - A total amount of 128 slots per process are guaranteed
+ * - Some systems guarantee larger amounts like e.g. 1024 slots per process
+ *
+ * Note that the invocation rules for the destructor callback are implementation specific and
+ * different on each platform:
+ * - Windows
+ * - The callback is invoked when a thread exits
+ * - The callback is invoked when the process exits
+ * - The callback is invoked when the TLS slot is released
+ * - POSIX
+ * - The callback is invoked when a thread exits and the stored value is not null
+ * - The callback is NOT invoked when the process exits
+ * - The callback is NOT invoked when the TLS slot is released
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanThreadTlsAlloc(ZyanThreadTlsIndex* index,
+ ZyanThreadTlsCallback destructor);
+
+/**
+ * Releases a Thread Local Storage (TLS) slot.
+ *
+ * @param index The TLS slot index.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanThreadTlsFree(ZyanThreadTlsIndex index);
+
+/**
+ * Returns the value inside the given Thread Local Storage (TLS) slot for the
+ * calling thread.
+ *
+ * @param index The TLS slot index.
+ * @param data Receives the value inside the given Thread Local Storage
+ * (TLS) slot for the calling thread.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanThreadTlsGetValue(ZyanThreadTlsIndex index, void** data);
+
+/**
+ * Set the value of the given Thread Local Storage (TLS) slot for the calling thread.
+ *
+ * @param index The TLS slot index.
+ * @param data The value to store inside the given Thread Local Storage (TLS) slot for the
+ * calling thread
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanThreadTlsSetValue(ZyanThreadTlsIndex index, void* data);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYAN_NO_LIBC */
+
+#endif /* ZYCORE_API_THREAD_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Allocator.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Allocator.h
new file mode 100644
index 0000000..6435171
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Allocator.h
@@ -0,0 +1,143 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zycore-C)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * @brief
+ */
+
+#ifndef ZYCORE_ALLOCATOR_H
+#define ZYCORE_ALLOCATOR_H
+
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+struct ZyanAllocator_;
+
+/**
+ * Defines the `ZyanAllocatorAllocate` function prototype.
+ *
+ * @param allocator A pointer to the `ZyanAllocator` instance.
+ * @param p Receives a pointer to the first memory block sufficient to hold an
+ * array of `n` elements with a size of `element_size`.
+ * @param element_size The size of a single element.
+ * @param n The number of elements to allocate storage for.
+ *
+ * @return A zyan status code.
+ *
+ * This prototype is used for the `allocate()` and `reallocate()` functions.
+ *
+ * The result of the `reallocate()` function is undefined, if `p` does not point to a memory block
+ * previously obtained by `(re-)allocate()`.
+ */
+typedef ZyanStatus (*ZyanAllocatorAllocate)(struct ZyanAllocator_* allocator, void** p,
+ ZyanUSize element_size, ZyanUSize n);
+
+/**
+ * Defines the `ZyanAllocatorDeallocate` function prototype.
+ *
+ * @param allocator A pointer to the `ZyanAllocator` instance.
+ * @param p The pointer obtained from `(re-)allocate()`.
+ * @param element_size The size of a single element.
+ * @param n The number of elements earlier passed to `(re-)allocate()`.
+ *
+ * @return A zyan status code.
+ */
+typedef ZyanStatus (*ZyanAllocatorDeallocate)(struct ZyanAllocator_* allocator, void* p,
+ ZyanUSize element_size, ZyanUSize n);
+
+/**
+ * Defines the `ZyanAllocator` struct.
+ *
+ * This is the base class for all custom allocator implementations.
+ *
+ * All fields in this struct should be considered as "private". Any changes may lead to unexpected
+ * behavior.
+ */
+typedef struct ZyanAllocator_
+{
+ /**
+ * The allocate function.
+ */
+ ZyanAllocatorAllocate allocate;
+ /**
+ * The reallocate function.
+ */
+ ZyanAllocatorAllocate reallocate;
+ /**
+ * The deallocate function.
+ */
+ ZyanAllocatorDeallocate deallocate;
+} ZyanAllocator;
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/**
+ * Initializes the given `ZyanAllocator` instance.
+ *
+ * @param allocator A pointer to the `ZyanAllocator` instance.
+ * @param allocate The allocate function.
+ * @param reallocate The reallocate function.
+ * @param deallocate The deallocate function.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanAllocatorInit(ZyanAllocator* allocator, ZyanAllocatorAllocate allocate,
+ ZyanAllocatorAllocate reallocate, ZyanAllocatorDeallocate deallocate);
+
+#ifndef ZYAN_NO_LIBC
+
+/**
+ * Returns the default `ZyanAllocator` instance.
+ *
+ * @return A pointer to the default `ZyanAllocator` instance.
+ *
+ * The default allocator uses the default memory manager to allocate memory on the heap.
+ *
+ * You should in no case modify the returned allocator instance to avoid unexpected behavior.
+ */
+ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanAllocator* ZyanAllocatorDefault(void);
+
+#endif // ZYAN_NO_LIBC
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYCORE_ALLOCATOR_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/ArgParse.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/ArgParse.h
new file mode 100644
index 0000000..5d389cb
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/ArgParse.h
@@ -0,0 +1,173 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zycore-C)
+
+ Original Author : Joel Hoener
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Implements command-line argument parsing.
+ */
+
+#ifndef ZYCORE_ARGPARSE_H
+#define ZYCORE_ARGPARSE_H
+
+#include
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Structs and other types */
+/* ============================================================================================== */
+
+/**
+ * Definition of a single argument.
+ */
+typedef struct ZyanArgParseDefinition_
+{
+ /**
+ * The argument name, e.g. `--help`.
+ *
+ * Must start with either one or two dashes. Single dash arguments must consist of a single
+ * character, (e.g. `-n`), double-dash arguments can be of arbitrary length.
+ */
+ const char* name;
+ /**
+ * Whether the argument is boolean or expects a value.
+ */
+ ZyanBool boolean;
+ /**
+ * Whether this argument is required (error if missing).
+ */
+ ZyanBool required;
+} ZyanArgParseDefinition;
+
+/**
+ * Configuration for argument parsing.
+ */
+typedef struct ZyanArgParseConfig_
+{
+ /**
+ * `argv` argument passed to `main` by LibC.
+ */
+ const char** argv;
+ /**
+ * `argc` argument passed to `main` by LibC.
+ */
+ ZyanUSize argc;
+ /**
+ * Minimum # of accepted unnamed / anonymous arguments.
+ */
+ ZyanUSize min_unnamed_args;
+ /**
+ * Maximum # of accepted unnamed / anonymous arguments.
+ */
+ ZyanUSize max_unnamed_args;
+ /**
+ * Argument definition array, or `ZYAN_NULL`.
+ *
+ * Expects a pointer to an array of `ZyanArgParseDefinition` instances. The array is
+ * terminated by setting the `.name` field of the last element to `ZYAN_NULL`. If no named
+ * arguments should be parsed, you can also set this to `ZYAN_NULL`.
+ */
+ ZyanArgParseDefinition* args;
+} ZyanArgParseConfig;
+
+/**
+ * Information about a parsed argument.
+ */
+typedef struct ZyanArgParseArg_
+{
+ /**
+ * Corresponding argument definition, or `ZYAN_NULL` for unnamed args.
+ *
+ * This pointer is borrowed from the `cfg` pointer passed to `ZyanArgParse`.
+ */
+ const ZyanArgParseDefinition* def;
+ /**
+ * Whether the argument has a value (is non-boolean).
+ */
+ ZyanBool has_value;
+ /**
+ * If `has_value == true`, then the argument value.
+ *
+ * This is a view into the `argv` string array passed to `ZyanArgParse` via the `cfg` argument.
+ */
+ ZyanStringView value;
+} ZyanArgParseArg;
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+#ifndef ZYAN_NO_LIBC
+
+/**
+ * Parse arguments according to a `ZyanArgParseConfig` definition.
+ *
+ * @param cfg Argument parser config to use.
+ * @param parsed Receives the parsed output. Vector of `ZyanArgParseArg`. Ownership is
+ * transferred to the user. Input is expected to be uninitialized. On error,
+ * the vector remains uninitialized.
+ * @param error_token On error, if it makes sense, receives the argument fragment causing the
+ * error. Optional, may be `ZYAN_NULL`. The pointer borrows into the `cfg`
+ * struct and doesn't have to be freed by the user.
+ *
+ * @return A `ZyanStatus` status determining whether the parsing succeeded.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanArgParse(const ZyanArgParseConfig *cfg, ZyanVector* parsed,
+ const char** error_token);
+
+#endif
+
+/**
+ * Parse arguments according to a `ZyanArgParseConfig` definition.
+ *
+ * This version allows specification of a custom memory allocator and thus supports no-libc.
+ *
+ * @param cfg Argument parser config to use.
+ * @param parsed Receives the parsed output. Vector of `ZyanArgParseArg`. Ownership is
+ * transferred to the user. Input is expected to be uninitialized. On error,
+ * the vector remains uninitialized.
+ * @param error_token On error, if it makes sense, receives the argument fragment causing the
+ * error. Optional, may be `ZYAN_NULL`. The pointer borrows into the `cfg`
+ * struct and doesn't have to be freed by the user.
+ * @param allocator The `ZyanAllocator` to be used for allocating the output vector's data.
+ *
+ * @return A `ZyanStatus` status determining whether the parsing succeeded.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanArgParseEx(const ZyanArgParseConfig *cfg, ZyanVector* parsed,
+ const char** error_token, ZyanAllocator* allocator);
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYCORE_ARGPARSE_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Bitset.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Bitset.h
new file mode 100644
index 0000000..8c7eb1f
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Bitset.h
@@ -0,0 +1,484 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zycore-C)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Implements the bitset class.
+ */
+
+#ifndef ZYCORE_BITSET_H
+#define ZYCORE_BITSET_H
+
+#include
+#include
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+/**
+ * Defines the `ZyanVector` struct.
+ *
+ * All fields in this struct should be considered as "private". Any changes may lead to unexpected
+ * behavior.
+ */
+typedef struct ZyanBitset_
+{
+ /**
+ * The bitset size.
+ */
+ ZyanUSize size;
+ /**
+ * The bitset data.
+ */
+ ZyanVector bits;
+} ZyanBitset;
+
+/**
+ * Defines the `ZyanBitsetByteOperation` function prototype.
+ *
+ * @param v1 A pointer to the first byte. This value receives the result after performing the
+ * desired operation.
+ * @param v2 A pointer to the second byte.
+ *
+ * @return A zyan status code.
+ *
+ * This function is used to perform byte-wise operations on two `ZyanBitset` instances.
+ */
+typedef ZyanStatus (*ZyanBitsetByteOperation)(ZyanU8* v1, const ZyanU8* v2);
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Constructor and destructor */
+/* ---------------------------------------------------------------------------------------------- */
+
+#ifndef ZYAN_NO_LIBC
+
+/**
+ * Initializes the given `ZyanBitset` instance.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ * @param count The initial amount of bits.
+ *
+ * @return A zyan status code.
+ *
+ * The space for the bitset is dynamically allocated by the default allocator using the default
+ * growth factor of `2.0f` and the default shrink threshold of `0.5f`.
+ */
+ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanBitsetInit(ZyanBitset* bitset, ZyanUSize count);
+
+#endif // ZYAN_NO_LIBC
+
+/**
+ * Initializes the given `ZyanBitset` instance and sets a custom `allocator` and memory
+ * allocation/deallocation parameters.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ * @param count The initial amount of bits.
+ * @param allocator A pointer to a `ZyanAllocator` instance.
+ * @param growth_factor The growth factor (from `1.0f` to `x.xf`).
+ * @param shrink_threshold The shrink threshold (from `0.0f` to `1.0f`).
+ *
+ * @return A zyan status code.
+ *
+ * A growth factor of `1.0f` disables overallocation and a shrink threshold of `0.0f` disables
+ * dynamic shrinking.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetInitEx(ZyanBitset* bitset, ZyanUSize count,
+ ZyanAllocator* allocator, float growth_factor, float shrink_threshold);
+
+/**
+ * Initializes the given `ZyanBitset` instance and configures it to use a custom user
+ * defined buffer with a fixed size.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ * @param count The initial amount of bits.
+ * @param buffer A pointer to the buffer that is used as storage for the bits.
+ * @param capacity The maximum capacity (number of bytes) of the buffer.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetInitBuffer(ZyanBitset* bitset, ZyanUSize count, void* buffer,
+ ZyanUSize capacity);
+
+/**
+ * Destroys the given `ZyanBitset` instance.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetDestroy(ZyanBitset* bitset);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Logical operations */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Performs a byte-wise `operation` for every byte in the given `ZyanBitset` instances.
+ *
+ * @param destination A pointer to the `ZyanBitset` instance that is used as the first input and
+ * as the destination.
+ * @param source A pointer to the `ZyanBitset` instance that is used as the second input.
+ * @param operation A pointer to the function that performs the desired operation.
+ *
+ * @return A zyan status code.
+ *
+ * The `operation` callback is invoked once for every byte in the smallest of the `ZyanBitset`
+ * instances.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetPerformByteOperation(ZyanBitset* destination,
+ const ZyanBitset* source, ZyanBitsetByteOperation operation);
+
+/**
+ * Performs a logical `AND` operation on the given `ZyanBitset` instances.
+ *
+ * @param destination A pointer to the `ZyanBitset` instance that is used as the first input and
+ * as the destination.
+ * @param source A pointer to the `ZyanBitset` instance that is used as the second input.
+ *
+ * @return A zyan status code.
+ *
+ * If the destination bitmask contains more bits than the source one, the state of the remaining
+ * bits will be undefined.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetAND(ZyanBitset* destination, const ZyanBitset* source);
+
+/**
+ * Performs a logical `OR` operation on the given `ZyanBitset` instances.
+ *
+ * @param destination A pointer to the `ZyanBitset` instance that is used as the first input and
+ * as the destination.
+ * @param source A pointer to the `ZyanBitset` instance that is used as the second input.
+ *
+ * @return A zyan status code.
+ *
+ * If the destination bitmask contains more bits than the source one, the state of the remaining
+ * bits will be undefined.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetOR (ZyanBitset* destination, const ZyanBitset* source);
+
+/**
+ * Performs a logical `XOR` operation on the given `ZyanBitset` instances.
+ *
+ * @param destination A pointer to the `ZyanBitset` instance that is used as the first input and
+ * as the destination.
+ * @param source A pointer to the `ZyanBitset` instance that is used as the second input.
+ *
+ * @return A zyan status code.
+ *
+ * If the destination bitmask contains more bits than the source one, the state of the remaining
+ * bits will be undefined.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetXOR(ZyanBitset* destination, const ZyanBitset* source);
+
+/**
+ * Flips all bits of the given `ZyanBitset` instance.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetFlip(ZyanBitset* bitset);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Bit access */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Sets the bit at `index` of the given `ZyanBitset` instance to `1`.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ * @param index The bit index.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetSet(ZyanBitset* bitset, ZyanUSize index);
+
+/**
+ * Sets the bit at `index` of the given `ZyanBitset` instance to `0`.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ * @param index The bit index.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetReset(ZyanBitset* bitset, ZyanUSize index);
+
+/**
+ * Sets the bit at `index` of the given `ZyanBitset` instance to the specified `value`.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ * @param index The bit index.
+ * @param value The new value.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetAssign(ZyanBitset* bitset, ZyanUSize index, ZyanBool value);
+
+/**
+ * Toggles the bit at `index` of the given `ZyanBitset` instance.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ * @param index The bit index.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetToggle(ZyanBitset* bitset, ZyanUSize index);
+
+/**
+ * Returns the value of the bit at `index`.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ * @param index The bit index.
+ *
+ * @return `ZYAN_STATUS_TRUE`, if the bit is set or `ZYAN_STATUS_FALSE`, if not, Another zyan
+ * status code, if an error occured.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetTest(ZyanBitset* bitset, ZyanUSize index);
+
+/**
+ * Returns the value of the most significant bit.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ *
+ * @return `ZYAN_STATUS_TRUE`, if the bit is set or `ZYAN_STATUS_FALSE`, if not. Another zyan
+ * status code, if an error occured.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetTestMSB(ZyanBitset* bitset);
+
+/**
+ * Returns the value of the least significant bit.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ *
+ * @return `ZYAN_STATUS_TRUE`, if the bit is set or `ZYAN_STATUS_FALSE`, if not. Another zyan
+ * status code, if an error occured.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetTestLSB(ZyanBitset* bitset);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Sets all bits of the given `ZyanBitset` instance to `1`.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetSetAll(ZyanBitset* bitset);
+
+/**
+ * Sets all bits of the given `ZyanBitset` instance to `0`.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetResetAll(ZyanBitset* bitset);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Size management */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Adds a new bit at the end of the bitset.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ * @param value The value of the new bit.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetPush(ZyanBitset* bitset, ZyanBool value);
+
+/**
+ * Removes the last bit of the bitset.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetPop(ZyanBitset* bitset);
+
+/**
+ * Deletes all bits of the given `ZyanBitset` instance.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetClear(ZyanBitset* bitset);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Memory management */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Changes the capacity of the given `ZyanBitset` instance.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ * @param count The new capacity (number of bits).
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetReserve(ZyanBitset* bitset, ZyanUSize count);
+
+/**
+ * Shrinks the capacity of the given bitset to match it's size.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetShrinkToFit(ZyanBitset* bitset);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Information */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the current size of the bitset in bits.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ * @param size Receives the size of the bitset in bits.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetGetSize(const ZyanBitset* bitset, ZyanUSize* size);
+
+/**
+ * Returns the current capacity of the bitset in bits.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ * @param capacity Receives the size of the bitset in bits.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetGetCapacity(const ZyanBitset* bitset, ZyanUSize* capacity);
+
+/**
+ * Returns the current size of the bitset in bytes.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ * @param size Receives the size of the bitset in bytes.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetGetSizeBytes(const ZyanBitset* bitset, ZyanUSize* size);
+
+/**
+ * Returns the current capacity of the bitset in bytes.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ * @param capacity Receives the size of the bitset in bytes.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetGetCapacityBytes(const ZyanBitset* bitset, ZyanUSize* capacity);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the amount of bits set in the given bitset.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ * @param count Receives the amount of bits set in the given bitset.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetCount(const ZyanBitset* bitset, ZyanUSize* count);
+
+/**
+ * Checks, if all bits of the given bitset are set.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ *
+ * @return `ZYAN_STATUS_TRUE`, if all bits are set, `ZYAN_STATUS_FALSE`, if not. Another zyan
+ * status code, if an error occured.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetAll(const ZyanBitset* bitset);
+
+/**
+ * Checks, if at least one bit of the given bitset is set.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ *
+ * @return `ZYAN_STATUS_TRUE`, if at least one bit is set, `ZYAN_STATUS_FALSE`, if not. Another
+ * zyan status code, if an error occured.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetAny(const ZyanBitset* bitset);
+
+/**
+ * Checks, if none bits of the given bitset are set.
+ *
+ * @param bitset A pointer to the `ZyanBitset` instance.
+ *
+ * @return `ZYAN_STATUS_TRUE`, if none bits are set, `ZYAN_STATUS_FALSE`, if not. Another zyan
+ * status code, if an error occured.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanBitsetNone(const ZyanBitset* bitset);
+
+///* ---------------------------------------------------------------------------------------------- */
+//
+///**
+// * Returns a 32-bit unsigned integer representation of the data.
+// *
+// * @param bitset A pointer to the `ZyanBitset` instance.
+// * @param value Receives the 32-bit unsigned integer representation of the data.
+// *
+// * @return A zyan status code.
+// */
+//ZYCORE_EXPORT ZyanStatus ZyanBitsetToU32(const ZyanBitset* bitset, ZyanU32* value);
+//
+///**
+// * Returns a 64-bit unsigned integer representation of the data.
+// *
+// * @param bitset A pointer to the `ZyanBitset` instance.
+// * @param value Receives the 64-bit unsigned integer representation of the data.
+// *
+// * @return A zyan status code.
+// */
+//ZYCORE_EXPORT ZyanStatus ZyanBitsetToU64(const ZyanBitset* bitset, ZyanU64* value);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYCORE_BITSET_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Comparison.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Comparison.h
new file mode 100644
index 0000000..6d8b518
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Comparison.h
@@ -0,0 +1,316 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zycore-C)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Defines prototypes of general-purpose comparison functions.
+ */
+
+#ifndef ZYCORE_COMPARISON_H
+#define ZYCORE_COMPARISON_H
+
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+/**
+ * Defines the `ZyanEqualityComparison` function prototype.
+ *
+ * @param left A pointer to the first element.
+ * @param right A pointer to the second element.
+ *
+ * @return This function should return `ZYAN_TRUE` if the `left` element equals the `right` one
+ * or `ZYAN_FALSE`, if not.
+ */
+typedef ZyanBool (*ZyanEqualityComparison)(const void* left, const void* right);
+
+/**
+ * Defines the `ZyanComparison` function prototype.
+ *
+ * @param left A pointer to the first element.
+ * @param right A pointer to the second element.
+ *
+ * @return This function should return values in the following range:
+ * `left == right -> result == 0`
+ * `left < right -> result < 0`
+ * `left > right -> result > 0`
+ */
+typedef ZyanI32 (*ZyanComparison)(const void* left, const void* right);
+
+/* ============================================================================================== */
+/* Macros */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Equality comparison functions */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Declares a generic equality comparison function for an integral data-type.
+ *
+ * @param name The name of the function.
+ * @param type The name of the integral data-type.
+ */
+#define ZYAN_DECLARE_EQUALITY_COMPARISON(name, type) \
+ ZyanBool name(const type* left, const type* right) \
+ { \
+ ZYAN_ASSERT(left); \
+ ZYAN_ASSERT(right); \
+ \
+ return (*left == *right) ? ZYAN_TRUE : ZYAN_FALSE; \
+ }
+
+/**
+ * Declares a generic equality comparison function that compares a single integral
+ * data-type field of a struct.
+ *
+ * @param name The name of the function.
+ * @param type The name of the integral data-type.
+ * @param field_name The name of the struct field.
+ */
+#define ZYAN_DECLARE_EQUALITY_COMPARISON_FOR_FIELD(name, type, field_name) \
+ ZyanBool name(const type* left, const type* right) \
+ { \
+ ZYAN_ASSERT(left); \
+ ZYAN_ASSERT(right); \
+ \
+ return (left->field_name == right->field_name) ? ZYAN_TRUE : ZYAN_FALSE; \
+ }
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Comparison functions */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Declares a generic comparison function for an integral data-type.
+ *
+ * @param name The name of the function.
+ * @param type The name of the integral data-type.
+ */
+#define ZYAN_DECLARE_COMPARISON(name, type) \
+ ZyanI32 name(const type* left, const type* right) \
+ { \
+ ZYAN_ASSERT(left); \
+ ZYAN_ASSERT(right); \
+ \
+ if (*left < *right) \
+ { \
+ return -1; \
+ } \
+ if (*left > *right) \
+ { \
+ return 1; \
+ } \
+ return 0; \
+ }
+
+/**
+ * Declares a generic comparison function that compares a single integral data-type field
+ * of a struct.
+ *
+ * @param name The name of the function.
+ * @param type The name of the integral data-type.
+ * @param field_name The name of the struct field.
+ */
+#define ZYAN_DECLARE_COMPARISON_FOR_FIELD(name, type, field_name) \
+ ZyanI32 name(const type* left, const type* right) \
+ { \
+ ZYAN_ASSERT(left); \
+ ZYAN_ASSERT(right); \
+ \
+ if (left->field_name < right->field_name) \
+ { \
+ return -1; \
+ } \
+ if (left->field_name > right->field_name) \
+ { \
+ return 1; \
+ } \
+ return 0; \
+ }
+
+ /* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Default equality comparison functions */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines a default equality comparison function for pointer values.
+ *
+ * @param left A pointer to the first value.
+ * @param right A pointer to the second value.
+ *
+ * @return Returns `ZYAN_TRUE` if the `left` value equals the `right` one or `ZYAN_FALSE`, if
+ * not.
+ */
+ZYAN_INLINE ZYAN_DECLARE_EQUALITY_COMPARISON(ZyanEqualsPointer, void* const)
+
+/**
+ * Defines a default equality comparison function for `ZyanBool` values.
+ *
+ * @param left A pointer to the first value.
+ * @param right A pointer to the second value.
+ *
+ * @return Returns `ZYAN_TRUE` if the `left` value equals the `right` one or `ZYAN_FALSE`, if
+ * not.
+ */
+ZYAN_INLINE ZYAN_DECLARE_EQUALITY_COMPARISON(ZyanEqualsBool, ZyanBool)
+
+/**
+ * Defines a default equality comparison function for 8-bit numeric values.
+ *
+ * @param left A pointer to the first value.
+ * @param right A pointer to the second value.
+ *
+ * @return Returns `ZYAN_TRUE` if the `left` value equals the `right` one or `ZYAN_FALSE`, if
+ * not.
+ */
+ZYAN_INLINE ZYAN_DECLARE_EQUALITY_COMPARISON(ZyanEqualsNumeric8, ZyanU8)
+
+/**
+ * Defines a default equality comparison function for 16-bit numeric values.
+ *
+ * @param left A pointer to the first value.
+ * @param right A pointer to the second value.
+ *
+ * @return Returns `ZYAN_TRUE` if the `left` value equals the `right` one or `ZYAN_FALSE`, if
+ * not.
+ */
+ZYAN_INLINE ZYAN_DECLARE_EQUALITY_COMPARISON(ZyanEqualsNumeric16, ZyanU16)
+
+/**
+ * Defines a default equality comparison function for 32-bit numeric values.
+ *
+ * @param left A pointer to the first value.
+ * @param right A pointer to the second value.
+ *
+ * @return Returns `ZYAN_TRUE` if the `left` value equals the `right` one or `ZYAN_FALSE`, if
+ * not.
+ */
+ZYAN_INLINE ZYAN_DECLARE_EQUALITY_COMPARISON(ZyanEqualsNumeric32, ZyanU32)
+
+/**
+ * Defines a default equality comparison function for 64-bit numeric values.
+ *
+ * @param left A pointer to the first value.
+ * @param right A pointer to the second value.
+ *
+ * @return Returns `ZYAN_TRUE` if the `left` value equals the `right` one or `ZYAN_FALSE`, if
+ * not.
+ */
+ZYAN_INLINE ZYAN_DECLARE_EQUALITY_COMPARISON(ZyanEqualsNumeric64, ZyanU64)
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Default comparison functions */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines a default comparison function for pointer values.
+ *
+ * @param left A pointer to the first value.
+ * @param right A pointer to the second value.
+ *
+ * @return Returns `0` if the `left` value equals the `right` one, `-1` if the `left` value is
+ * less than the `right` one, or `1` if the `left` value is greater than the `right` one.
+ */
+ZYAN_INLINE ZYAN_DECLARE_COMPARISON(ZyanComparePointer, void* const)
+
+/**
+ * Defines a default comparison function for `ZyanBool` values.
+ *
+ * @param left A pointer to the first value.
+ * @param right A pointer to the second value.
+ *
+ * @return Returns `0` if the `left` value equals the `right` one, `-1` if the `left` value is
+ * less than the `right` one, or `1` if the `left` value is greater than the `right` one.
+ */
+ZYAN_INLINE ZYAN_DECLARE_COMPARISON(ZyanCompareBool, ZyanBool)
+
+/**
+ * Defines a default comparison function for 8-bit numeric values.
+ *
+ * @param left A pointer to the first value.
+ * @param right A pointer to the second value.
+ *
+ * @return Returns `0` if the `left` value equals the `right` one, `-1` if the `left` value is
+ * less than the `right` one, or `1` if the `left` value is greater than the `right` one.
+ */
+ZYAN_INLINE ZYAN_DECLARE_COMPARISON(ZyanCompareNumeric8, ZyanU8)
+
+/**
+ * Defines a default comparison function for 16-bit numeric values.
+ *
+ * @param left A pointer to the first value.
+ * @param right A pointer to the second value.
+ *
+ * @return Returns `0` if the `left` value equals the `right` one, `-1` if the `left` value is
+ * less than the `right` one, or `1` if the `left` value is greater than the `right` one.
+ */
+ZYAN_INLINE ZYAN_DECLARE_COMPARISON(ZyanCompareNumeric16, ZyanU16)
+
+/**
+ * Defines a default comparison function for 32-bit numeric values.
+ *
+ * @param left A pointer to the first value.
+ * @param right A pointer to the second value.
+ *
+ * @return Returns `0` if the `left` value equals the `right` one, `-1` if the `left` value is
+ * less than the `right` one, or `1` if the `left` value is greater than the `right` one.
+ */
+ZYAN_INLINE ZYAN_DECLARE_COMPARISON(ZyanCompareNumeric32, ZyanU32)
+
+/**
+ * Defines a default comparison function for 64-bit numeric values.
+ *
+ * @param left A pointer to the first value.
+ * @param right A pointer to the second value.
+ *
+ * @return Returns `0` if the `left` value equals the `right` one, `-1` if the `left` value is
+ * less than the `right` one, or `1` if the `left` value is greater than the `right` one.
+ */
+ZYAN_INLINE ZYAN_DECLARE_COMPARISON(ZyanCompareNumeric64, ZyanU64)
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYCORE_COMPARISON_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Defines.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Defines.h
new file mode 100644
index 0000000..65afbaa
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Defines.h
@@ -0,0 +1,443 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zycore-C)
+
+ Original Author : Florian Bernd, Joel Hoener
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * General helper and platform detection macros.
+ */
+
+#ifndef ZYCORE_DEFINES_H
+#define ZYCORE_DEFINES_H
+
+/* ============================================================================================== */
+/* Meta macros */
+/* ============================================================================================== */
+
+/**
+ * Concatenates two values using the stringify operator (`##`).
+ *
+ * @param x The first value.
+ * @param y The second value.
+ *
+ * @return The combined string of the given values.
+ */
+#define ZYAN_MACRO_CONCAT(x, y) x ## y
+
+/**
+ * Concatenates two values using the stringify operator (`##`) and expands the value to
+ * be used in another macro.
+ *
+ * @param x The first value.
+ * @param y The second value.
+ *
+ * @return The combined string of the given values.
+ */
+#define ZYAN_MACRO_CONCAT_EXPAND(x, y) ZYAN_MACRO_CONCAT(x, y)
+
+/* ============================================================================================== */
+/* Compiler detection */
+/* ============================================================================================== */
+
+#if defined(__clang__)
+# define ZYAN_CLANG
+# define ZYAN_GNUC
+#elif defined(__ICC) || defined(__INTEL_COMPILER)
+# define ZYAN_ICC
+#elif defined(__GNUC__) || defined(__GNUG__)
+# define ZYAN_GCC
+# define ZYAN_GNUC
+#elif defined(_MSC_VER)
+# define ZYAN_MSVC
+#elif defined(__BORLANDC__)
+# define ZYAN_BORLAND
+#else
+# define ZYAN_UNKNOWN_COMPILER
+#endif
+
+/* ============================================================================================== */
+/* Platform detection */
+/* ============================================================================================== */
+
+#if defined(_WIN32)
+# define ZYAN_WINDOWS
+#elif defined(__EMSCRIPTEN__)
+# define ZYAN_EMSCRIPTEN
+#elif defined(__APPLE__)
+# define ZYAN_APPLE
+# define ZYAN_POSIX
+#elif defined(__linux)
+# define ZYAN_LINUX
+# define ZYAN_POSIX
+#elif defined(__FreeBSD__)
+# define ZYAN_FREEBSD
+# define ZYAN_POSIX
+#elif defined(sun) || defined(__sun)
+# define ZYAN_SOLARIS
+# define ZYAN_POSIX
+#elif defined(__unix)
+# define ZYAN_UNIX
+# define ZYAN_POSIX
+#elif defined(__posix)
+# define ZYAN_POSIX
+#else
+# define ZYAN_UNKNOWN_PLATFORM
+#endif
+
+/* ============================================================================================== */
+/* Kernel mode detection */
+/* ============================================================================================== */
+
+#if (defined(ZYAN_WINDOWS) && defined(_KERNEL_MODE)) || \
+ (defined(ZYAN_APPLE) && defined(KERNEL)) || \
+ (defined(ZYAN_LINUX) && defined(__KERNEL__)) || \
+ (defined(__FreeBSD_kernel__))
+# define ZYAN_KERNEL
+#else
+# define ZYAN_USER
+#endif
+
+/* ============================================================================================== */
+/* Architecture detection */
+/* ============================================================================================== */
+
+#if defined(_M_AMD64) || defined(__x86_64__)
+# define ZYAN_X64
+#elif defined(_M_IX86) || defined(__i386__)
+# define ZYAN_X86
+#elif defined(_M_ARM64) || defined(__aarch64__)
+# define ZYAN_AARCH64
+#elif defined(_M_ARM) || defined(_M_ARMT) || defined(__arm__) || defined(__thumb__)
+# define ZYAN_ARM
+#elif defined(__EMSCRIPTEN__)
+ // Nothing to do, `ZYAN_EMSCRIPTEN` is both platform and arch macro for this one.
+#else
+# error "Unsupported architecture detected"
+#endif
+
+/* ============================================================================================== */
+/* Debug/Release detection */
+/* ============================================================================================== */
+
+#if defined(ZYAN_MSVC) || defined(ZYAN_BORLAND)
+# ifdef _DEBUG
+# define ZYAN_DEBUG
+# else
+# define ZYAN_RELEASE
+# endif
+#elif defined(ZYAN_GNUC) || defined(ZYAN_ICC)
+# ifdef NDEBUG
+# define ZYAN_RELEASE
+# else
+# define ZYAN_DEBUG
+# endif
+#else
+# define ZYAN_RELEASE
+#endif
+
+/* ============================================================================================== */
+/* Misc compatibility macros */
+/* ============================================================================================== */
+
+#if defined(ZYAN_CLANG)
+# define ZYAN_NO_SANITIZE(what) __attribute__((no_sanitize(what)))
+#else
+# define ZYAN_NO_SANITIZE(what)
+#endif
+
+#if defined(ZYAN_MSVC) || defined(ZYAN_BORLAND)
+# define ZYAN_INLINE __inline
+#else
+# define ZYAN_INLINE static inline
+#endif
+
+/* ============================================================================================== */
+/* Debugging and optimization macros */
+/* ============================================================================================== */
+
+/**
+ * Runtime debug assertion.
+ */
+#if defined(ZYAN_NO_LIBC)
+# define ZYAN_ASSERT(condition) (void)(condition)
+#elif defined(ZYAN_WINDOWS) && defined(ZYAN_KERNEL)
+# include
+# define ZYAN_ASSERT(condition) NT_ASSERT(condition)
+#else
+# include
+# define ZYAN_ASSERT(condition) assert(condition)
+#endif
+
+/**
+ * Compiler-time assertion.
+ */
+#if __STDC_VERSION__ >= 201112L && !defined(__cplusplus)
+# define ZYAN_STATIC_ASSERT(x) _Static_assert(x, #x)
+#elif (defined(__cplusplus) && __cplusplus >= 201103L) || \
+ (defined(__cplusplus) && defined (_MSC_VER) && (_MSC_VER >= 1600)) || \
+ (defined (_MSC_VER) && (_MSC_VER >= 1800))
+# define ZYAN_STATIC_ASSERT(x) static_assert(x, #x)
+#else
+# define ZYAN_STATIC_ASSERT(x) \
+ typedef int ZYAN_MACRO_CONCAT_EXPAND(ZYAN_SASSERT_, __COUNTER__) [(x) ? 1 : -1]
+#endif
+
+/**
+ * Marks the current code path as unreachable.
+ */
+#if defined(ZYAN_RELEASE)
+# if defined(ZYAN_CLANG) // GCC eagerly evals && RHS, we have to use nested ifs.
+# if __has_builtin(__builtin_unreachable)
+# define ZYAN_UNREACHABLE __builtin_unreachable()
+# else
+# define ZYAN_UNREACHABLE for(;;)
+# endif
+# elif defined(ZYAN_GCC) && ((__GNUC__ == 4 && __GNUC_MINOR__ > 4) || __GNUC__ > 4)
+# define ZYAN_UNREACHABLE __builtin_unreachable()
+# elif defined(ZYAN_ICC)
+# ifdef ZYAN_WINDOWS
+# include // "missing return statement" workaround
+# define ZYAN_UNREACHABLE __assume(0); (void)abort()
+# else
+# define ZYAN_UNREACHABLE __builtin_unreachable()
+# endif
+# elif defined(ZYAN_MSVC)
+# define ZYAN_UNREACHABLE __assume(0)
+# else
+# define ZYAN_UNREACHABLE for(;;)
+# endif
+#elif defined(ZYAN_NO_LIBC)
+# define ZYAN_UNREACHABLE for(;;)
+#elif defined(ZYAN_WINDOWS) && defined(ZYAN_KERNEL)
+# define ZYAN_UNREACHABLE { __fastfail(0); for(;;){} }
+#else
+# include
+# define ZYAN_UNREACHABLE { assert(0); abort(); }
+#endif
+
+/* ============================================================================================== */
+/* Utils */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* General purpose */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Marks the specified parameter as unused.
+ *
+ * @param x The name of the unused parameter.
+ */
+#define ZYAN_UNUSED(x) (void)(x)
+
+/**
+ * Intentional fallthrough.
+ */
+#if defined(ZYAN_GCC) && __GNUC__ >= 7
+# define ZYAN_FALLTHROUGH __attribute__((fallthrough))
+#else
+# define ZYAN_FALLTHROUGH
+#endif
+
+/**
+ * Declares a bitfield.
+ *
+ * @param x The size (in bits) of the bitfield.
+ */
+#define ZYAN_BITFIELD(x) : x
+
+/**
+ * Marks functions that require libc (cannot be used with `ZYAN_NO_LIBC`).
+ */
+#define ZYAN_REQUIRES_LIBC
+
+/**
+ * Decorator for `printf`-style functions.
+ *
+ * @param format_index The 1-based index of the format string parameter.
+ * @param first_to_check The 1-based index of the format arguments parameter.
+ */
+#if defined(__RESHARPER__)
+# define ZYAN_PRINTF_ATTR(format_index, first_to_check) \
+ [[gnu::format(printf, format_index, first_to_check)]]
+#elif defined(ZYAN_GCC)
+# define ZYAN_PRINTF_ATTR(format_index, first_to_check) \
+ __attribute__((format(printf, format_index, first_to_check)))
+#else
+# define ZYAN_PRINTF_ATTR(format_index, first_to_check)
+#endif
+
+/**
+ * Decorator for `wprintf`-style functions.
+ *
+ * @param format_index The 1-based index of the format string parameter.
+ * @param first_to_check The 1-based index of the format arguments parameter.
+ */
+#if defined(__RESHARPER__)
+# define ZYAN_WPRINTF_ATTR(format_index, first_to_check) \
+ [[rscpp::format(wprintf, format_index, first_to_check)]]
+#else
+# define ZYAN_WPRINTF_ATTR(format_index, first_to_check)
+#endif
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Arrays */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the length (number of elements) of an array.
+ *
+ * @param a The name of the array.
+ *
+ * @return The number of elements of the given array.
+ */
+#define ZYAN_ARRAY_LENGTH(a) (sizeof(a) / sizeof((a)[0]))
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Arithmetic */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the smaller value of `a` or `b`.
+ *
+ * @param a The first value.
+ * @param b The second value.
+ *
+ * @return The smaller value of `a` or `b`.
+ */
+#define ZYAN_MIN(a, b) (((a) < (b)) ? (a) : (b))
+
+/**
+ * Returns the bigger value of `a` or `b`.
+ *
+ * @param a The first value.
+ * @param b The second value.
+ *
+ * @return The bigger value of `a` or `b`.
+ */
+#define ZYAN_MAX(a, b) (((a) > (b)) ? (a) : (b))
+
+/**
+ * Returns the absolute value of `a`.
+ *
+ * @param a The value.
+ *
+ * @return The absolute value of `a`.
+ */
+#define ZYAN_ABS(a) (((a) < 0) ? -(a) : (a))
+
+/**
+ * Checks, if the given value is a power of 2.
+ *
+ * @param x The value.
+ *
+ * @return `ZYAN_TRUE`, if the given value is a power of 2 or `ZYAN_FALSE`, if not.
+ *
+ * Note that this macro always returns `ZYAN_TRUE` for `x == 0`.
+ */
+#define ZYAN_IS_POWER_OF_2(x) (((x) & ((x) - 1)) == 0)
+
+/**
+ * Checks, if the given value is properly aligned.
+ *
+ * Note that this macro only works for powers of 2.
+ */
+#define ZYAN_IS_ALIGNED_TO(x, align) (((x) & ((align) - 1)) == 0)
+
+/**
+ * Aligns the value to the nearest given alignment boundary (by rounding it up).
+ *
+ * @param x The value.
+ * @param align The desired alignment.
+ *
+ * @return The aligned value.
+ *
+ * Note that this macro only works for powers of 2.
+ */
+#define ZYAN_ALIGN_UP(x, align) (((x) + (align) - 1) & ~((align) - 1))
+
+/**
+ * Aligns the value to the nearest given alignment boundary (by rounding it down).
+ *
+ * @param x The value.
+ * @param align The desired alignment.
+ *
+ * @return The aligned value.
+ *
+ * Note that this macro only works for powers of 2.
+ */
+#define ZYAN_ALIGN_DOWN(x, align) (((x) - 1) & ~((align) - 1))
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Bit operations */
+/* ---------------------------------------------------------------------------------------------- */
+
+/*
+ * Checks, if the bit at index `b` is required to present the ordinal value `n`.
+ *
+ * @param n The ordinal value.
+ * @param b The bit index.
+ *
+ * @return `ZYAN_TRUE`, if the bit at index `b` is required to present the ordinal value `n` or
+ * `ZYAN_FALSE`, if not.
+ *
+ * Note that this macro always returns `ZYAN_FALSE` for `n == 0`.
+ */
+#define ZYAN_NEEDS_BIT(n, b) (((unsigned long)(n) >> (b)) > 0)
+
+/*
+ * Returns the number of bits required to represent the ordinal value `n`.
+ *
+ * @param n The ordinal value.
+ *
+ * @return The number of bits required to represent the ordinal value `n`.
+ *
+ * Note that this macro returns `0` for `n == 0`.
+ */
+#define ZYAN_BITS_TO_REPRESENT(n) \
+ ( \
+ ZYAN_NEEDS_BIT(n, 0) + ZYAN_NEEDS_BIT(n, 1) + \
+ ZYAN_NEEDS_BIT(n, 2) + ZYAN_NEEDS_BIT(n, 3) + \
+ ZYAN_NEEDS_BIT(n, 4) + ZYAN_NEEDS_BIT(n, 5) + \
+ ZYAN_NEEDS_BIT(n, 6) + ZYAN_NEEDS_BIT(n, 7) + \
+ ZYAN_NEEDS_BIT(n, 8) + ZYAN_NEEDS_BIT(n, 9) + \
+ ZYAN_NEEDS_BIT(n, 10) + ZYAN_NEEDS_BIT(n, 11) + \
+ ZYAN_NEEDS_BIT(n, 12) + ZYAN_NEEDS_BIT(n, 13) + \
+ ZYAN_NEEDS_BIT(n, 14) + ZYAN_NEEDS_BIT(n, 15) + \
+ ZYAN_NEEDS_BIT(n, 16) + ZYAN_NEEDS_BIT(n, 17) + \
+ ZYAN_NEEDS_BIT(n, 18) + ZYAN_NEEDS_BIT(n, 19) + \
+ ZYAN_NEEDS_BIT(n, 20) + ZYAN_NEEDS_BIT(n, 21) + \
+ ZYAN_NEEDS_BIT(n, 22) + ZYAN_NEEDS_BIT(n, 23) + \
+ ZYAN_NEEDS_BIT(n, 24) + ZYAN_NEEDS_BIT(n, 25) + \
+ ZYAN_NEEDS_BIT(n, 26) + ZYAN_NEEDS_BIT(n, 27) + \
+ ZYAN_NEEDS_BIT(n, 28) + ZYAN_NEEDS_BIT(n, 29) + \
+ ZYAN_NEEDS_BIT(n, 30) + ZYAN_NEEDS_BIT(n, 31) \
+ )
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#endif /* ZYCORE_DEFINES_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Format.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Format.h
new file mode 100644
index 0000000..b0401e6
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Format.h
@@ -0,0 +1,286 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zycore-C)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Provides helper functions for performant number to string conversion.
+ */
+
+#ifndef ZYCORE_FORMAT_H
+#define ZYCORE_FORMAT_H
+
+#include
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Helpers */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Get the absolute value of a 64 bit int.
+ *
+ * @param x The value to process.
+ * @return The absolute, unsigned value.
+ *
+ * This gracefully deals with the special case of `x` being `INT_MAX`.
+ */
+ZYAN_INLINE ZyanU64 ZyanAbsI64(ZyanI64 x)
+{
+ // INT_MIN special case. Can't use the value directly because GCC thinks
+ // it's too big for an INT64 literal, however is perfectly happy to accept
+ // this expression. This is also hit INT64_MIN is defined in `stdint.h`.
+ if (x == (-0x7fffffffffffffff - 1))
+ {
+ return 0x8000000000000000u;
+ }
+
+ return (ZyanU64)(x < 0 ? -x : x);
+}
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Insertion */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Inserts formatted text in the destination string at the given `index`.
+ *
+ * @param string The destination string.
+ * @param index The insert index.
+ * @param format The format string.
+ * @param ... The format arguments.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYAN_PRINTF_ATTR(3, 4)
+ZYCORE_EXPORT ZyanStatus ZyanStringInsertFormat(ZyanString* string, ZyanUSize index,
+ const char* format, ...);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Formats the given unsigned ordinal `value` to its decimal text-representation and
+ * inserts it to the `string`.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param index The insert index.
+ * @param value The value.
+ * @param padding_length Padds the converted value with leading zeros, if the number of chars is
+ * less than the `padding_length`.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringInsertDecU(ZyanString* string, ZyanUSize index, ZyanU64 value,
+ ZyanU8 padding_length);
+
+/**
+ * Formats the given signed ordinal `value` to its decimal text-representation and
+ * inserts it to the `string`.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param index The insert index.
+ * @param value The value.
+ * @param padding_length Padds the converted value with leading zeros, if the number of chars is
+ * less than the `padding_length`.
+ * @param force_sign Set `ZYAN_TRUE`, to force printing of the `+` sign for positive numbers.
+ * @param prefix The string to use as prefix or `ZYAN_NULL`, if not needed.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringInsertDecS(ZyanString* string, ZyanUSize index, ZyanI64 value,
+ ZyanU8 padding_length, ZyanBool force_sign, const ZyanString* prefix);
+
+/**
+ * Formats the given unsigned ordinal `value` to its hexadecimal text-representation and
+ * inserts it to the `string`.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param index The insert index.
+ * @param value The value.
+ * @param padding_length Padds the converted value with leading zeros, if the number of chars is
+ * less than the `padding_length`.
+ * @param uppercase Set `ZYAN_TRUE` to use uppercase letters ('A'-'F') instead of lowercase
+ * ones ('a'-'f').
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringInsertHexU(ZyanString* string, ZyanUSize index, ZyanU64 value,
+ ZyanU8 padding_length, ZyanBool uppercase);
+
+/**
+ * Formats the given signed ordinal `value` to its hexadecimal text-representation and
+ * inserts it to the `string`.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param index The insert index.
+ * @param value The value.
+ * @param padding_length Padds the converted value with leading zeros, if the number of chars is
+ * less than the `padding_length`.
+ * @param uppercase Set `ZYAN_TRUE` to use uppercase letters ('A'-'F') instead of lowercase
+ * ones ('a'-'f').
+ * @param force_sign Set `ZYAN_TRUE`, to force printing of the `+` sign for positive numbers.
+ * @param prefix The string to use as prefix or `ZYAN_NULL`, if not needed.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringInsertHexS(ZyanString* string, ZyanUSize index, ZyanI64 value,
+ ZyanU8 padding_length, ZyanBool uppercase, ZyanBool force_sign, const ZyanString* prefix);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Appending */
+/* ---------------------------------------------------------------------------------------------- */
+
+#ifndef ZYAN_NO_LIBC
+
+/**
+ * Appends formatted text to the destination string.
+ *
+ * @param string The destination string.
+ * @param format The format string.
+ * @param ... The format arguments.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYAN_PRINTF_ATTR(2, 3)
+ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanStringAppendFormat(
+ ZyanString* string, const char* format, ...);
+
+#endif // ZYAN_NO_LIBC
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Formats the given unsigned ordinal `value` to its decimal text-representation and
+ * appends it to the `string`.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param value The value.
+ * @param padding_length Padds the converted value with leading zeros, if the number of chars is
+ * less than the `padding_length`.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringAppendDecU(ZyanString* string, ZyanU64 value,
+ ZyanU8 padding_length);
+
+/**
+ * Formats the given signed ordinal `value` to its decimal text-representation and
+ * appends it to the `string`.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param value The value.
+ * @param padding_length Padds the converted value with leading zeros, if the number of chars is
+ * less than the `padding_length`.
+ * @param force_sign Set `ZYAN_TRUE`, to force printing of the `+` sign for positive numbers.
+ * @param prefix The string to use as prefix or `ZYAN_NULL`, if not needed.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringAppendDecS(ZyanString* string, ZyanI64 value,
+ ZyanU8 padding_length, ZyanBool force_sign, const ZyanStringView* prefix);
+
+/**
+ * Formats the given unsigned ordinal `value` to its hexadecimal text-representation and
+ * appends it to the `string`.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param value The value.
+ * @param padding_length Padds the converted value with leading zeros, if the number of chars is
+ * less than the `padding_length`.
+ * @param uppercase Set `ZYAN_TRUE` to use uppercase letters ('A'-'F') instead of lowercase
+ * ones ('a'-'f').
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringAppendHexU(ZyanString* string, ZyanU64 value,
+ ZyanU8 padding_length, ZyanBool uppercase);
+
+/**
+ * Formats the given signed ordinal `value` to its hexadecimal text-representation and
+ * appends it to the `string`.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param value The value.
+ * @param padding_length Padds the converted value with leading zeros, if the number of chars is
+ * less than the `padding_length`.
+ * @param uppercase Set `ZYAN_TRUE` to use uppercase letters ('A'-'F') instead of lowercase
+ * ones ('a'-'f').
+ * @param force_sign Set `ZYAN_TRUE`, to force printing of the `+` sign for positive numbers.
+ * @param prefix The string to use as prefix or `ZYAN_NULL`, if not needed.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringAppendHexS(ZyanString* string, ZyanI64 value,
+ ZyanU8 padding_length, ZyanBool uppercase, ZyanBool force_sign, const ZyanStringView* prefix);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ZYCORE_FORMAT_H
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/LibC.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/LibC.h
new file mode 100644
index 0000000..cb0b2f3
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/LibC.h
@@ -0,0 +1,511 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zycore-C)
+
+ Original Author : Florian Bernd, Joel Hoener
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Provides a simple LibC abstraction and fallback routines.
+ */
+
+#ifndef ZYCORE_LIBC_H
+#define ZYCORE_LIBC_H
+
+#ifndef ZYAN_CUSTOM_LIBC
+
+// Include a custom LibC header and define `ZYAN_CUSTOM_LIBC` to provide your own LibC
+// replacement functions
+
+#ifndef ZYAN_NO_LIBC
+
+/* ============================================================================================== */
+/* LibC is available */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* errno.h */
+/* ---------------------------------------------------------------------------------------------- */
+
+#include
+
+#define ZYAN_ERRNO errno
+
+/* ---------------------------------------------------------------------------------------------- */
+/* stdarg.h */
+/* ---------------------------------------------------------------------------------------------- */
+
+#include
+
+/**
+ * Defines the `ZyanVAList` datatype.
+ */
+typedef va_list ZyanVAList;
+
+#define ZYAN_VA_START va_start
+#define ZYAN_VA_ARG va_arg
+#define ZYAN_VA_END va_end
+#define ZYAN_VA_COPY(dest, source) va_copy((dest), (source))
+
+/* ---------------------------------------------------------------------------------------------- */
+/* stdio.h */
+/* ---------------------------------------------------------------------------------------------- */
+
+#include
+
+#define ZYAN_FPUTS fputs
+#define ZYAN_FPUTC fputc
+#define ZYAN_FPRINTF fprintf
+#define ZYAN_PRINTF printf
+#define ZYAN_PUTC putc
+#define ZYAN_PUTS puts
+#define ZYAN_SCANF scanf
+#define ZYAN_SSCANF sscanf
+#define ZYAN_VSNPRINTF vsnprintf
+
+/**
+ * Defines the `ZyanFile` datatype.
+ */
+typedef FILE ZyanFile;
+
+#define ZYAN_STDIN stdin
+#define ZYAN_STDOUT stdout
+#define ZYAN_STDERR stderr
+
+/* ---------------------------------------------------------------------------------------------- */
+/* stdlib.h */
+/* ---------------------------------------------------------------------------------------------- */
+
+#include
+#define ZYAN_CALLOC calloc
+#define ZYAN_FREE free
+#define ZYAN_MALLOC malloc
+#define ZYAN_REALLOC realloc
+
+/* ---------------------------------------------------------------------------------------------- */
+/* string.h */
+/* ---------------------------------------------------------------------------------------------- */
+
+#include
+#define ZYAN_MEMCHR memchr
+#define ZYAN_MEMCMP memcmp
+#define ZYAN_MEMCPY memcpy
+#define ZYAN_MEMMOVE memmove
+#define ZYAN_MEMSET memset
+#define ZYAN_STRCAT strcat
+#define ZYAN_STRCHR strchr
+#define ZYAN_STRCMP strcmp
+#define ZYAN_STRCOLL strcoll
+#define ZYAN_STRCPY strcpy
+#define ZYAN_STRCSPN strcspn
+#define ZYAN_STRLEN strlen
+#define ZYAN_STRNCAT strncat
+#define ZYAN_STRNCMP strncmp
+#define ZYAN_STRNCPY strncpy
+#define ZYAN_STRPBRK strpbrk
+#define ZYAN_STRRCHR strrchr
+#define ZYAN_STRSPN strspn
+#define ZYAN_STRSTR strstr
+#define ZYAN_STRTOK strtok
+#define ZYAN_STRXFRM strxfrm
+
+/* ---------------------------------------------------------------------------------------------- */
+
+#else // if ZYAN_NO_LIBC
+
+/* ============================================================================================== */
+/* No LibC available, use our own functions */
+/* ============================================================================================== */
+
+#include
+#include
+
+/*
+ * These implementations are by no means optimized and will be outperformed by pretty much any
+ * libc implementation out there. We do not aim towards providing competetive implementations here,
+ * but towards providing a last resort fallback for environments without a working libc.
+ */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* stdarg.h */
+/* ---------------------------------------------------------------------------------------------- */
+
+#if defined(ZYAN_MSVC) || defined(ZYAN_ICC)
+
+/**
+ * Defines the `ZyanVAList` datatype.
+ */
+typedef char* ZyanVAList;
+
+# define ZYAN_VA_START __crt_va_start
+# define ZYAN_VA_ARG __crt_va_arg
+# define ZYAN_VA_END __crt_va_end
+# define ZYAN_VA_COPY(destination, source) ((destination) = (source))
+
+#elif defined(ZYAN_GNUC)
+
+/**
+ * Defines the `ZyanVAList` datatype.
+ */
+typedef __builtin_va_list ZyanVAList;
+
+# define ZYAN_VA_START(v, l) __builtin_va_start(v, l)
+# define ZYAN_VA_END(v) __builtin_va_end(v)
+# define ZYAN_VA_ARG(v, l) __builtin_va_arg(v, l)
+# define ZYAN_VA_COPY(d, s) __builtin_va_copy(d, s)
+
+#else
+# error "Unsupported compiler for no-libc mode."
+#endif
+
+/* ---------------------------------------------------------------------------------------------- */
+/* stdio.h */
+/* ---------------------------------------------------------------------------------------------- */
+
+// ZYAN_INLINE int ZYAN_VSNPRINTF (char* const buffer, ZyanUSize const count,
+// char const* const format, ZyanVAList args)
+// {
+// // We cant provide a fallback implementation for this function
+// ZYAN_UNUSED(buffer);
+// ZYAN_UNUSED(count);
+// ZYAN_UNUSED(format);
+// ZYAN_UNUSED(args);
+// return ZYAN_NULL;
+// }
+
+/* ---------------------------------------------------------------------------------------------- */
+/* stdlib.h */
+/* ---------------------------------------------------------------------------------------------- */
+
+// ZYAN_INLINE void* ZYAN_CALLOC(ZyanUSize nitems, ZyanUSize size)
+// {
+// // We cant provide a fallback implementation for this function
+// ZYAN_UNUSED(nitems);
+// ZYAN_UNUSED(size);
+// return ZYAN_NULL;
+// }
+//
+// ZYAN_INLINE void ZYAN_FREE(void *p)
+// {
+// // We cant provide a fallback implementation for this function
+// ZYAN_UNUSED(p);
+// }
+//
+// ZYAN_INLINE void* ZYAN_MALLOC(ZyanUSize n)
+// {
+// // We cant provide a fallback implementation for this function
+// ZYAN_UNUSED(n);
+// return ZYAN_NULL;
+// }
+//
+// ZYAN_INLINE void* ZYAN_REALLOC(void* p, ZyanUSize n)
+// {
+// // We cant provide a fallback implementation for this function
+// ZYAN_UNUSED(p);
+// ZYAN_UNUSED(n);
+// return ZYAN_NULL;
+// }
+
+/* ---------------------------------------------------------------------------------------------- */
+/* string.h */
+/* ---------------------------------------------------------------------------------------------- */
+
+ZYAN_INLINE void* ZYAN_MEMCHR(const void* str, int c, ZyanUSize n)
+{
+ const ZyanU8* p = (ZyanU8*)str;
+ while (n--)
+ {
+ if (*p != (ZyanU8)c)
+ {
+ p++;
+ } else
+ {
+ return (void*)p;
+ }
+ }
+ return 0;
+}
+
+ZYAN_INLINE int ZYAN_MEMCMP(const void* s1, const void* s2, ZyanUSize n)
+{
+ const ZyanU8* p1 = s1, *p2 = s2;
+ while (n--)
+ {
+ if (*p1 != *p2)
+ {
+ return *p1 - *p2;
+ }
+ p1++, p2++;
+ }
+ return 0;
+}
+
+ZYAN_INLINE void* ZYAN_MEMCPY(void* dst, const void* src, ZyanUSize n)
+{
+ volatile ZyanU8* dp = dst;
+ const ZyanU8* sp = src;
+ while (n--)
+ {
+ *dp++ = *sp++;
+ }
+ return dst;
+}
+
+ZYAN_INLINE void* ZYAN_MEMMOVE(void* dst, const void* src, ZyanUSize n)
+{
+ volatile ZyanU8* pd = dst;
+ const ZyanU8* ps = src;
+ if (ps < pd)
+ {
+ for (pd += n, ps += n; n--;)
+ {
+ *--pd = *--ps;
+ }
+ } else
+ {
+ while (n--)
+ {
+ *pd++ = *ps++;
+ }
+ }
+ return dst;
+}
+
+ZYAN_INLINE void* ZYAN_MEMSET(void* dst, int val, ZyanUSize n)
+{
+ volatile ZyanU8* p = dst;
+ while (n--)
+ {
+ *p++ = (unsigned char)val;
+ }
+ return dst;
+}
+
+ZYAN_INLINE char* ZYAN_STRCAT(char* dest, const char* src)
+{
+ char* ret = dest;
+ while (*dest)
+ {
+ dest++;
+ }
+ while ((*dest++ = *src++));
+ return ret;
+}
+
+ZYAN_INLINE char* ZYAN_STRCHR(const char* s, int c)
+{
+ while (*s != (char)c)
+ {
+ if (!*s++)
+ {
+ return 0;
+ }
+ }
+ return (char*)s;
+}
+
+ZYAN_INLINE int ZYAN_STRCMP(const char* s1, const char* s2)
+{
+ while (*s1 && (*s1 == *s2))
+ {
+ s1++, s2++;
+ }
+ return *(const ZyanU8*)s1 - *(const ZyanU8*)s2;
+}
+
+ZYAN_INLINE int ZYAN_STRCOLL(const char *s1, const char *s2)
+{
+ // TODO: Implement
+
+ ZYAN_UNUSED(s1);
+ ZYAN_UNUSED(s2);
+
+ return 0;
+}
+
+ZYAN_INLINE char* ZYAN_STRCPY(char* dest, const char* src)
+{
+ char* ret = dest;
+ while ((*dest++ = *src++));
+ return ret;
+}
+
+ZYAN_INLINE ZyanUSize ZYAN_STRCSPN(const char *s1, const char *s2)
+{
+ ZyanUSize ret = 0;
+ while (*s1)
+ {
+ if (ZYAN_STRCHR(s2, *s1))
+ {
+ return ret;
+ }
+ s1++, ret++;
+ }
+ return ret;
+}
+
+ZYAN_INLINE ZyanUSize ZYAN_STRLEN(const char* str)
+{
+ const char* p = str;
+ while (*str)
+ {
+ ++str;
+ }
+ return str - p;
+}
+
+ZYAN_INLINE char* ZYAN_STRNCAT(char* dest, const char* src, ZyanUSize n)
+{
+ char* ret = dest;
+ while (*dest)
+ {
+ dest++;
+ }
+ while (n--)
+ {
+ if (!(*dest++ = *src++))
+ {
+ return ret;
+ }
+ }
+ *dest = 0;
+ return ret;
+}
+
+ZYAN_INLINE int ZYAN_STRNCMP(const char* s1, const char* s2, ZyanUSize n)
+{
+ while (n--)
+ {
+ if (*s1++ != *s2++)
+ {
+ return *(unsigned char*)(s1 - 1) - *(unsigned char*)(s2 - 1);
+ }
+ }
+ return 0;
+}
+
+ZYAN_INLINE char* ZYAN_STRNCPY(char* dest, const char* src, ZyanUSize n)
+{
+ char* ret = dest;
+ do
+ {
+ if (!n--)
+ {
+ return ret;
+ }
+ } while ((*dest++ = *src++));
+ while (n--)
+ {
+ *dest++ = 0;
+ }
+ return ret;
+}
+
+ZYAN_INLINE char* ZYAN_STRPBRK(const char* s1, const char* s2)
+{
+ while (*s1)
+ {
+ if(ZYAN_STRCHR(s2, *s1++))
+ {
+ return (char*)--s1;
+ }
+ }
+ return 0;
+}
+
+ZYAN_INLINE char* ZYAN_STRRCHR(const char* s, int c)
+{
+ char* ret = 0;
+ do
+ {
+ if (*s == (char)c)
+ {
+ ret = (char*)s;
+ }
+ } while (*s++);
+ return ret;
+}
+
+ZYAN_INLINE ZyanUSize ZYAN_STRSPN(const char* s1, const char* s2)
+{
+ ZyanUSize ret = 0;
+ while (*s1 && ZYAN_STRCHR(s2, *s1++))
+ {
+ ret++;
+ }
+ return ret;
+}
+
+ZYAN_INLINE char* ZYAN_STRSTR(const char* s1, const char* s2)
+{
+ const ZyanUSize n = ZYAN_STRLEN(s2);
+ while (*s1)
+ {
+ if (!ZYAN_MEMCMP(s1++, s2, n))
+ {
+ return (char*)(s1 - 1);
+ }
+ }
+ return 0;
+}
+
+ZYAN_INLINE char* ZYAN_STRTOK(char* str, const char* delim)
+{
+ static char* p = 0;
+ if (str)
+ {
+ p = str;
+ } else
+ if (!p)
+ {
+ return 0;
+ }
+ str = p + ZYAN_STRSPN(p, delim);
+ p = str + ZYAN_STRCSPN(str, delim);
+ if (p == str)
+ {
+ return p = 0;
+ }
+ p = *p ? *p = 0, p + 1 : 0;
+ return str;
+}
+
+ZYAN_INLINE ZyanUSize ZYAN_STRXFRM(char* dest, const char* src, ZyanUSize n)
+{
+ const ZyanUSize n2 = ZYAN_STRLEN(src);
+ if (n > n2)
+ {
+ ZYAN_STRCPY(dest, src);
+ }
+ return n2;
+}
+
+/* ---------------------------------------------------------------------------------------------- */
+
+#endif
+
+#endif
+
+/* ============================================================================================== */
+
+#endif /* ZYCORE_LIBC_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/List.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/List.h
new file mode 100644
index 0000000..015a324
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/List.h
@@ -0,0 +1,574 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zycore-C)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Implements a doubly linked list.
+ */
+
+#ifndef ZYCORE_LIST_H
+#define ZYCORE_LIST_H
+
+#include
+#include
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+/**
+ * Defines the `ZyanListNode` struct.
+ *
+ * All fields in this struct should be considered as "private". Any changes may lead to unexpected
+ * behavior.
+ */
+typedef struct ZyanListNode_
+{
+ /**
+ * A pointer to the previous list node.
+ */
+ struct ZyanListNode_* prev;
+ /**
+ * A pointer to the next list node.
+ */
+ struct ZyanListNode_* next;
+} ZyanListNode;
+
+/**
+ * Defines the `ZyanList` struct.
+ *
+ * All fields in this struct should be considered as "private". Any changes may lead to unexpected
+ * behavior.
+ */
+typedef struct ZyanList_
+{
+ /**
+ * The memory allocator.
+ */
+ ZyanAllocator* allocator;
+ /**
+ * The current number of elements in the list.
+ */
+ ZyanUSize size;
+ /**
+ * The size of a single element in bytes.
+ */
+ ZyanUSize element_size;
+ /**
+ * The element destructor callback.
+ */
+ ZyanMemberProcedure destructor;
+ /**
+ * The head node.
+ */
+ ZyanListNode* head;
+ /**
+ * The tail node.
+ */
+ ZyanListNode* tail;
+ /**
+ * The data buffer.
+ *
+ * Only used for instances created by `ZyanListInitCustomBuffer`.
+ */
+ void* buffer;
+ /**
+ * The data buffer capacity (number of bytes).
+ *
+ * Only used for instances created by `ZyanListInitCustomBuffer`.
+ */
+ ZyanUSize capacity;
+ /**
+ * The first unused node.
+ *
+ * When removing a node, the first-unused value is updated to point at the removed node and the
+ * next node of the removed node will be updated to point at the old first-unused node.
+ *
+ * When appending the memory of the first unused-node is recycled to store the new node. The
+ * value of the first-unused node is then updated to point at the reused nodes next node.
+ *
+ * If the first-unused value is `ZYAN_NULL`, any new node will be "allocated" behind the tail
+ * node (if there is enough space left in the fixed size buffer).
+ *
+ * Only used for instances created by `ZyanListInitCustomBuffer`.
+ */
+ ZyanListNode* first_unused;
+} ZyanList;
+
+/* ============================================================================================== */
+/* Macros */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* General */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines an uninitialized `ZyanList` instance.
+ */
+#define ZYAN_LIST_INITIALIZER \
+ { \
+ /* allocator */ ZYAN_NULL, \
+ /* size */ 0, \
+ /* element_size */ 0, \
+ /* head */ ZYAN_NULL, \
+ /* destructor */ ZYAN_NULL, \
+ /* tail */ ZYAN_NULL, \
+ /* buffer */ ZYAN_NULL, \
+ /* capacity */ 0, \
+ /* first_unused */ ZYAN_NULL \
+ }
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Helper macros */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the data value of the given `node`.
+ *
+ * @param type The desired value type.
+ * @param node A pointer to the `ZyanListNode` struct.
+ *
+ * @result The data value of the given `node`.
+ *
+ * Note that this function is unsafe and might dereference a null-pointer.
+ */
+#ifdef __cplusplus
+#define ZYAN_LIST_GET(type, node) \
+ (*reinterpret_cast(ZyanListGetNodeData(node)))
+#else
+#define ZYAN_LIST_GET(type, node) \
+ (*(const type*)ZyanListGetNodeData(node))
+#endif
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Constructor and destructor */
+/* ---------------------------------------------------------------------------------------------- */
+
+#ifndef ZYAN_NO_LIBC
+
+/**
+ * Initializes the given `ZyanList` instance.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ * @param element_size The size of a single element in bytes.
+ * @param destructor A destructor callback that is invoked every time an item is deleted, or
+ * `ZYAN_NULL` if not needed.
+ *
+ * @return A zyan status code.
+ *
+ * The memory for the list elements is dynamically allocated by the default allocator.
+ *
+ * Finalization with `ZyanListDestroy` is required for all instances created by this function.
+ */
+ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanListInit(ZyanList* list, ZyanUSize element_size,
+ ZyanMemberProcedure destructor);
+
+#endif // ZYAN_NO_LIBC
+
+/**
+ * Initializes the given `ZyanList` instance and sets a custom `allocator`.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ * @param element_size The size of a single element in bytes.
+ * @param destructor A destructor callback that is invoked every time an item is deleted, or
+ * `ZYAN_NULL` if not needed.
+ * @param allocator A pointer to a `ZyanAllocator` instance.
+ *
+ * @return A zyan status code.
+ *
+ * Finalization with `ZyanListDestroy` is required for all instances created by this function.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListInitEx(ZyanList* list, ZyanUSize element_size,
+ ZyanMemberProcedure destructor, ZyanAllocator* allocator);
+
+/**
+ * Initializes the given `ZyanList` instance and configures it to use a custom user
+ * defined buffer with a fixed size.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ * @param element_size The size of a single element in bytes.
+ * @param destructor A destructor callback that is invoked every time an item is deleted, or
+ * `ZYAN_NULL` if not needed.
+ * @param buffer A pointer to the buffer that is used as storage for the elements.
+ * @param capacity The maximum capacity (number of bytes) of the buffer including the
+ * space required for the list-nodes.
+ *
+ * @return A zyan status code.
+ *
+ * The buffer capacity required to store `n` elements of type `T` is be calculated by:
+ * `size = n * sizeof(ZyanListNode) + n * sizeof(T)`
+ *
+ * Finalization is not required for instances created by this function.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListInitCustomBuffer(ZyanList* list, ZyanUSize element_size,
+ ZyanMemberProcedure destructor, void* buffer, ZyanUSize capacity);
+
+/**
+ * Destroys the given `ZyanList` instance.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListDestroy(ZyanList* list);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Duplication */
+/* ---------------------------------------------------------------------------------------------- */
+
+#ifndef ZYAN_NO_LIBC
+
+/**
+ * Initializes a new `ZyanList` instance by duplicating an existing list.
+ *
+ * @param destination A pointer to the (uninitialized) destination `ZyanList` instance.
+ * @param source A pointer to the source list.
+ *
+ * @return A zyan status code.
+ *
+ * The memory for the list is dynamically allocated by the default allocator.
+ *
+ * Finalization with `ZyanListDestroy` is required for all instances created by this function.
+ */
+ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanListDuplicate(ZyanList* destination,
+ const ZyanList* source);
+
+#endif // ZYAN_NO_LIBC
+
+/**
+ * Initializes a new `ZyanList` instance by duplicating an existing list and sets a
+ * custom `allocator`.
+ *
+ * @param destination A pointer to the (uninitialized) destination `ZyanList` instance.
+ * @param source A pointer to the source list.
+ * @param allocator A pointer to a `ZyanAllocator` instance.
+ *
+ * @return A zyan status code.
+
+ * Finalization with `ZyanListDestroy` is required for all instances created by this function.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListDuplicateEx(ZyanList* destination, const ZyanList* source,
+ ZyanAllocator* allocator);
+
+/**
+ * Initializes a new `ZyanList` instance by duplicating an existing list and
+ * configures it to use a custom user defined buffer with a fixed size.
+ *
+ * @param destination A pointer to the (uninitialized) destination `ZyanList` instance.
+ * @param source A pointer to the source list.
+ * @param buffer A pointer to the buffer that is used as storage for the elements.
+ * @param capacity The maximum capacity (number of bytes) of the buffer including the
+ * space required for the list-nodes.
+
+ * This function will fail, if the capacity of the buffer is not sufficient
+ * to store all elements of the source list.
+ *
+ * @return A zyan status code.
+ *
+ * The buffer capacity required to store `n` elements of type `T` is be calculated by:
+ * `size = n * sizeof(ZyanListNode) + n * sizeof(T)`
+ *
+ * Finalization is not required for instances created by this function.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListDuplicateCustomBuffer(ZyanList* destination,
+ const ZyanList* source, void* buffer, ZyanUSize capacity);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Item access */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns a pointer to the first `ZyanListNode` struct of the given list.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ * @param node Receives a pointer to the first `ZyanListNode` struct of the list.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListGetHeadNode(const ZyanList* list, const ZyanListNode** node);
+
+/**
+ * Returns a pointer to the last `ZyanListNode` struct of the given list.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ * @param node Receives a pointer to the last `ZyanListNode` struct of the list.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListGetTailNode(const ZyanList* list, const ZyanListNode** node);
+
+/**
+ * Receives a pointer to the previous `ZyanListNode` struct linked to the passed one.
+ *
+ * @param node Receives a pointer to the previous `ZyanListNode` struct linked to the passed
+ * one.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListGetPrevNode(const ZyanListNode** node);
+
+/**
+ * Receives a pointer to the next `ZyanListNode` struct linked to the passed one.
+ *
+ * @param node Receives a pointer to the next `ZyanListNode` struct linked to the passed one.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListGetNextNode(const ZyanListNode** node);
+
+/**
+ * Returns a constant pointer to the data of the given `node`.
+ *
+ * @param node A pointer to the `ZyanListNode` struct.
+ *
+ * @return A constant pointer to the the data of the given `node` or `ZYAN_NULL`, if an error
+ * occured.
+ *
+ * Take a look at `ZyanListGetNodeDataEx`, if you need a function that returns a zyan status code.
+ */
+ZYCORE_EXPORT const void* ZyanListGetNodeData(const ZyanListNode* node);
+
+/**
+ * Returns a constant pointer to the data of the given `node`..
+ *
+ * @param node A pointer to the `ZyanListNode` struct.
+ * @param value Receives a constant pointer to the data of the given `node`.
+ *
+ * Take a look at `ZyanListGetNodeData`, if you need a function that directly returns a pointer.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListGetNodeDataEx(const ZyanListNode* node, const void** value);
+
+/**
+ * Returns a mutable pointer to the data of the given `node`.
+ *
+ * @param node A pointer to the `ZyanListNode` struct.
+ *
+ * @return A mutable pointer to the the data of the given `node` or `ZYAN_NULL`, if an error
+ * occured.
+ *
+ * Take a look at `ZyanListGetPointerMutableEx` instead, if you need a function that returns a
+ * zyan status code.
+ */
+ZYCORE_EXPORT void* ZyanListGetNodeDataMutable(const ZyanListNode* node);
+
+/**
+ * Returns a mutable pointer to the data of the given `node`..
+ *
+ * @param node A pointer to the `ZyanListNode` struct.
+ * @param value Receives a mutable pointer to the data of the given `node`.
+ *
+ * Take a look at `ZyanListGetNodeDataMutable`, if you need a function that directly returns a
+ * pointer.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListGetNodeDataMutableEx(const ZyanListNode* node, void** value);
+
+/**
+ * Assigns a new data value to the given `node`.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ * @param node A pointer to the `ZyanListNode` struct.
+ * @param value The value to assign.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListSetNodeData(const ZyanList* list, const ZyanListNode* node,
+ const void* value);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Insertion */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Adds a new `item` to the end of the list.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ * @param item A pointer to the item to add.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListPushBack(ZyanList* list, const void* item);
+
+/**
+ * Adds a new `item` to the beginning of the list.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ * @param item A pointer to the item to add.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListPushFront(ZyanList* list, const void* item);
+
+/**
+ * Constructs an `item` in-place at the end of the list.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ * @param item Receives a pointer to the new item.
+ * @param constructor The constructor callback or `ZYAN_NULL`. The new item will be in
+ * undefined state, if no constructor was passed.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListEmplaceBack(ZyanList* list, void** item,
+ ZyanMemberFunction constructor);
+
+/**
+ * Constructs an `item` in-place at the beginning of the list.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ * @param item Receives a pointer to the new item.
+ * @param constructor The constructor callback or `ZYAN_NULL`. The new item will be in
+ * undefined state, if no constructor was passed.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListEmplaceFront(ZyanList* list, void** item,
+ ZyanMemberFunction constructor);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Deletion */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Removes the last element of the list.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListPopBack(ZyanList* list);
+
+/**
+ * Removes the firstelement of the list.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListPopFront(ZyanList* list);
+
+/**
+ * Removes the given `node` from the list.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ * @param node A pointer to the `ZyanListNode` struct.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListRemove(ZyanList* list, const ZyanListNode* node);
+
+/**
+ * Removes multiple nodes from the list.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ * @param first A pointer to the first node.
+ * @param last A pointer to the last node.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListRemoveRange(ZyanList* list, const ZyanListNode* first,
+ const ZyanListNode* last);
+
+/**
+ * Erases all elements of the list.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListClear(ZyanList* list);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Searching */
+/* ---------------------------------------------------------------------------------------------- */
+
+// TODO:
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Memory management */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Resizes the given `ZyanList` instance.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ * @param size The new size of the list.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListResize(ZyanList* list, ZyanUSize size);
+
+/**
+ * Resizes the given `ZyanList` instance.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ * @param size The new size of the list.
+ * @param initializer A pointer to a value to be used as initializer for new items.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListResizeEx(ZyanList* list, ZyanUSize size, const void* initializer);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Information */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the current size of the list.
+ *
+ * @param list A pointer to the `ZyanList` instance.
+ * @param size Receives the size of the list.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanListGetSize(const ZyanList* list, ZyanUSize* size);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYCORE_VECTOR_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Object.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Object.h
new file mode 100644
index 0000000..d015cef
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Object.h
@@ -0,0 +1,84 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zycore-C)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Defines some generic object-related datatypes.
+ */
+
+#ifndef ZYCORE_OBJECT_H
+#define ZYCORE_OBJECT_H
+
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+/**
+ * Defines the `ZyanMemberProcedure` function prototype.
+ *
+ * @param object A pointer to the object.
+ */
+typedef void (*ZyanMemberProcedure)(void* object);
+
+/**
+ * Defines the `ZyanConstMemberProcedure` function prototype.
+ *
+ * @param object A pointer to the object.
+ */
+typedef void (*ZyanConstMemberProcedure)(const void* object);
+
+/**
+ * Defines the `ZyanMemberFunction` function prototype.
+ *
+ * @param object A pointer to the object.
+ *
+ * @return A zyan status code.
+ */
+typedef ZyanStatus (*ZyanMemberFunction)(void* object);
+
+/**
+ * Defines the `ZyanConstMemberFunction` function prototype.
+ *
+ * @param object A pointer to the object.
+ *
+ * @return A zyan status code.
+ */
+typedef ZyanStatus (*ZyanConstMemberFunction)(const void* object);
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYCORE_OBJECT_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Status.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Status.h
new file mode 100644
index 0000000..b0d7fdf
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Status.h
@@ -0,0 +1,287 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zyan-C)
+
+ Original Author : Florian Bernd, Joel Hoener
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Status code definitions and check macros.
+ */
+
+#ifndef ZYCORE_STATUS_H
+#define ZYCORE_STATUS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+/**
+ * Defines the `ZyanStatus` data type.
+ */
+typedef ZyanU32 ZyanStatus;
+
+/* ============================================================================================== */
+/* Macros */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Definition */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines a zyan status code.
+ *
+ * @param error `1`, if the status code signals an error or `0`, if not.
+ * @param module The module id.
+ * @param code The actual code.
+ *
+ * @return The zyan status code.
+ */
+#define ZYAN_MAKE_STATUS(error, module, code) \
+ (ZyanStatus)((((error) & 0x01u) << 31u) | (((module) & 0x7FFu) << 20u) | ((code) & 0xFFFFFu))
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Checks */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Checks if a zyan operation was successful.
+ *
+ * @param status The zyan status-code to check.
+ *
+ * @return `ZYAN_TRUE`, if the operation succeeded or `ZYAN_FALSE`, if not.
+ */
+#define ZYAN_SUCCESS(status) \
+ (!((status) & 0x80000000u))
+
+/**
+ * Checks if a zyan operation failed.
+ *
+ * @param status The zyan status-code to check.
+ *
+ * @return `ZYAN_TRUE`, if the operation failed or `ZYAN_FALSE`, if not.
+ */
+#define ZYAN_FAILED(status) \
+ ((status) & 0x80000000u)
+
+/**
+ * Checks if a zyan operation was successful and returns with the status-code, if not.
+ *
+ * @param status The zyan status-code to check.
+ */
+#define ZYAN_CHECK(status) \
+ do \
+ { \
+ const ZyanStatus status_047620348 = (status); \
+ if (!ZYAN_SUCCESS(status_047620348)) \
+ { \
+ return status_047620348; \
+ } \
+ } while (0)
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Information */
+/* ---------------------------------------------------------------------------------------------- */
+
+ /**
+ * Returns the module id of a zyan status-code.
+ *
+ * @param status The zyan status-code.
+ *
+ * @return The module id of the zyan status-code.
+ */
+#define ZYAN_STATUS_MODULE(status) \
+ (((status) >> 20) & 0x7FFu)
+
+ /**
+ * Returns the code of a zyan status-code.
+ *
+ * @param status The zyan status-code.
+ *
+ * @return The code of the zyan status-code.
+ */
+#define ZYAN_STATUS_CODE(status) \
+ ((status) & 0xFFFFFu)
+
+/* ============================================================================================== */
+/* Status codes */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Module IDs */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * The zycore generic module id.
+ */
+#define ZYAN_MODULE_ZYCORE 0x001u
+
+/**
+ * The zycore arg-parse submodule id.
+ */
+#define ZYAN_MODULE_ARGPARSE 0x003u
+
+/**
+ * The base module id for user-defined status codes.
+ */
+#define ZYAN_MODULE_USER 0x3FFu
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Status codes (general purpose) */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * The operation completed successfully.
+ */
+#define ZYAN_STATUS_SUCCESS \
+ ZYAN_MAKE_STATUS(0u, ZYAN_MODULE_ZYCORE, 0x00u)
+
+/**
+ * The operation failed with an generic error.
+ */
+#define ZYAN_STATUS_FAILED \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYCORE, 0x01u)
+
+/**
+ * The operation completed successfully and returned `ZYAN_TRUE`.
+ */
+#define ZYAN_STATUS_TRUE \
+ ZYAN_MAKE_STATUS(0u, ZYAN_MODULE_ZYCORE, 0x02u)
+
+/**
+ * The operation completed successfully and returned `ZYAN_FALSE`.
+ */
+#define ZYAN_STATUS_FALSE \
+ ZYAN_MAKE_STATUS(0u, ZYAN_MODULE_ZYCORE, 0x03u)
+
+/**
+ * An invalid argument was passed to a function.
+ */
+#define ZYAN_STATUS_INVALID_ARGUMENT \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYCORE, 0x04u)
+
+/**
+ * An attempt was made to perform an invalid operation.
+ */
+#define ZYAN_STATUS_INVALID_OPERATION \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYCORE, 0x05u)
+
+/**
+ * Insufficient privileges to perform the requested operation.
+ */
+#define ZYAN_STATUS_ACCESS_DENIED \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYCORE, 0x06u)
+
+/**
+ * The requested entity was not found.
+ */
+#define ZYAN_STATUS_NOT_FOUND \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYCORE, 0x07u)
+
+/**
+ * An index passed to a function was out of bounds.
+ */
+#define ZYAN_STATUS_OUT_OF_RANGE \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYCORE, 0x08u)
+
+/**
+ * A buffer passed to a function was too small to complete the requested operation.
+ */
+#define ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYCORE, 0x09u)
+
+/**
+ * Insufficient memory to perform the operation.
+ */
+#define ZYAN_STATUS_NOT_ENOUGH_MEMORY \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYCORE, 0x0Au)
+
+/**
+ * An unknown error occurred during a system function call.
+ */
+#define ZYAN_STATUS_BAD_SYSTEMCALL \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYCORE, 0x0Bu)
+
+/**
+ * The process ran out of resources while performing an operation.
+ */
+#define ZYAN_STATUS_OUT_OF_RESOURCES \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYCORE, 0x0Cu)
+
+/**
+ * A dependency library was not found or does have an unexpected version number or
+ * feature-set.
+ */
+#define ZYAN_STATUS_MISSING_DEPENDENCY \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYCORE, 0x0Du)
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Status codes (arg parse) */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Argument was not expected.
+ */
+#define ZYAN_STATUS_ARG_NOT_UNDERSTOOD \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ARGPARSE, 0x00u)
+
+/**
+ * Too few arguments were provided.
+ */
+#define ZYAN_STATUS_TOO_FEW_ARGS \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ARGPARSE, 0x01u)
+
+/**
+ * Too many arguments were provided.
+ */
+#define ZYAN_STATUS_TOO_MANY_ARGS \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ARGPARSE, 0x02u)
+
+/**
+ * An argument that expected a value misses its value.
+ */
+#define ZYAN_STATUS_ARG_MISSES_VALUE \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ARGPARSE, 0x03u)
+
+/**
+* A required argument is missing.
+*/
+#define ZYAN_STATUS_REQUIRED_ARG_MISSING \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ARGPARSE, 0x04u)
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYCORE_STATUS_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/String.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/String.h
new file mode 100644
index 0000000..c3157bc
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/String.h
@@ -0,0 +1,1012 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zycore-C)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Implements a string type.
+ */
+
+#ifndef ZYCORE_STRING_H
+#define ZYCORE_STRING_H
+
+#include
+#include
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Constants */
+/* ============================================================================================== */
+
+/**
+ * The initial minimum capacity (number of characters) for all dynamically allocated
+ * string instances - not including the terminating '\0'-character.
+ */
+#define ZYAN_STRING_MIN_CAPACITY 32
+
+/**
+ * The default growth factor for all string instances.
+ */
+#define ZYAN_STRING_DEFAULT_GROWTH_FACTOR 2.00f
+
+/**
+ * The default shrink threshold for all string instances.
+ */
+#define ZYAN_STRING_DEFAULT_SHRINK_THRESHOLD 0.25f
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* String flags */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZyanStringFlags` datatype.
+ */
+typedef ZyanU8 ZyanStringFlags;
+
+/**
+ * The string uses a custom user-defined buffer with a fixed capacity.
+ */
+#define ZYAN_STRING_HAS_FIXED_CAPACITY 0x01 // (1 << 0)
+
+/* ---------------------------------------------------------------------------------------------- */
+/* String */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZyanString` struct.
+ *
+ * The `ZyanString` type is implemented as a size-prefixed string - which allows for a lot of
+ * performance optimizations.
+ * Nevertheless null-termination is guaranteed at all times to provide maximum compatibility with
+ * default C-style strings (use `ZyanStringGetData` to access the C-style string).
+ *
+ * All fields in this struct should be considered as "private". Any changes may lead to unexpected
+ * behavior.
+ */
+typedef struct ZyanString_
+{
+ /**
+ * String flags.
+ */
+ ZyanStringFlags flags;
+ /**
+ * The vector that contains the actual string.
+ */
+ ZyanVector vector;
+} ZyanString;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* View */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZyanStringView` struct.
+ *
+ * The `ZyanStringView` type provides a view inside a string (`ZyanString` instances, null-
+ * terminated C-style strings, or even not-null-terminated custom strings). A view is immutable
+ * by design and can't be directly converted to a C-style string.
+ *
+ * Views might become invalid (e.g. pointing to invalid memory), if the underlying string gets
+ * destroyed or resized.
+ *
+ * The `ZYAN_STRING_TO_VIEW` macro can be used to cast a `ZyanString` to a `ZyanStringView` pointer
+ * without any runtime overhead.
+ * Casting a view to a normal string is not supported and will lead to unexpected behavior (use
+ * `ZyanStringDuplicate` to create a deep-copy instead).
+ *
+ * All fields in this struct should be considered as "private". Any changes may lead to unexpected
+ * behavior.
+ */
+typedef struct ZyanStringView_
+{
+ /**
+ * The string data.
+ *
+ * The view internally re-uses the normal string struct to allow casts without any runtime
+ * overhead.
+ */
+ ZyanString string;
+} ZyanStringView;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Macros */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* General */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines an uninitialized `ZyanString` instance.
+ */
+#define ZYAN_STRING_INITIALIZER \
+ { \
+ /* flags */ 0, \
+ /* vector */ ZYAN_VECTOR_INITIALIZER \
+ }
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Helper macros */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Casts a `ZyanString` pointer to a constant `ZyanStringView` pointer.
+ */
+#define ZYAN_STRING_TO_VIEW(string) (const ZyanStringView*)(string)
+
+/**
+ * Defines a `ZyanStringView` struct that provides a view into a static C-style string.
+ *
+ * @param string The C-style string.
+ */
+#define ZYAN_DEFINE_STRING_VIEW(string) \
+ { \
+ /* string */ \
+ { \
+ /* flags */ 0, \
+ /* vector */ \
+ { \
+ /* allocator */ ZYAN_NULL, \
+ /* growth_factor */ 1.0f, \
+ /* shrink_threshold */ 0.0f, \
+ /* size */ sizeof(string), \
+ /* capacity */ sizeof(string), \
+ /* element_size */ sizeof(char), \
+ /* destructor */ ZYAN_NULL, \
+ /* data */ (char*)(string) \
+ } \
+ } \
+ }
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Constructor and destructor */
+/* ---------------------------------------------------------------------------------------------- */
+
+#ifndef ZYAN_NO_LIBC
+
+/**
+ * Initializes the given `ZyanString` instance.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param capacity The initial capacity (number of characters).
+ *
+ * @return A zyan status code.
+ *
+ * The memory for the string is dynamically allocated by the default allocator using the default
+ * growth factor of `2.0f` and the default shrink threshold of `0.25f`.
+ *
+ * The allocated buffer will be at least one character larger than the given `capacity`, to reserve
+ * space for the terminating '\0'.
+ *
+ * Finalization with `ZyanStringDestroy` is required for all strings created by this function.
+ */
+ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanStringInit(ZyanString* string, ZyanUSize capacity);
+
+#endif // ZYAN_NO_LIBC
+
+/**
+ * Initializes the given `ZyanString` instance and sets a custom `allocator` and memory
+ * allocation/deallocation parameters.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param capacity The initial capacity (number of characters).
+ * @param allocator A pointer to a `ZyanAllocator` instance.
+ * @param growth_factor The growth factor (from `1.0f` to `x.xf`).
+ * @param shrink_threshold The shrink threshold (from `0.0f` to `1.0f`).
+ *
+ * @return A zyan status code.
+ *
+ * A growth factor of `1.0f` disables overallocation and a shrink threshold of `0.0f` disables
+ * dynamic shrinking.
+ *
+ * The allocated buffer will be at least one character larger than the given `capacity`, to reserve
+ * space for the terminating '\0'.
+ *
+ * Finalization with `ZyanStringDestroy` is required for all strings created by this function.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringInitEx(ZyanString* string, ZyanUSize capacity,
+ ZyanAllocator* allocator, float growth_factor, float shrink_threshold);
+
+/**
+ * Initializes the given `ZyanString` instance and configures it to use a custom user
+ * defined buffer with a fixed size.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param buffer A pointer to the buffer that is used as storage for the string.
+ * @param capacity The maximum capacity (number of characters) of the buffer, including
+ * the terminating '\0'.
+ *
+ * @return A zyan status code.
+ *
+ * Finalization is not required for strings created by this function.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringInitCustomBuffer(ZyanString* string, char* buffer,
+ ZyanUSize capacity);
+
+/**
+ * Destroys the given `ZyanString` instance.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ *
+ * @return A zyan status code.
+ *
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringDestroy(ZyanString* string);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Duplication */
+/* ---------------------------------------------------------------------------------------------- */
+
+#ifndef ZYAN_NO_LIBC
+
+/**
+ * Initializes a new `ZyanString` instance by duplicating an existing string.
+ *
+ * @param destination A pointer to the (uninitialized) destination `ZyanString` instance.
+ * @param source A pointer to the source string.
+ * @param capacity The initial capacity (number of characters).
+ *
+ * This value is automatically adjusted to the size of the source string, if
+ * a smaller value was passed.
+ *
+ * @return A zyan status code.
+ *
+ * The behavior of this function is undefined, if `source` is a view into the `destination`
+ * string or `destination` points to an already initialized `ZyanString` instance.
+ *
+ * The memory for the string is dynamically allocated by the default allocator using the default
+ * growth factor of `2.0f` and the default shrink threshold of `0.25f`.
+ *
+ * The allocated buffer will be at least one character larger than the given `capacity`, to reserve
+ * space for the terminating '\0'.
+ *
+ * Finalization with `ZyanStringDestroy` is required for all strings created by this function.
+ */
+ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanStringDuplicate(ZyanString* destination,
+ const ZyanStringView* source, ZyanUSize capacity);
+
+#endif // ZYAN_NO_LIBC
+
+/**
+ * Initializes a new `ZyanString` instance by duplicating an existing string and sets a
+ * custom `allocator` and memory allocation/deallocation parameters.
+ *
+ * @param destination A pointer to the (uninitialized) destination `ZyanString` instance.
+ * @param source A pointer to the source string.
+ * @param capacity The initial capacity (number of characters).
+
+ * This value is automatically adjusted to the size of the source
+ * string, if a smaller value was passed.
+ * @param allocator A pointer to a `ZyanAllocator` instance.
+ * @param growth_factor The growth factor (from `1.0f` to `x.xf`).
+ * @param shrink_threshold The shrink threshold (from `0.0f` to `1.0f`).
+ *
+ * @return A zyan status code.
+ *
+ * The behavior of this function is undefined, if `source` is a view into the `destination`
+ * string or `destination` points to an already initialized `ZyanString` instance.
+ *
+ * A growth factor of `1.0f` disables overallocation and a shrink threshold of `0.0f` disables
+ * dynamic shrinking.
+ *
+ * The allocated buffer will be at least one character larger than the given `capacity`, to reserve
+ * space for the terminating '\0'.
+ *
+ * Finalization with `ZyanStringDestroy` is required for all strings created by this function.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringDuplicateEx(ZyanString* destination,
+ const ZyanStringView* source, ZyanUSize capacity, ZyanAllocator* allocator,
+ float growth_factor, float shrink_threshold);
+
+/**
+ * Initializes a new `ZyanString` instance by duplicating an existing string and
+ * configures it to use a custom user defined buffer with a fixed size.
+ *
+ * @param destination A pointer to the (uninitialized) destination `ZyanString` instance.
+ * @param source A pointer to the source string.
+ * @param buffer A pointer to the buffer that is used as storage for the string.
+ * @param capacity The maximum capacity (number of characters) of the buffer, including the
+ * terminating '\0'.
+
+ * This function will fail, if the capacity of the buffer is less or equal to
+ * the size of the source string.
+ *
+ * @return A zyan status code.
+ *
+ * The behavior of this function is undefined, if `source` is a view into the `destination`
+ * string or `destination` points to an already initialized `ZyanString` instance.
+ *
+ * Finalization is not required for strings created by this function.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringDuplicateCustomBuffer(ZyanString* destination,
+ const ZyanStringView* source, char* buffer, ZyanUSize capacity);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Concatenation */
+/* ---------------------------------------------------------------------------------------------- */
+
+#ifndef ZYAN_NO_LIBC
+
+/**
+ * Initializes a new `ZyanString` instance by concatenating two existing strings.
+ *
+ * @param destination A pointer to the (uninitialized) destination `ZyanString` instance.
+ *
+ * This function will fail, if the destination `ZyanString` instance equals
+ * one of the source strings.
+ * @param s1 A pointer to the first source string.
+ * @param s2 A pointer to the second source string.
+ * @param capacity The initial capacity (number of characters).
+
+ * This value is automatically adjusted to the combined size of the source
+ * strings, if a smaller value was passed.
+ *
+ * @return A zyan status code.
+ *
+ * The behavior of this function is undefined, if `s1` or `s2` are views into the `destination`
+ * string or `destination` points to an already initialized `ZyanString` instance.
+ *
+ * The memory for the string is dynamically allocated by the default allocator using the default
+ * growth factor of `2.0f` and the default shrink threshold of `0.25f`.
+ *
+ * The allocated buffer will be at least one character larger than the given `capacity`, to reserve
+ * space for the terminating '\0'.
+ *
+ * Finalization with `ZyanStringDestroy` is required for all strings created by this function.
+ */
+ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanStringConcat(ZyanString* destination,
+ const ZyanStringView* s1, const ZyanStringView* s2, ZyanUSize capacity);
+
+#endif // ZYAN_NO_LIBC
+
+/**
+ * Initializes a new `ZyanString` instance by concatenating two existing strings and sets
+ * a custom `allocator` and memory allocation/deallocation parameters.
+ *
+ * @param destination A pointer to the (uninitialized) destination `ZyanString` instance.
+ *
+ * This function will fail, if the destination `ZyanString` instance
+ * equals one of the source strings.
+ * @param s1 A pointer to the first source string.
+ * @param s2 A pointer to the second source string.
+ * @param capacity The initial capacity (number of characters).
+ *
+ * This value is automatically adjusted to the combined size of the
+ * source strings, if a smaller value was passed.
+ * @param allocator A pointer to a `ZyanAllocator` instance.
+ * @param growth_factor The growth factor (from `1.0f` to `x.xf`).
+ * @param shrink_threshold The shrink threshold (from `0.0f` to `1.0f`).
+ *
+ * @return A zyan status code.
+ *
+ * The behavior of this function is undefined, if `s1` or `s2` are views into the `destination`
+ * string or `destination` points to an already initialized `ZyanString` instance.
+ *
+ * A growth factor of `1.0f` disables overallocation and a shrink threshold of `0.0f` disables
+ * dynamic shrinking.
+ *
+ * The allocated buffer will be at least one character larger than the given `capacity`, to reserve
+ * space for the terminating '\0'.
+ *
+ * Finalization with `ZyanStringDestroy` is required for all strings created by this function.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringConcatEx(ZyanString* destination, const ZyanStringView* s1,
+ const ZyanStringView* s2, ZyanUSize capacity, ZyanAllocator* allocator, float growth_factor,
+ float shrink_threshold);
+
+/**
+ * Initializes a new `ZyanString` instance by concatenating two existing strings and
+ * configures it to use a custom user defined buffer with a fixed size.
+ *
+ * @param destination A pointer to the (uninitialized) destination `ZyanString` instance.
+ *
+ * This function will fail, if the destination `ZyanString` instance equals
+ * one of the source strings.
+ * @param s1 A pointer to the first source string.
+ * @param s2 A pointer to the second source string.
+ * @param buffer A pointer to the buffer that is used as storage for the string.
+ * @param capacity The maximum capacity (number of characters) of the buffer.
+ *
+ * This function will fail, if the capacity of the buffer is less or equal to
+ * the combined size of the source strings.
+ *
+ * @return A zyan status code.
+ *
+ * The behavior of this function is undefined, if `s1` or `s2` are views into the `destination`
+ * string or `destination` points to an already initialized `ZyanString` instance.
+ *
+ * Finalization is not required for strings created by this function.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringConcatCustomBuffer(ZyanString* destination,
+ const ZyanStringView* s1, const ZyanStringView* s2, char* buffer, ZyanUSize capacity);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Views */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns a view inside an existing view/string.
+ *
+ * @param view A pointer to the `ZyanStringView` instance.
+ * @param source A pointer to the source string.
+ *
+ * @return A zyan status code.
+ *
+ * The `ZYAN_STRING_TO_VEW` macro can be used to pass any `ZyanString` instance as value for the
+ * `source` string.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringViewInsideView(ZyanStringView* view,
+ const ZyanStringView* source);
+
+/**
+ * Returns a view inside an existing view/string starting from the given `index`.
+ *
+ * @param view A pointer to the `ZyanStringView` instance.
+ * @param source A pointer to the source string.
+ * @param index The start index.
+ * @param count The number of characters.
+ *
+ * @return A zyan status code.
+ *
+ * The `ZYAN_STRING_TO_VEW` macro can be used to pass any `ZyanString` instance as value for the
+ * `source` string.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringViewInsideViewEx(ZyanStringView* view,
+ const ZyanStringView* source, ZyanUSize index, ZyanUSize count);
+
+/**
+ * Returns a view inside a null-terminated C-style string.
+ *
+ * @param view A pointer to the `ZyanStringView` instance.
+ * @param string The C-style string.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringViewInsideBuffer(ZyanStringView* view, const char* string);
+
+/**
+ * Returns a view inside a character buffer with custom length.
+ *
+ * @param view A pointer to the `ZyanStringView` instance.
+ * @param buffer A pointer to the buffer containing the string characters.
+ * @param length The length of the string (number of characters).
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringViewInsideBufferEx(ZyanStringView* view, const char* buffer,
+ ZyanUSize length);
+
+/**
+ * Returns the size (number of characters) of the view.
+ *
+ * @param view A pointer to the `ZyanStringView` instance.
+ * @param size Receives the size (number of characters) of the view.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringViewGetSize(const ZyanStringView* view, ZyanUSize* size);
+
+/**
+ * Returns the C-style string of the given `ZyanString` instance.
+ *
+ * @warning The string is not guaranteed to be null terminated!
+ *
+ * @param string A pointer to the `ZyanStringView` instance.
+ * @param value Receives a pointer to the C-style string.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringViewGetData(const ZyanStringView* view, const char** buffer);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Character access */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the character at the given `index`.
+ *
+ * @param string A pointer to the `ZyanStringView` instance.
+ * @param index The character index.
+ * @param value Receives the desired character of the string.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringGetChar(const ZyanStringView* string, ZyanUSize index,
+ char* value);
+
+/**
+ * Returns a pointer to the character at the given `index`.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param index The character index.
+ * @param value Receives a pointer to the desired character in the string.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringGetCharMutable(ZyanString* string, ZyanUSize index,
+ char** value);
+
+/**
+ * Assigns a new value to the character at the given `index`.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param index The character index.
+ * @param value The character to assign.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringSetChar(ZyanString* string, ZyanUSize index, char value);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Insertion */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Inserts the content of the source string in the destination string at the given `index`.
+ *
+ * @param destination The destination string.
+ * @param index The insert index.
+ * @param source The source string.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringInsert(ZyanString* destination, ZyanUSize index,
+ const ZyanStringView* source);
+
+/**
+ * Inserts `count` characters of the source string in the destination string at the given
+ * `index`.
+ *
+ * @param destination The destination string.
+ * @param destination_index The insert index.
+ * @param source The source string.
+ * @param source_index The index of the first character to be inserted from the source
+ * string.
+ * @param count The number of chars to insert from the source string.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringInsertEx(ZyanString* destination, ZyanUSize destination_index,
+ const ZyanStringView* source, ZyanUSize source_index, ZyanUSize count);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Appending */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Appends the content of the source string to the end of the destination string.
+ *
+ * @param destination The destination string.
+ * @param source The source string.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringAppend(ZyanString* destination, const ZyanStringView* source);
+
+/**
+ * Appends `count` characters of the source string to the end of the destination string.
+ *
+ * @param destination The destination string.
+ * @param source The source string.
+ * @param source_index The index of the first character to be appended from the source string.
+ * @param count The number of chars to append from the source string.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringAppendEx(ZyanString* destination, const ZyanStringView* source,
+ ZyanUSize source_index, ZyanUSize count);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Deletion */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Deletes characters from the given string, starting at `index`.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param index The index of the first character to delete.
+ * @param count The number of characters to delete.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringDelete(ZyanString* string, ZyanUSize index, ZyanUSize count);
+
+/**
+ * Deletes all remaining characters from the given string, starting at `index`.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param index The index of the first character to delete.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringTruncate(ZyanString* string, ZyanUSize index);
+
+/**
+ * Erases the given string.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringClear(ZyanString* string);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Searching */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Searches for the first occurrence of `needle` in the given `haystack` starting from the
+ * left.
+ *
+ * @param haystack The string to search in.
+ * @param needle The sub-string to search for.
+ * @param found_index A pointer to a variable that receives the index of the first occurrence of
+ * `needle`.
+ *
+ * @return `ZYAN_STATUS_TRUE`, if the needle was found, `ZYAN_STATUS_FALSE`, if not, or another
+ * zyan status code, if an error occured.
+ *
+ * The `found_index` is set to `-1`, if the needle was not found.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringLPos(const ZyanStringView* haystack,
+ const ZyanStringView* needle, ZyanISize* found_index);
+
+/**
+ * Searches for the first occurrence of `needle` in the given `haystack` starting from the
+ * left.
+ *
+ * @param haystack The string to search in.
+ * @param needle The sub-string to search for.
+ * @param found_index A pointer to a variable that receives the index of the first occurrence of
+ * `needle`.
+ * @param index The start index.
+ * @param count The maximum number of characters to iterate, beginning from the start
+ * `index`.
+ *
+ * @return `ZYAN_STATUS_TRUE`, if the needle was found, `ZYAN_STATUS_FALSE`, if not, or another
+ * zyan status code, if an error occured.
+ *
+ * The `found_index` is set to `-1`, if the needle was not found.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringLPosEx(const ZyanStringView* haystack,
+ const ZyanStringView* needle, ZyanISize* found_index, ZyanUSize index, ZyanUSize count);
+
+/**
+ * Performs a case-insensitive search for the first occurrence of `needle` in the given
+ * `haystack` starting from the left.
+ *
+ * @param haystack The string to search in.
+ * @param needle The sub-string to search for.
+ * @param found_index A pointer to a variable that receives the index of the first occurrence of
+ * `needle`.
+ *
+ * @return `ZYAN_STATUS_TRUE`, if the needle was found, `ZYAN_STATUS_FALSE`, if not, or another
+ * zyan status code, if an error occured.
+ *
+ * The `found_index` is set to `-1`, if the needle was not found.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringLPosI(const ZyanStringView* haystack,
+ const ZyanStringView* needle, ZyanISize* found_index);
+
+/**
+ * Performs a case-insensitive search for the first occurrence of `needle` in the given
+ * `haystack` starting from the left.
+ *
+ * @param haystack The string to search in.
+ * @param needle The sub-string to search for.
+ * @param found_index A pointer to a variable that receives the index of the first occurrence of
+ * `needle`.
+ * @param index The start index.
+ * @param count The maximum number of characters to iterate, beginning from the start
+ * `index`.
+ *
+ * @return `ZYAN_STATUS_TRUE`, if the needle was found, `ZYAN_STATUS_FALSE`, if not, or another
+ * zyan status code, if an error occured.
+ *
+ * The `found_index` is set to `-1`, if the needle was not found.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringLPosIEx(const ZyanStringView* haystack,
+ const ZyanStringView* needle, ZyanISize* found_index, ZyanUSize index, ZyanUSize count);
+
+/**
+ * Searches for the first occurrence of `needle` in the given `haystack` starting from the
+ * right.
+ *
+ * @param haystack The string to search in.
+ * @param needle The sub-string to search for.
+ * @param found_index A pointer to a variable that receives the index of the first occurrence of
+ * `needle`.
+ *
+ * @return `ZYAN_STATUS_TRUE`, if the needle was found, `ZYAN_STATUS_FALSE`, if not, or another
+ * zyan status code, if an error occured.
+ *
+ * The `found_index` is set to `-1`, if the needle was not found.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringRPos(const ZyanStringView* haystack,
+ const ZyanStringView* needle, ZyanISize* found_index);
+
+/**
+ * Searches for the first occurrence of `needle` in the given `haystack` starting from the
+ * right.
+ *
+ * @param haystack The string to search in.
+ * @param needle The sub-string to search for.
+ * @param found_index A pointer to a variable that receives the index of the first occurrence of
+ * `needle`.
+ * @param index The start index.
+ * @param count The maximum number of characters to iterate, beginning from the start
+ * `index`.
+ *
+ * @return `ZYAN_STATUS_TRUE`, if the needle was found, `ZYAN_STATUS_FALSE`, if not, or another
+ * zyan status code, if an error occured.
+ *
+ * The `found_index` is set to `-1`, if the needle was not found.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringRPosEx(const ZyanStringView* haystack,
+ const ZyanStringView* needle, ZyanISize* found_index, ZyanUSize index, ZyanUSize count);
+
+/**
+ * Performs a case-insensitive search for the first occurrence of `needle` in the given
+ * `haystack` starting from the right.
+ *
+ * @param haystack The string to search in.
+ * @param needle The sub-string to search for.
+ * @param found_index A pointer to a variable that receives the index of the first occurrence of
+ * `needle`.
+ *
+ * @return `ZYAN_STATUS_TRUE`, if the needle was found, `ZYAN_STATUS_FALSE`, if not, or another
+ * zyan status code, if an error occured.
+ *
+ * The `found_index` is set to `-1`, if the needle was not found.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringRPosI(const ZyanStringView* haystack,
+ const ZyanStringView* needle, ZyanISize* found_index);
+
+/**
+ * Performs a case-insensitive search for the first occurrence of `needle` in the given
+ * `haystack` starting from the right.
+ *
+ * @param haystack The string to search in.
+ * @param needle The sub-string to search for.
+ * @param found_index A pointer to a variable that receives the index of the first occurrence of
+ * `needle`.
+ * @param index The start index.
+ * @param count The maximum number of characters to iterate, beginning from the start
+ * `index`.
+ *
+ * @return `ZYAN_STATUS_TRUE`, if the needle was found, `ZYAN_STATUS_FALSE`, if not, or another
+ * zyan status code, if an error occured.
+ *
+ * The `found_index` is set to `-1`, if the needle was not found.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringRPosIEx(const ZyanStringView* haystack,
+ const ZyanStringView* needle, ZyanISize* found_index, ZyanUSize index, ZyanUSize count);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Comparing */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Compares two strings.
+ *
+ * @param s1 The first string
+ * @param s2 The second string.
+ * @param result Receives the comparison result.
+ *
+ * Values:
+ * - `result < 0` -> The first character that does not match has a lower value
+ * in `s1` than in `s2`.
+ * - `result == 0` -> The contents of both strings are equal.
+ * - `result > 0` -> The first character that does not match has a greater value
+ * in `s1` than in `s2`.
+ *
+ * @return `ZYAN_STATUS_TRUE`, if the strings are equal, `ZYAN_STATUS_FALSE`, if not, or another
+ * zyan status code, if an error occured.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringCompare(const ZyanStringView* s1, const ZyanStringView* s2,
+ ZyanI32* result);
+
+/**
+ * Performs a case-insensitive comparison of two strings.
+ *
+ * @param s1 The first string
+ * @param s2 The second string.
+ * @param result Receives the comparison result.
+ *
+ * Values:
+ * - `result < 0` -> The first character that does not match has a lower value
+ * in `s1` than in `s2`.
+ * - `result == 0` -> The contents of both strings are equal.
+ * - `result > 0` -> The first character that does not match has a greater value
+ * in `s1` than in `s2`.
+ *
+ * @return `ZYAN_STATUS_TRUE`, if the strings are equal, `ZYAN_STATUS_FALSE`, if not, or another
+ * zyan status code, if an error occured.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringCompareI(const ZyanStringView* s1, const ZyanStringView* s2,
+ ZyanI32* result);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Case conversion */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Converts the given string to lowercase letters.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringToLowerCase(ZyanString* string);
+
+/**
+ * Converts `count` characters of the given string to lowercase letters.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param index The start index.
+ * @param count The number of characters to convert, beginning from the start `index`.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringToLowerCaseEx(ZyanString* string, ZyanUSize index,
+ ZyanUSize count);
+
+/**
+ * Converts the given string to uppercase letters.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringToUpperCase(ZyanString* string);
+
+/**
+ * Converts `count` characters of the given string to uppercase letters.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param index The start index.
+ * @param count The number of characters to convert, beginning from the start `index`.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringToUpperCaseEx(ZyanString* string, ZyanUSize index,
+ ZyanUSize count);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Memory management */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Resizes the given `ZyanString` instance.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param size The new size of the string.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringResize(ZyanString* string, ZyanUSize size);
+
+/**
+ * Changes the capacity of the given `ZyanString` instance.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param capacity The new minimum capacity of the string.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringReserve(ZyanString* string, ZyanUSize capacity);
+
+/**
+ * Shrinks the capacity of the given string to match it's size.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringShrinkToFit(ZyanString* string);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Information */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the current capacity of the string.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param capacity Receives the size of the string.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringGetCapacity(const ZyanString* string, ZyanUSize* capacity);
+
+/**
+ * Returns the current size (number of characters) of the string (excluding the
+ * terminating zero character).
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param size Receives the size (number of characters) of the string.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringGetSize(const ZyanString* string, ZyanUSize* size);
+
+/**
+ * Returns the C-style string of the given `ZyanString` instance.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param value Receives a pointer to the C-style string.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanStringGetData(const ZyanString* string, const char** value);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ZYCORE_STRING_H
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Types.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Types.h
new file mode 100644
index 0000000..74fe905
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Types.h
@@ -0,0 +1,195 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zyan-C)
+
+ Original Author : Florian Bernd, Joel Hoener
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Includes and defines some default data types.
+ */
+
+#ifndef ZYCORE_TYPES_H
+#define ZYCORE_TYPES_H
+
+#include
+
+/* ============================================================================================== */
+/* Integer types */
+/* ============================================================================================== */
+
+#if defined(ZYAN_NO_LIBC) || \
+ (defined(ZYAN_MSVC) && defined(ZYAN_KERNEL)) // The WDK LibC lacks stdint.h.
+ // No LibC mode, use compiler built-in types / macros.
+# if defined(ZYAN_MSVC) || defined(ZYAN_ICC)
+ typedef unsigned __int8 ZyanU8;
+ typedef unsigned __int16 ZyanU16;
+ typedef unsigned __int32 ZyanU32;
+ typedef unsigned __int64 ZyanU64;
+ typedef signed __int8 ZyanI8;
+ typedef signed __int16 ZyanI16;
+ typedef signed __int32 ZyanI32;
+ typedef signed __int64 ZyanI64;
+# if _WIN64
+ typedef ZyanU64 ZyanUSize;
+ typedef ZyanI64 ZyanISize;
+ typedef ZyanU64 ZyanUPointer;
+ typedef ZyanI64 ZyanIPointer;
+# else
+ typedef ZyanU32 ZyanUSize;
+ typedef ZyanI32 ZyanISize;
+ typedef ZyanU32 ZyanUPointer;
+ typedef ZyanI32 ZyanIPointer;
+# endif
+# elif defined(ZYAN_GNUC)
+ typedef __UINT8_TYPE__ ZyanU8;
+ typedef __UINT16_TYPE__ ZyanU16;
+ typedef __UINT32_TYPE__ ZyanU32;
+ typedef __UINT64_TYPE__ ZyanU64;
+ typedef __INT8_TYPE__ ZyanI8;
+ typedef __INT16_TYPE__ ZyanI16;
+ typedef __INT32_TYPE__ ZyanI32;
+ typedef __INT64_TYPE__ ZyanI64;
+ typedef __SIZE_TYPE__ ZyanUSize;
+ typedef __PTRDIFF_TYPE__ ZyanISize;
+ typedef __UINTPTR_TYPE__ ZyanUPointer;
+ typedef __INTPTR_TYPE__ ZyanIPointer;
+# else
+# error "Unsupported compiler for no-libc mode."
+# endif
+#else
+ // If is LibC present, we use stdint types.
+# include
+# include
+ typedef uint8_t ZyanU8;
+ typedef uint16_t ZyanU16;
+ typedef uint32_t ZyanU32;
+ typedef uint64_t ZyanU64;
+ typedef int8_t ZyanI8;
+ typedef int16_t ZyanI16;
+ typedef int32_t ZyanI32;
+ typedef int64_t ZyanI64;
+ typedef size_t ZyanUSize;
+ typedef ptrdiff_t ZyanISize;
+ typedef uintptr_t ZyanUPointer;
+ typedef intptr_t ZyanIPointer;
+#endif
+
+// Verify size assumptions.
+ZYAN_STATIC_ASSERT(sizeof(ZyanU8 ) == 1 );
+ZYAN_STATIC_ASSERT(sizeof(ZyanU16 ) == 2 );
+ZYAN_STATIC_ASSERT(sizeof(ZyanU32 ) == 4 );
+ZYAN_STATIC_ASSERT(sizeof(ZyanU64 ) == 8 );
+ZYAN_STATIC_ASSERT(sizeof(ZyanI8 ) == 1 );
+ZYAN_STATIC_ASSERT(sizeof(ZyanI16 ) == 2 );
+ZYAN_STATIC_ASSERT(sizeof(ZyanI32 ) == 4 );
+ZYAN_STATIC_ASSERT(sizeof(ZyanI64 ) == 8 );
+ZYAN_STATIC_ASSERT(sizeof(ZyanUSize ) == sizeof(void*)); // TODO: This one is incorrect!
+ZYAN_STATIC_ASSERT(sizeof(ZyanISize ) == sizeof(void*)); // TODO: This one is incorrect!
+ZYAN_STATIC_ASSERT(sizeof(ZyanUPointer) == sizeof(void*));
+ZYAN_STATIC_ASSERT(sizeof(ZyanIPointer) == sizeof(void*));
+
+// Verify signedness assumptions (relies on size checks above).
+ZYAN_STATIC_ASSERT((ZyanI8 )-1 >> 1 < (ZyanI8 )((ZyanU8 )-1 >> 1));
+ZYAN_STATIC_ASSERT((ZyanI16)-1 >> 1 < (ZyanI16)((ZyanU16)-1 >> 1));
+ZYAN_STATIC_ASSERT((ZyanI32)-1 >> 1 < (ZyanI32)((ZyanU32)-1 >> 1));
+ZYAN_STATIC_ASSERT((ZyanI64)-1 >> 1 < (ZyanI64)((ZyanU64)-1 >> 1));
+
+/* ============================================================================================== */
+/* Pointer */
+/* ============================================================================================== */
+
+/**
+ * Defines the `ZyanVoidPointer` data-type.
+ */
+typedef char* ZyanVoidPointer;
+
+/**
+ * Defines the `ZyanConstVoidPointer` data-type.
+ */
+typedef const void* ZyanConstVoidPointer;
+
+#define ZYAN_NULL ((void*)0)
+
+/* ============================================================================================== */
+/* Logic types */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Boolean */
+/* ---------------------------------------------------------------------------------------------- */
+
+#define ZYAN_FALSE 0
+#define ZYAN_TRUE 1
+
+/**
+ * Defines the `ZyanBool` data-type.
+ *
+ * Represents a default boolean data-type where `0` is interpreted as `false` and all other values
+ * as `true`.
+ */
+typedef ZyanU8 ZyanBool;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Ternary */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZyanTernary` data-type.
+ *
+ * The `ZyanTernary` is a balanced ternary type that uses three truth values indicating `true`,
+ * `false` and an indeterminate third value.
+ */
+typedef ZyanI8 ZyanTernary;
+
+#define ZYAN_TERNARY_FALSE (-1)
+#define ZYAN_TERNARY_UNKNOWN 0x00
+#define ZYAN_TERNARY_TRUE 0x01
+
+/* ============================================================================================== */
+/* String types */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* C-style strings */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZyanCharPointer` data-type.
+ *
+ * This type is most often used to represent null-terminated strings aka. C-style strings.
+ */
+typedef char* ZyanCharPointer;
+
+/**
+ * Defines the `ZyanConstCharPointer` data-type.
+ *
+ * This type is most often used to represent null-terminated strings aka. C-style strings.
+ */
+typedef const char* ZyanConstCharPointer;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#endif /* ZYCORE_TYPES_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Vector.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Vector.h
new file mode 100644
index 0000000..47e728c
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Vector.h
@@ -0,0 +1,723 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zycore-C)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Implements the vector container class.
+ */
+
+#ifndef ZYCORE_VECTOR_H
+#define ZYCORE_VECTOR_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Constants */
+/* ============================================================================================== */
+
+/**
+ * The initial minimum capacity (number of elements) for all dynamically allocated vector
+ * instances.
+ */
+#define ZYAN_VECTOR_MIN_CAPACITY 1
+
+/**
+ * The default growth factor for all vector instances.
+ */
+#define ZYAN_VECTOR_DEFAULT_GROWTH_FACTOR 2.00f
+
+/**
+ * The default shrink threshold for all vector instances.
+ */
+#define ZYAN_VECTOR_DEFAULT_SHRINK_THRESHOLD 0.25f
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+/**
+ * Defines the `ZyanVector` struct.
+ *
+ * All fields in this struct should be considered as "private". Any changes may lead to unexpected
+ * behavior.
+ */
+typedef struct ZyanVector_
+{
+ /**
+ * The memory allocator.
+ */
+ ZyanAllocator* allocator;
+ /**
+ * The growth factor.
+ */
+ float growth_factor;
+ /**
+ * The shrink threshold.
+ */
+ float shrink_threshold;
+ /**
+ * The current number of elements in the vector.
+ */
+ ZyanUSize size;
+ /**
+ * The maximum capacity (number of elements).
+ */
+ ZyanUSize capacity;
+ /**
+ * The size of a single element in bytes.
+ */
+ ZyanUSize element_size;
+ /**
+ * The element destructor callback.
+ */
+ ZyanMemberProcedure destructor;
+ /**
+ * The data pointer.
+ */
+ void* data;
+} ZyanVector;
+
+/* ============================================================================================== */
+/* Macros */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* General */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines an uninitialized `ZyanVector` instance.
+ */
+#define ZYAN_VECTOR_INITIALIZER \
+ { \
+ /* allocator */ ZYAN_NULL, \
+ /* growth_factor */ 0.0f, \
+ /* shrink_threshold */ 0.0f, \
+ /* size */ 0, \
+ /* capacity */ 0, \
+ /* element_size */ 0, \
+ /* destructor */ ZYAN_NULL, \
+ /* data */ ZYAN_NULL \
+ }
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Helper macros */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the value of the element at the given `index`.
+ *
+ * @param type The desired value type.
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param index The element index.
+ *
+ * @result The value of the desired element in the vector.
+ *
+ * Note that this function is unsafe and might dereference a null-pointer.
+ */
+#ifdef __cplusplus
+#define ZYAN_VECTOR_GET(type, vector, index) \
+ (*reinterpret_cast(ZyanVectorGet(vector, index)))
+#else
+#define ZYAN_VECTOR_GET(type, vector, index) \
+ (*(const type*)ZyanVectorGet(vector, index))
+#endif
+
+/**
+ * Loops through all elements of the vector.
+ *
+ * @param type The desired value type.
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param item_name The name of the iterator item.
+ * @param body The body to execute for each item in the vector.
+ */
+#define ZYAN_VECTOR_FOREACH(type, vector, item_name, body) \
+ { \
+ const ZyanUSize ZYAN_MACRO_CONCAT_EXPAND(size_d50d3303, item_name) = (vector)->size; \
+ for (ZyanUSize ZYAN_MACRO_CONCAT_EXPAND(i_bfd62679, item_name) = 0; \
+ ZYAN_MACRO_CONCAT_EXPAND(i_bfd62679, item_name) < \
+ ZYAN_MACRO_CONCAT_EXPAND(size_d50d3303, item_name); \
+ ++ZYAN_MACRO_CONCAT_EXPAND(i_bfd62679, item_name)) \
+ { \
+ const type item_name = ZYAN_VECTOR_GET(type, vector, \
+ ZYAN_MACRO_CONCAT_EXPAND(i_bfd62679, item_name)); \
+ body \
+ } \
+ }
+
+/**
+ * Loops through all elements of the vector.
+ *
+ * @param type The desired value type.
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param item_name The name of the iterator item.
+ * @param body The body to execute for each item in the vector.
+ */
+#define ZYAN_VECTOR_FOREACH_MUTABLE(type, vector, item_name, body) \
+ { \
+ const ZyanUSize ZYAN_MACRO_CONCAT_EXPAND(size_d50d3303, item_name) = (vector)->size; \
+ for (ZyanUSize ZYAN_MACRO_CONCAT_EXPAND(i_bfd62679, item_name) = 0; \
+ ZYAN_MACRO_CONCAT_EXPAND(i_bfd62679, item_name) < \
+ ZYAN_MACRO_CONCAT_EXPAND(size_d50d3303, item_name); \
+ ++ZYAN_MACRO_CONCAT_EXPAND(i_bfd62679, item_name)) \
+ { \
+ type* const item_name = ZyanVectorGetMutable(vector, \
+ ZYAN_MACRO_CONCAT_EXPAND(i_bfd62679, item_name)); \
+ body \
+ } \
+ }
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Constructor and destructor */
+/* ---------------------------------------------------------------------------------------------- */
+
+#ifndef ZYAN_NO_LIBC
+
+/**
+ * Initializes the given `ZyanVector` instance.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param element_size The size of a single element in bytes.
+ * @param capacity The initial capacity (number of elements).
+ * @param destructor A destructor callback that is invoked every time an item is deleted, or
+ * `ZYAN_NULL` if not needed.
+ *
+ * @return A zyan status code.
+ *
+ * The memory for the vector elements is dynamically allocated by the default allocator using the
+ * default growth factor of `2.0f` and the default shrink threshold of `0.25f`.
+ *
+ * Finalization with `ZyanVectorDestroy` is required for all instances created by this function.
+ */
+ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanVectorInit(ZyanVector* vector,
+ ZyanUSize element_size, ZyanUSize capacity, ZyanMemberProcedure destructor);
+
+#endif // ZYAN_NO_LIBC
+
+/**
+ * Initializes the given `ZyanVector` instance and sets a custom `allocator` and memory
+ * allocation/deallocation parameters.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param element_size The size of a single element in bytes.
+ * @param capacity The initial capacity (number of elements).
+ * @param destructor A destructor callback that is invoked every time an item is deleted,
+ * or `ZYAN_NULL` if not needed.
+ * @param allocator A pointer to a `ZyanAllocator` instance.
+ * @param growth_factor The growth factor (from `1.0f` to `x.xf`).
+ * @param shrink_threshold The shrink threshold (from `0.0f` to `1.0f`).
+ *
+ * @return A zyan status code.
+ *
+ * A growth factor of `1.0f` disables overallocation and a shrink threshold of `0.0f` disables
+ * dynamic shrinking.
+ *
+ * Finalization with `ZyanVectorDestroy` is required for all instances created by this function.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorInitEx(ZyanVector* vector, ZyanUSize element_size,
+ ZyanUSize capacity, ZyanMemberProcedure destructor, ZyanAllocator* allocator,
+ float growth_factor, float shrink_threshold);
+
+/**
+ * Initializes the given `ZyanVector` instance and configures it to use a custom user
+ * defined buffer with a fixed size.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param element_size The size of a single element in bytes.
+ * @param buffer A pointer to the buffer that is used as storage for the elements.
+ * @param capacity The maximum capacity (number of elements) of the buffer.
+ * @param destructor A destructor callback that is invoked every time an item is deleted, or
+ * `ZYAN_NULL` if not needed.
+ *
+ * @return A zyan status code.
+ *
+ * Finalization is not required for instances created by this function.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorInitCustomBuffer(ZyanVector* vector, ZyanUSize element_size,
+ void* buffer, ZyanUSize capacity, ZyanMemberProcedure destructor);
+
+/**
+ * Destroys the given `ZyanVector` instance.
+ *
+ * @param vector A pointer to the `ZyanVector` instance..
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorDestroy(ZyanVector* vector);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Duplication */
+/* ---------------------------------------------------------------------------------------------- */
+
+#ifndef ZYAN_NO_LIBC
+
+/**
+ * Initializes a new `ZyanVector` instance by duplicating an existing vector.
+ *
+ * @param destination A pointer to the (uninitialized) destination `ZyanVector` instance.
+ * @param source A pointer to the source vector.
+ * @param capacity The initial capacity (number of elements).
+ *
+ * This value is automatically adjusted to the size of the source vector, if
+ * a smaller value was passed.
+ *
+ * @return A zyan status code.
+ *
+ * The memory for the vector is dynamically allocated by the default allocator using the default
+ * growth factor of `2.0f` and the default shrink threshold of `0.25f`.
+ *
+ * Finalization with `ZyanVectorDestroy` is required for all instances created by this function.
+ */
+ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanStatus ZyanVectorDuplicate(ZyanVector* destination,
+ const ZyanVector* source, ZyanUSize capacity);
+
+#endif // ZYAN_NO_LIBC
+
+/**
+ * Initializes a new `ZyanVector` instance by duplicating an existing vector and sets a
+ * custom `allocator` and memory allocation/deallocation parameters.
+ *
+ * @param destination A pointer to the (uninitialized) destination `ZyanVector` instance.
+ * @param source A pointer to the source vector.
+ * @param capacity The initial capacity (number of elements).
+
+ * This value is automatically adjusted to the size of the source
+ * vector, if a smaller value was passed.
+ * @param allocator A pointer to a `ZyanAllocator` instance.
+ * @param growth_factor The growth factor (from `1.0f` to `x.xf`).
+ * @param shrink_threshold The shrink threshold (from `0.0f` to `1.0f`).
+ *
+ * @return A zyan status code.
+ *
+ * A growth factor of `1.0f` disables overallocation and a shrink threshold of `0.0f` disables
+ * dynamic shrinking.
+ *
+ * Finalization with `ZyanVectorDestroy` is required for all instances created by this function.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorDuplicateEx(ZyanVector* destination, const ZyanVector* source,
+ ZyanUSize capacity, ZyanAllocator* allocator, float growth_factor, float shrink_threshold);
+
+/**
+ * Initializes a new `ZyanVector` instance by duplicating an existing vector and
+ * configures it to use a custom user defined buffer with a fixed size.
+ *
+ * @param destination A pointer to the (uninitialized) destination `ZyanVector` instance.
+ * @param source A pointer to the source vector.
+ * @param buffer A pointer to the buffer that is used as storage for the elements.
+ * @param capacity The maximum capacity (number of elements) of the buffer.
+
+ * This function will fail, if the capacity of the buffer is less than the
+ * size of the source vector.
+ *
+ * @return A zyan status code.
+ *
+ * Finalization is not required for instances created by this function.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorDuplicateCustomBuffer(ZyanVector* destination,
+ const ZyanVector* source, void* buffer, ZyanUSize capacity);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Element access */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns a constant pointer to the element at the given `index`.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param index The element index.
+ *
+ * @return A constant pointer to the desired element in the vector or `ZYAN_NULL`, if an error
+ * occured.
+ *
+ * Note that the returned pointer might get invalid when the vector is resized by either a manual
+ * call to the memory-management functions or implicitly by inserting or removing elements.
+ *
+ * Take a look at `ZyanVectorGetPointer` instead, if you need a function that returns a zyan status
+ * code.
+ */
+ZYCORE_EXPORT const void* ZyanVectorGet(const ZyanVector* vector, ZyanUSize index);
+
+/**
+ * Returns a mutable pointer to the element at the given `index`.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param index The element index.
+ *
+ * @return A mutable pointer to the desired element in the vector or `ZYAN_NULL`, if an error
+ * occured.
+ *
+ * Note that the returned pointer might get invalid when the vector is resized by either a manual
+ * call to the memory-management functions or implicitly by inserting or removing elements.
+ *
+ * Take a look at `ZyanVectorGetPointerMutable` instead, if you need a function that returns a
+ * zyan status code.
+ */
+ZYCORE_EXPORT void* ZyanVectorGetMutable(const ZyanVector* vector, ZyanUSize index);
+
+/**
+ * Returns a constant pointer to the element at the given `index`.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param index The element index.
+ * @param value Receives a constant pointer to the desired element in the vector.
+ *
+ * Note that the returned pointer might get invalid when the vector is resized by either a manual
+ * call to the memory-management functions or implicitly by inserting or removing elements.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorGetPointer(const ZyanVector* vector, ZyanUSize index,
+ const void** value);
+
+/**
+ * Returns a mutable pointer to the element at the given `index`.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param index The element index.
+ * @param value Receives a mutable pointer to the desired element in the vector.
+ *
+ * Note that the returned pointer might get invalid when the vector is resized by either a manual
+ * call to the memory-management functions or implicitly by inserting or removing elements.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorGetPointerMutable(const ZyanVector* vector, ZyanUSize index,
+ void** value);
+
+/**
+ * Assigns a new value to the element at the given `index`.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param index The value index.
+ * @param value The value to assign.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorSet(ZyanVector* vector, ZyanUSize index,
+ const void* value);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Insertion */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Adds a new `element` to the end of the vector.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param element A pointer to the element to add.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorPushBack(ZyanVector* vector, const void* element);
+
+/**
+ * Inserts an `element` at the given `index` of the vector.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param index The insert index.
+ * @param element A pointer to the element to insert.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorInsert(ZyanVector* vector, ZyanUSize index,
+ const void* element);
+
+/**
+ * Inserts multiple `elements` at the given `index` of the vector.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param index The insert index.
+ * @param elements A pointer to the first element.
+ * @param count The number of elements to insert.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorInsertRange(ZyanVector* vector, ZyanUSize index,
+ const void* elements, ZyanUSize count);
+
+/**
+ * Constructs an `element` in-place at the end of the vector.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param element Receives a pointer to the new element.
+ * @param constructor The constructor callback or `ZYAN_NULL`. The new element will be in
+ * undefined state, if no constructor was passed.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorEmplace(ZyanVector* vector, void** element,
+ ZyanMemberFunction constructor);
+
+/**
+ * Constructs an `element` in-place and inserts it at the given `index` of the vector.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param index The insert index.
+ * @param element Receives a pointer to the new element.
+ * @param constructor The constructor callback or `ZYAN_NULL`. The new element will be in
+ * undefined state, if no constructor was passed.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorEmplaceEx(ZyanVector* vector, ZyanUSize index,
+ void** element, ZyanMemberFunction constructor);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Utils */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Swaps the element at `index_first` with the element at `index_second`.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param index_first The index of the first element.
+ * @param index_second The index of the second element.
+ *
+ * @return A zyan status code.
+ *
+ * This function requires the vector to have spare capacity for one temporary element. Call
+ * `ZyanVectorReserve` before this function to increase capacity, if needed.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorSwapElements(ZyanVector* vector, ZyanUSize index_first,
+ ZyanUSize index_second);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Deletion */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Deletes the element at the given `index` of the vector.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param index The element index.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorDelete(ZyanVector* vector, ZyanUSize index);
+
+/**
+ * Deletes multiple elements from the given vector, starting at `index`.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param index The index of the first element to delete.
+ * @param count The number of elements to delete.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorDeleteRange(ZyanVector* vector, ZyanUSize index,
+ ZyanUSize count);
+
+/**
+ * Removes the last element of the vector.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorPopBack(ZyanVector* vector);
+
+/**
+ * Erases all elements of the given vector.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorClear(ZyanVector* vector);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Searching */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Sequentially searches for the first occurrence of `element` in the given vector.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param element A pointer to the element to search for.
+ * @param found_index A pointer to a variable that receives the index of the found element.
+ * @param comparison The comparison function to use.
+ *
+ * @return `ZYAN_STATUS_TRUE` if the element was found, `ZYAN_STATUS_FALSE` if not or a generic
+ * zyan status code if an error occured.
+ *
+ * The `found_index` is set to `-1`, if the element was not found.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorFind(const ZyanVector* vector, const void* element,
+ ZyanISize* found_index, ZyanEqualityComparison comparison);
+
+/**
+ * Sequentially searches for the first occurrence of `element` in the given vector.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param element A pointer to the element to search for.
+ * @param found_index A pointer to a variable that receives the index of the found element.
+ * @param comparison The comparison function to use.
+ * @param index The start index.
+ * @param count The maximum number of elements to iterate, beginning from the start `index`.
+ *
+ * @return `ZYAN_STATUS_TRUE` if the element was found, `ZYAN_STATUS_FALSE` if not or a generic
+ * zyan status code if an error occured.
+ *
+ * The `found_index` is set to `-1`, if the element was not found.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorFindEx(const ZyanVector* vector, const void* element,
+ ZyanISize* found_index, ZyanEqualityComparison comparison, ZyanUSize index, ZyanUSize count);
+
+/**
+ * Searches for the first occurrence of `element` in the given vector using a binary-
+ * search algorithm.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param element A pointer to the element to search for.
+ * @param found_index A pointer to a variable that receives the index of the found element.
+ * @param comparison The comparison function to use.
+ *
+ * @return `ZYAN_STATUS_TRUE` if the element was found, `ZYAN_STATUS_FALSE` if not or a generic
+ * zyan status code if an error occured.
+ *
+ * If found, `found_index` contains the zero-based index of `element`. If not found, `found_index`
+ * contains the index of the first entry larger than `element`.
+ *
+ * This function requires all elements in the vector to be strictly ordered (sorted).
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorBinarySearch(const ZyanVector* vector, const void* element,
+ ZyanUSize* found_index, ZyanComparison comparison);
+
+/**
+ * Searches for the first occurrence of `element` in the given vector using a binary-
+ * search algorithm.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param element A pointer to the element to search for.
+ * @param found_index A pointer to a variable that receives the index of the found element.
+ * @param comparison The comparison function to use.
+ * @param index The start index.
+ * @param count The maximum number of elements to iterate, beginning from the start `index`.
+ *
+ * @return `ZYAN_STATUS_TRUE` if the element was found, `ZYAN_STATUS_FALSE` if not or a generic
+ * zyan status code if an error occured.
+ *
+ * If found, `found_index` contains the zero-based index of `element`. If not found, `found_index`
+ * contains the index of the first entry larger than `element`.
+ *
+ * This function requires all elements in the vector to be strictly ordered (sorted).
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorBinarySearchEx(const ZyanVector* vector, const void* element,
+ ZyanUSize* found_index, ZyanComparison comparison, ZyanUSize index, ZyanUSize count);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Memory management */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Resizes the given `ZyanVector` instance.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param size The new size of the vector.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorResize(ZyanVector* vector, ZyanUSize size);
+
+/**
+ * Resizes the given `ZyanVector` instance.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param size The new size of the vector.
+ * @param initializer A pointer to a value to be used as initializer for new items.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorResizeEx(ZyanVector* vector, ZyanUSize size,
+ const void* initializer);
+
+/**
+ * Changes the capacity of the given `ZyanVector` instance.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param capacity The new minimum capacity of the vector.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorReserve(ZyanVector* vector, ZyanUSize capacity);
+
+/**
+ * Shrinks the capacity of the given vector to match it's size.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorShrinkToFit(ZyanVector* vector);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Information */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the current capacity of the vector.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param capacity Receives the size of the vector.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorGetCapacity(const ZyanVector* vector, ZyanUSize* capacity);
+
+/**
+ * Returns the current size of the vector.
+ *
+ * @param vector A pointer to the `ZyanVector` instance.
+ * @param size Receives the size of the vector.
+ *
+ * @return A zyan status code.
+ */
+ZYCORE_EXPORT ZyanStatus ZyanVectorGetSize(const ZyanVector* vector, ZyanUSize* size);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYCORE_VECTOR_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Zycore.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Zycore.h
new file mode 100644
index 0000000..e136acf
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zycore/Zycore.h
@@ -0,0 +1,111 @@
+/***************************************************************************************************
+
+ Zyan Core Library (Zycore-C)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Master include file, including everything else.
+ */
+
+#ifndef ZYCORE_H
+#define ZYCORE_H
+
+#include
+#include
+
+// TODO:
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Macros */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Constants */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * A macro that defines the zycore version.
+ */
+#define ZYCORE_VERSION (ZyanU64)0x0001000000000000
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Helper macros */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Extracts the major-part of the zycore version.
+ *
+ * @param version The zycore version value
+ */
+#define ZYCORE_VERSION_MAJOR(version) (ZyanU16)((version & 0xFFFF000000000000) >> 48)
+
+/**
+ * Extracts the minor-part of the zycore version.
+ *
+ * @param version The zycore version value
+ */
+#define ZYCORE_VERSION_MINOR(version) (ZyanU16)((version & 0x0000FFFF00000000) >> 32)
+
+/**
+ * Extracts the patch-part of the zycore version.
+ *
+ * @param version The zycore version value
+ */
+#define ZYCORE_VERSION_PATCH(version) (ZyanU16)((version & 0x00000000FFFF0000) >> 16)
+
+/**
+ * Extracts the build-part of the zycore version.
+ *
+ * @param version The zycore version value
+ */
+#define ZYCORE_VERSION_BUILD(version) (ZyanU16)(version & 0x000000000000FFFF)
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/**
+ * Returns the zycore version.
+ *
+ * @return The zycore version.
+ *
+ * Use the macros provided in this file to extract the major, minor, patch and build part from the
+ * returned version value.
+ */
+ZYCORE_EXPORT ZyanU64 ZycoreGetVersion(void);
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYCORE_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/ZycoreExportConfig.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/ZycoreExportConfig.h
new file mode 100644
index 0000000..f050d37
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/ZycoreExportConfig.h
@@ -0,0 +1,42 @@
+
+#ifndef ZYCORE_EXPORT_H
+#define ZYCORE_EXPORT_H
+
+#ifdef ZYCORE_STATIC_DEFINE
+# define ZYCORE_EXPORT
+# define ZYCORE_NO_EXPORT
+#else
+# ifndef ZYCORE_EXPORT
+# ifdef Zycore_EXPORTS
+ /* We are building this library */
+# define ZYCORE_EXPORT __declspec(dllexport)
+# else
+ /* We are using this library */
+# define ZYCORE_EXPORT __declspec(dllimport)
+# endif
+# endif
+
+# ifndef ZYCORE_NO_EXPORT
+# define ZYCORE_NO_EXPORT
+# endif
+#endif
+
+#ifndef ZYCORE_DEPRECATED
+# define ZYCORE_DEPRECATED __declspec(deprecated)
+#endif
+
+#ifndef ZYCORE_DEPRECATED_EXPORT
+# define ZYCORE_DEPRECATED_EXPORT ZYCORE_EXPORT ZYCORE_DEPRECATED
+#endif
+
+#ifndef ZYCORE_DEPRECATED_NO_EXPORT
+# define ZYCORE_DEPRECATED_NO_EXPORT ZYCORE_NO_EXPORT ZYCORE_DEPRECATED
+#endif
+
+#if 0 /* DEFINE_NO_DEPRECATED */
+# ifndef ZYCORE_NO_DEPRECATED
+# define ZYCORE_NO_DEPRECATED
+# endif
+#endif
+
+#endif /* ZYCORE_EXPORT_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis.lib b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis.lib
new file mode 100644
index 0000000..42ca9b6
Binary files /dev/null and b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis.lib differ
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Decoder.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Decoder.h
new file mode 100644
index 0000000..8cfbb0c
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Decoder.h
@@ -0,0 +1,237 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Functions for decoding instructions.
+ */
+
+#ifndef ZYDIS_DECODER_H
+#define ZYDIS_DECODER_H
+
+#include
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Decoder mode */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisDecoderMode` enum.
+ */
+typedef enum ZydisDecoderMode_
+{
+ /**
+ * Enables minimal instruction decoding without semantic analysis.
+ *
+ * This mode provides access to the mnemonic, the instruction-length, the effective
+ * operand-size, the effective address-width, some attributes (e.g. `ZYDIS_ATTRIB_IS_RELATIVE`)
+ * and all of the information in the `raw` field of the `ZydisDecodedInstruction` struct.
+ *
+ * Operands, most attributes and other specific information (like `AVX` info) are not
+ * accessible in this mode.
+ *
+ * This mode is NOT enabled by default.
+ */
+ ZYDIS_DECODER_MODE_MINIMAL,
+ /**
+ * Enables the `AMD`-branch mode.
+ *
+ * Intel ignores the operand-size override-prefix (`0x66`) for all branches with 32-bit
+ * immediates and forces the operand-size of the instruction to 64-bit in 64-bit mode.
+ * In `AMD`-branch mode `0x66` is not ignored and changes the operand-size and the size of the
+ * immediate to 16-bit.
+ *
+ * This mode is NOT enabled by default.
+ */
+ ZYDIS_DECODER_MODE_AMD_BRANCHES,
+ /**
+ * Enables `KNC` compatibility-mode.
+ *
+ * `KNC` and `KNL+` chips are sharing opcodes and encodings for some mask-related instructions.
+ * Enable this mode to use the old `KNC` specifications (different mnemonics, operands, ..).
+ *
+ * This mode is NOT enabled by default.
+ */
+ ZYDIS_DECODER_MODE_KNC,
+ /**
+ * Enables the `MPX` mode.
+ *
+ * The `MPX` isa-extension reuses (overrides) some of the widenop instruction opcodes.
+ *
+ * This mode is enabled by default.
+ */
+ ZYDIS_DECODER_MODE_MPX,
+ /**
+ * Enables the `CET` mode.
+ *
+ * The `CET` isa-extension reuses (overrides) some of the widenop instruction opcodes.
+ *
+ * This mode is enabled by default.
+ */
+ ZYDIS_DECODER_MODE_CET,
+ /**
+ * Enables the `LZCNT` mode.
+ *
+ * The `LZCNT` isa-extension reuses (overrides) some of the widenop instruction opcodes.
+ *
+ * This mode is enabled by default.
+ */
+ ZYDIS_DECODER_MODE_LZCNT,
+ /**
+ * Enables the `TZCNT` mode.
+ *
+ * The `TZCNT` isa-extension reuses (overrides) some of the widenop instruction opcodes.
+ *
+ * This mode is enabled by default.
+ */
+ ZYDIS_DECODER_MODE_TZCNT,
+ /**
+ * Enables the `WBNOINVD` mode.
+ *
+ * The `WBINVD` instruction is interpreted as `WBNOINVD` on ICL chips, if a `F3` prefix is
+ * used.
+ *
+ * This mode is disabled by default.
+ */
+ ZYDIS_DECODER_MODE_WBNOINVD,
+ /**
+ * Enables the `CLDEMOTE` mode.
+ *
+ * The `CLDEMOTE` isa-extension reuses (overrides) some of the widenop instruction opcodes.
+ *
+ * This mode is enabled by default.
+ */
+ ZYDIS_DECODER_MODE_CLDEMOTE,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_DECODER_MODE_MAX_VALUE = ZYDIS_DECODER_MODE_CLDEMOTE,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_DECODER_MODE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_DECODER_MODE_MAX_VALUE)
+} ZydisDecoderMode;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Decoder struct */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisDecoder` struct.
+ *
+ * All fields in this struct should be considered as "private". Any changes may lead to unexpected
+ * behavior.
+ */
+typedef struct ZydisDecoder_
+{
+ /**
+ * The machine mode.
+ */
+ ZydisMachineMode machine_mode;
+ /**
+ * The address width.
+ */
+ ZydisAddressWidth address_width;
+ /**
+ * The decoder mode array.
+ */
+ ZyanBool decoder_mode[ZYDIS_DECODER_MODE_MAX_VALUE + 1];
+} ZydisDecoder;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/**
+ * @addtogroup decoder Decoder
+ * Functions allowing decoding of instruction bytes to a machine interpretable struct.
+ * @{
+ */
+
+/**
+ * Initializes the given `ZydisDecoder` instance.
+ *
+ * @param decoder A pointer to the `ZydisDecoder` instance.
+ * @param machine_mode The machine mode.
+ * @param address_width The address width.
+ *
+ * @return A zyan status code.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisDecoderInit(ZydisDecoder* decoder, ZydisMachineMode machine_mode,
+ ZydisAddressWidth address_width);
+
+/**
+ * Enables or disables the specified decoder-mode.
+ *
+ * @param decoder A pointer to the `ZydisDecoder` instance.
+ * @param mode The decoder mode.
+ * @param enabled `ZYAN_TRUE` to enable, or `ZYAN_FALSE` to disable the specified decoder-mode.
+ *
+ * @return A zyan status code.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisDecoderEnableMode(ZydisDecoder* decoder, ZydisDecoderMode mode,
+ ZyanBool enabled);
+
+/**
+ * Decodes the instruction in the given input `buffer`.
+ *
+ * @param decoder A pointer to the `ZydisDecoder` instance.
+ * @param buffer A pointer to the input buffer.
+ * @param length The length of the input buffer. Note that this can be bigger than the
+ * actual size of the instruction -- you don't have to know the size up
+ * front. This length is merely used to prevent Zydis from doing
+ * out-of-bounds reads on your buffer.
+ * @param instruction A pointer to the `ZydisDecodedInstruction` struct, that receives the
+ * details about the decoded instruction.
+ *
+ * @return A zyan status code.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisDecoderDecodeBuffer(const ZydisDecoder* decoder,
+ const void* buffer, ZyanUSize length, ZydisDecodedInstruction* instruction);
+
+/** @} */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYDIS_DECODER_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/DecoderTypes.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/DecoderTypes.h
new file mode 100644
index 0000000..45f5300
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/DecoderTypes.h
@@ -0,0 +1,1528 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Defines the basic `ZydisDecodedInstruction` and `ZydisDecodedOperand` structs.
+ */
+
+#ifndef ZYDIS_INSTRUCTIONINFO_H
+#define ZYDIS_INSTRUCTIONINFO_H
+
+#include
+#include
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Decoded operand */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Memory type */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisMemoryOperandType` enum.
+ */
+typedef enum ZydisMemoryOperandType_
+{
+ ZYDIS_MEMOP_TYPE_INVALID,
+ /**
+ * Normal memory operand.
+ */
+ ZYDIS_MEMOP_TYPE_MEM,
+ /**
+ * The memory operand is only used for address-generation. No real memory-access is
+ * caused.
+ */
+ ZYDIS_MEMOP_TYPE_AGEN,
+ /**
+ * A memory operand using `SIB` addressing form, where the index register is not used
+ * in address calculation and scale is ignored. No real memory-access is caused.
+ */
+ ZYDIS_MEMOP_TYPE_MIB,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_MEMOP_TYPE_MAX_VALUE = ZYDIS_MEMOP_TYPE_MIB,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_MEMOP_TYPE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_MEMOP_TYPE_MAX_VALUE)
+} ZydisMemoryOperandType;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Decoded operand */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisDecodedOperand` struct.
+ */
+typedef struct ZydisDecodedOperand_
+{
+ /**
+ * The operand-id.
+ */
+ ZyanU8 id;
+ /**
+ * The type of the operand.
+ */
+ ZydisOperandType type;
+ /**
+ * The visibility of the operand.
+ */
+ ZydisOperandVisibility visibility;
+ /**
+ * The operand-actions.
+ */
+ ZydisOperandActions actions;
+ /**
+ * The operand-encoding.
+ */
+ ZydisOperandEncoding encoding;
+ /**
+ * The logical size of the operand (in bits).
+ */
+ ZyanU16 size;
+ /**
+ * The element-type.
+ */
+ ZydisElementType element_type;
+ /**
+ * The size of a single element.
+ */
+ ZydisElementSize element_size;
+ /**
+ * The number of elements.
+ */
+ ZyanU16 element_count;
+ /**
+ * Extended info for register-operands.
+ */
+ struct ZydisDecodedOperandReg_
+ {
+ /**
+ * The register value.
+ */
+ ZydisRegister value;
+ // TODO: AVX512_4VNNIW MULTISOURCE registers
+ } reg;
+ /**
+ * Extended info for memory-operands.
+ */
+ struct ZydisDecodedOperandMem_
+ {
+ /**
+ * The type of the memory operand.
+ */
+ ZydisMemoryOperandType type;
+ /**
+ * The segment register.
+ */
+ ZydisRegister segment;
+ /**
+ * The base register.
+ */
+ ZydisRegister base;
+ /**
+ * The index register.
+ */
+ ZydisRegister index;
+ /**
+ * The scale factor.
+ */
+ ZyanU8 scale;
+ /**
+ * Extended info for memory-operands with displacement.
+ */
+ struct ZydisDecodedOperandMemDisp_
+ {
+ /**
+ * Signals, if the displacement value is used.
+ */
+ ZyanBool has_displacement;
+ /**
+ * The displacement value
+ */
+ ZyanI64 value;
+ } disp;
+ } mem;
+ /**
+ * Extended info for pointer-operands.
+ */
+ struct ZydisDecodedOperandPtr_
+ {
+ ZyanU16 segment;
+ ZyanU32 offset;
+ } ptr;
+ /**
+ * Extended info for immediate-operands.
+ */
+ struct ZydisDecodedOperandImm_
+ {
+ /**
+ * Signals, if the immediate value is signed.
+ */
+ ZyanBool is_signed;
+ /**
+ * Signals, if the immediate value contains a relative offset. You can use
+ * `ZydisCalcAbsoluteAddress` to determine the absolute address value.
+ */
+ ZyanBool is_relative;
+ /**
+ * The immediate value.
+ */
+ union ZydisDecodedOperandImmValue_
+ {
+ ZyanU64 u;
+ ZyanI64 s;
+ } value;
+ } imm;
+} ZydisDecodedOperand;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Decoded instruction */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Instruction attributes */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisInstructionAttributes` data-type.
+ */
+typedef ZyanU64 ZydisInstructionAttributes;
+
+/**
+ * The instruction has the `ModRM` byte.
+ */
+#define ZYDIS_ATTRIB_HAS_MODRM 0x0000000000000001 // (1 << 0)
+/**
+ * The instruction has the `SIB` byte.
+ */
+#define ZYDIS_ATTRIB_HAS_SIB 0x0000000000000002 // (1 << 1)
+/**
+ * The instruction has the `REX` prefix.
+ */
+#define ZYDIS_ATTRIB_HAS_REX 0x0000000000000004 // (1 << 2)
+/**
+ * The instruction has the `XOP` prefix.
+ */
+#define ZYDIS_ATTRIB_HAS_XOP 0x0000000000000008 // (1 << 3)
+/**
+ * The instruction has the `VEX` prefix.
+ */
+#define ZYDIS_ATTRIB_HAS_VEX 0x0000000000000010 // (1 << 4)
+/**
+ * The instruction has the `EVEX` prefix.
+ */
+#define ZYDIS_ATTRIB_HAS_EVEX 0x0000000000000020 // (1 << 5)
+/**
+ * The instruction has the `MVEX` prefix.
+ */
+#define ZYDIS_ATTRIB_HAS_MVEX 0x0000000000000040 // (1 << 6)
+/**
+ * The instruction has one or more operands with position-relative offsets.
+ */
+#define ZYDIS_ATTRIB_IS_RELATIVE 0x0000000000000080 // (1 << 7)
+/**
+ * The instruction is privileged.
+ *
+ * Privileged instructions are any instructions that require a current ring level below 3.
+ */
+#define ZYDIS_ATTRIB_IS_PRIVILEGED 0x0000000000000100 // (1 << 8)
+
+/**
+ * The instruction accesses one or more CPU-flags.
+ */
+#define ZYDIS_ATTRIB_CPUFLAG_ACCESS 0x0000001000000000 // (1 << 36) // TODO: rebase
+
+/**
+ * The instruction may conditionally read the general CPU state.
+ */
+#define ZYDIS_ATTRIB_CPU_STATE_CR 0x0000002000000000 // (1 << 37) // TODO: rebase
+/**
+ * The instruction may conditionally write the general CPU state.
+ */
+#define ZYDIS_ATTRIB_CPU_STATE_CW 0x0000004000000000 // (1 << 38) // TODO: rebase
+/**
+ * The instruction may conditionally read the FPU state (X87, MMX).
+ */
+#define ZYDIS_ATTRIB_FPU_STATE_CR 0x0000008000000000 // (1 << 39) // TODO: rebase
+/**
+ * The instruction may conditionally write the FPU state (X87, MMX).
+ */
+#define ZYDIS_ATTRIB_FPU_STATE_CW 0x0000010000000000 // (1 << 40) // TODO: rebase
+/**
+ * The instruction may conditionally read the XMM state (AVX, AVX2, AVX-512).
+ */
+#define ZYDIS_ATTRIB_XMM_STATE_CR 0x0000020000000000 // (1 << 41) // TODO: rebase
+/**
+ * The instruction may conditionally write the XMM state (AVX, AVX2, AVX-512).
+ */
+#define ZYDIS_ATTRIB_XMM_STATE_CW 0x0000040000000000 // (1 << 42) // TODO: rebase
+
+/**
+ * The instruction accepts the `LOCK` prefix (`0xF0`).
+ */
+#define ZYDIS_ATTRIB_ACCEPTS_LOCK 0x0000000000000200 // (1 << 9)
+/**
+ * The instruction accepts the `REP` prefix (`0xF3`).
+ */
+#define ZYDIS_ATTRIB_ACCEPTS_REP 0x0000000000000400 // (1 << 10)
+/**
+ * The instruction accepts the `REPE`/`REPZ` prefix (`0xF3`).
+ */
+#define ZYDIS_ATTRIB_ACCEPTS_REPE 0x0000000000000800 // (1 << 11)
+/**
+ * The instruction accepts the `REPE`/`REPZ` prefix (`0xF3`).
+ */
+#define ZYDIS_ATTRIB_ACCEPTS_REPZ 0x0000000000000800 // (1 << 11)
+/**
+ * The instruction accepts the `REPNE`/`REPNZ` prefix (`0xF2`).
+ */
+#define ZYDIS_ATTRIB_ACCEPTS_REPNE 0x0000000000001000 // (1 << 12)
+/**
+ * The instruction accepts the `REPNE`/`REPNZ` prefix (`0xF2`).
+ */
+#define ZYDIS_ATTRIB_ACCEPTS_REPNZ 0x0000000000001000 // (1 << 12)
+/**
+ * The instruction accepts the `BND` prefix (`0xF2`).
+ */
+#define ZYDIS_ATTRIB_ACCEPTS_BND 0x0000000000002000 // (1 << 13)
+/**
+ * The instruction accepts the `XACQUIRE` prefix (`0xF2`).
+ */
+#define ZYDIS_ATTRIB_ACCEPTS_XACQUIRE 0x0000000000004000 // (1 << 14)
+/**
+ * The instruction accepts the `XRELEASE` prefix (`0xF3`).
+ */
+#define ZYDIS_ATTRIB_ACCEPTS_XRELEASE 0x0000000000008000 // (1 << 15)
+/**
+ * The instruction accepts the `XACQUIRE`/`XRELEASE` prefixes (`0xF2`, `0xF3`)
+ * without the `LOCK` prefix (`0x0F`).
+ */
+#define ZYDIS_ATTRIB_ACCEPTS_HLE_WITHOUT_LOCK 0x0000000000010000 // (1 << 16)
+/**
+ * The instruction accepts branch hints (0x2E, 0x3E).
+ */
+#define ZYDIS_ATTRIB_ACCEPTS_BRANCH_HINTS 0x0000000000020000 // (1 << 17)
+/**
+ * The instruction accepts segment prefixes (`0x2E`, `0x36`, `0x3E`, `0x26`,
+ * `0x64`, `0x65`).
+ */
+#define ZYDIS_ATTRIB_ACCEPTS_SEGMENT 0x0000000000040000 // (1 << 18)
+/**
+ * The instruction has the `LOCK` prefix (`0xF0`).
+ */
+#define ZYDIS_ATTRIB_HAS_LOCK 0x0000000000080000 // (1 << 19)
+/**
+ * The instruction has the `REP` prefix (`0xF3`).
+ */
+#define ZYDIS_ATTRIB_HAS_REP 0x0000000000100000 // (1 << 20)
+/**
+ * The instruction has the `REPE`/`REPZ` prefix (`0xF3`).
+ */
+#define ZYDIS_ATTRIB_HAS_REPE 0x0000000000200000 // (1 << 21)
+/**
+ * The instruction has the `REPE`/`REPZ` prefix (`0xF3`).
+ */
+#define ZYDIS_ATTRIB_HAS_REPZ 0x0000000000200000 // (1 << 21)
+/**
+ * The instruction has the `REPNE`/`REPNZ` prefix (`0xF2`).
+ */
+#define ZYDIS_ATTRIB_HAS_REPNE 0x0000000000400000 // (1 << 22)
+/**
+ * The instruction has the `REPNE`/`REPNZ` prefix (`0xF2`).
+ */
+#define ZYDIS_ATTRIB_HAS_REPNZ 0x0000000000400000 // (1 << 22)
+/**
+ * The instruction has the `BND` prefix (`0xF2`).
+ */
+#define ZYDIS_ATTRIB_HAS_BND 0x0000000000800000 // (1 << 23)
+/**
+ * The instruction has the `XACQUIRE` prefix (`0xF2`).
+ */
+#define ZYDIS_ATTRIB_HAS_XACQUIRE 0x0000000001000000 // (1 << 24)
+/**
+ * The instruction has the `XRELEASE` prefix (`0xF3`).
+ */
+#define ZYDIS_ATTRIB_HAS_XRELEASE 0x0000000002000000 // (1 << 25)
+/**
+ * The instruction has the branch-not-taken hint (`0x2E`).
+ */
+#define ZYDIS_ATTRIB_HAS_BRANCH_NOT_TAKEN 0x0000000004000000 // (1 << 26)
+/**
+ * The instruction has the branch-taken hint (`0x3E`).
+ */
+#define ZYDIS_ATTRIB_HAS_BRANCH_TAKEN 0x0000000008000000 // (1 << 27)
+/**
+ * The instruction has a segment modifier.
+ */
+#define ZYDIS_ATTRIB_HAS_SEGMENT 0x00000003F0000000
+/**
+ * The instruction has the `CS` segment modifier (`0x2E`).
+ */
+#define ZYDIS_ATTRIB_HAS_SEGMENT_CS 0x0000000010000000 // (1 << 28)
+/**
+ * The instruction has the `SS` segment modifier (`0x36`).
+ */
+#define ZYDIS_ATTRIB_HAS_SEGMENT_SS 0x0000000020000000 // (1 << 29)
+/**
+ * The instruction has the `DS` segment modifier (`0x3E`).
+ */
+#define ZYDIS_ATTRIB_HAS_SEGMENT_DS 0x0000000040000000 // (1 << 30)
+/**
+ * The instruction has the `ES` segment modifier (`0x26`).
+ */
+#define ZYDIS_ATTRIB_HAS_SEGMENT_ES 0x0000000080000000 // (1 << 31)
+/**
+ * The instruction has the `FS` segment modifier (`0x64`).
+ */
+#define ZYDIS_ATTRIB_HAS_SEGMENT_FS 0x0000000100000000 // (1 << 32)
+/**
+ * The instruction has the `GS` segment modifier (`0x65`).
+ */
+#define ZYDIS_ATTRIB_HAS_SEGMENT_GS 0x0000000200000000 // (1 << 33)
+/**
+ * The instruction has the operand-size override prefix (`0x66`).
+ */
+#define ZYDIS_ATTRIB_HAS_OPERANDSIZE 0x0000000400000000 // (1 << 34) // TODO: rename
+/**
+ * The instruction has the address-size override prefix (`0x67`).
+ */
+#define ZYDIS_ATTRIB_HAS_ADDRESSSIZE 0x0000000800000000 // (1 << 35) // TODO: rename
+
+/* ---------------------------------------------------------------------------------------------- */
+/* R/E/FLAGS info */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisCPUFlags` data-type.
+ */
+typedef ZyanU32 ZydisCPUFlags;
+
+/**
+ * Defines the `ZydisCPUFlag` data-type.
+ */
+typedef ZyanU8 ZydisCPUFlag;
+
+/**
+ * Carry flag.
+ */
+#define ZYDIS_CPUFLAG_CF 0
+/**
+ * Parity flag.
+ */
+#define ZYDIS_CPUFLAG_PF 2
+/**
+ * Adjust flag.
+ */
+#define ZYDIS_CPUFLAG_AF 4
+/**
+ * Zero flag.
+ */
+#define ZYDIS_CPUFLAG_ZF 6
+/**
+ * Sign flag.
+ */
+#define ZYDIS_CPUFLAG_SF 7
+/**
+ * Trap flag.
+ */
+#define ZYDIS_CPUFLAG_TF 8
+/**
+ * Interrupt enable flag.
+ */
+#define ZYDIS_CPUFLAG_IF 9
+/**
+ * Direction flag.
+ */
+#define ZYDIS_CPUFLAG_DF 10
+/**
+ * Overflow flag.
+ */
+#define ZYDIS_CPUFLAG_OF 11
+/**
+ * I/O privilege level flag.
+ */
+#define ZYDIS_CPUFLAG_IOPL 12
+/**
+ * Nested task flag.
+ */
+#define ZYDIS_CPUFLAG_NT 14
+/**
+ * Resume flag.
+ */
+#define ZYDIS_CPUFLAG_RF 16
+/**
+ * Virtual 8086 mode flag.
+ */
+#define ZYDIS_CPUFLAG_VM 17
+/**
+ * Alignment check.
+ */
+#define ZYDIS_CPUFLAG_AC 18
+/**
+ * Virtual interrupt flag.
+ */
+#define ZYDIS_CPUFLAG_VIF 19
+/**
+ * Virtual interrupt pending.
+ */
+#define ZYDIS_CPUFLAG_VIP 20
+/**
+ * Able to use CPUID instruction.
+ */
+#define ZYDIS_CPUFLAG_ID 21
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * FPU condition-code flag 0.
+ *
+ * DEPRECATED. This flag is not actually part of `FLAGS/EFLAGS/RFLAGS` and will be removed in the
+ * next major release. Please refer to the `fpu_flags_read`/`fpu_flags_written` field instead and
+ * use one of the `ZYDIS_FPUFLAG_XXX` masks to check for specific a flag.
+ */
+#define ZYDIS_CPUFLAG_C0 22
+/**
+ * FPU condition-code flag 1.
+ *
+ * DEPRECATED. This flag is not actually part of `FLAGS/EFLAGS/RFLAGS` and will be removed in the
+ * next major release. Please refer to the `fpu_flags_read`/`fpu_flags_written` field instead and
+ * use one of the `ZYDIS_FPUFLAG_XXX` masks to check for specific a flag.
+ */
+#define ZYDIS_CPUFLAG_C1 23
+/**
+ * FPU condition-code flag 2.
+ *
+ * DEPRECATED. This flag is not actually part of `FLAGS/EFLAGS/RFLAGS` and will be removed in the
+ * next major release. Please refer to the `fpu_flags_read`/`fpu_flags_written` field instead and
+ * use one of the `ZYDIS_FPUFLAG_XXX` masks to check for specific a flag.
+ */
+#define ZYDIS_CPUFLAG_C2 24
+/**
+ * FPU condition-code flag 3.
+ *
+ * DEPRECATED. This flag is not actually part of `FLAGS/EFLAGS/RFLAGS` and will be removed in the
+ * next major release. Please refer to the `fpu_flags_read`/`fpu_flags_written` field instead and
+ * use one of the `ZYDIS_FPUFLAG_XXX` masks to check for specific a flag.
+ */
+#define ZYDIS_CPUFLAG_C3 25
+
+/**
+ * DEPRECATED. This define will be removed in the next major release.
+ */
+#define ZYDIS_CPUFLAG_MAX_VALUE ZYDIS_CPUFLAG_C3
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Defines the `ZydisFPUFlags` data-type.
+ */
+typedef ZyanU8 ZydisFPUFlags;
+
+/**
+ * FPU condition-code flag 0.
+ */
+#define ZYDIS_FPUFLAG_C0 0x00 // (1 << 0)
+/**
+ * FPU condition-code flag 1.
+ */
+#define ZYDIS_FPUFLAG_C1 0x01 // (1 << 1)
+ /**
+ * FPU condition-code flag 2.
+ */
+#define ZYDIS_FPUFLAG_C2 0x02 // (1 << 2)
+/**
+ * FPU condition-code flag 3.
+ */
+#define ZYDIS_FPUFLAG_C3 0x04 // (1 << 3)
+
+/**
+ * Defines the `ZydisCPUFlagAction` enum.
+ *
+ * DEPRECATED. This enum will be removed in the next major release.
+ */
+typedef enum ZydisCPUFlagAction_
+{
+ /**
+ * The CPU flag is not touched by the instruction.
+ */
+ ZYDIS_CPUFLAG_ACTION_NONE,
+ /**
+ * The CPU flag is tested (read).
+ */
+ ZYDIS_CPUFLAG_ACTION_TESTED,
+ /**
+ * The CPU flag is tested and modified afterwards (read-write).
+ */
+ ZYDIS_CPUFLAG_ACTION_TESTED_MODIFIED,
+ /**
+ * The CPU flag is modified (write).
+ */
+ ZYDIS_CPUFLAG_ACTION_MODIFIED,
+ /**
+ * The CPU flag is set to 0 (write).
+ */
+ ZYDIS_CPUFLAG_ACTION_SET_0,
+ /**
+ * The CPU flag is set to 1 (write).
+ */
+ ZYDIS_CPUFLAG_ACTION_SET_1,
+ /**
+ * The CPU flag is undefined (write).
+ */
+ ZYDIS_CPUFLAG_ACTION_UNDEFINED,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_CPUFLAG_ACTION_MAX_VALUE = ZYDIS_CPUFLAG_ACTION_UNDEFINED,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_CPUFLAG_ACTION_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_CPUFLAG_ACTION_MAX_VALUE)
+} ZydisCPUFlagAction;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Branch types */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisBranchType` enum.
+ */
+typedef enum ZydisBranchType_
+{
+ /**
+ * The instruction is not a branch instruction.
+ */
+ ZYDIS_BRANCH_TYPE_NONE,
+ /**
+ * The instruction is a short (8-bit) branch instruction.
+ */
+ ZYDIS_BRANCH_TYPE_SHORT,
+ /**
+ * The instruction is a near (16-bit or 32-bit) branch instruction.
+ */
+ ZYDIS_BRANCH_TYPE_NEAR,
+ /**
+ * The instruction is a far (inter-segment) branch instruction.
+ */
+ ZYDIS_BRANCH_TYPE_FAR,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_BRANCH_TYPE_MAX_VALUE = ZYDIS_BRANCH_TYPE_FAR,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_BRANCH_TYPE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_BRANCH_TYPE_MAX_VALUE)
+} ZydisBranchType;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* SSE/AVX exception-class */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisExceptionClass` enum.
+ */
+typedef enum ZydisExceptionClass_
+{
+ ZYDIS_EXCEPTION_CLASS_NONE,
+ // TODO: FP Exceptions
+ ZYDIS_EXCEPTION_CLASS_SSE1,
+ ZYDIS_EXCEPTION_CLASS_SSE2,
+ ZYDIS_EXCEPTION_CLASS_SSE3,
+ ZYDIS_EXCEPTION_CLASS_SSE4,
+ ZYDIS_EXCEPTION_CLASS_SSE5,
+ ZYDIS_EXCEPTION_CLASS_SSE7,
+ ZYDIS_EXCEPTION_CLASS_AVX1,
+ ZYDIS_EXC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_CLASS_AMXE6,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_EXCEPTION_CLASS_MAX_VALUE = ZYDIS_EXCEPTION_CLASS_AMXE6,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_EXCEPTION_CLASS_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_EXCEPTION_CLASS_MAX_VALUE)
+} ZydisExceptionClass;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* AVX mask mode */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisMaskMode` enum.
+ */
+typedef enum ZydisMaskMode_
+{
+ ZYDIS_MASK_MODE_INVALID,
+ /**
+ * Masking is disabled for the current instruction (`K0` register is used).
+ */
+ ZYDIS_MASK_MODE_DISABLED,
+ /**
+ * The embedded mask register is used as a merge-mask.
+ */
+ ZYDIS_MASK_MODE_MERGING,
+ /**
+ * The embedded mask register is used as a zero-mask.
+ */
+ ZYDIS_MASK_MODE_ZEROING,
+ /**
+ * The embedded mask register is used as a control-mask (element selector).
+ */
+ ZYDIS_MASK_MODE_CONTROL,
+ /**
+ * The embedded mask register is used as a zeroing control-mask (element selector).
+ */
+ ZYDIS_MASK_MODE_CONTROL_ZEROING,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_MASK_MODE_MAX_VALUE = ZYDIS_MASK_MODE_CONTROL_ZEROING,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_MASK_MODE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_MASK_MODE_MAX_VALUE)
+} ZydisMaskMode;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* AVX broadcast-mode */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisBroadcastMode` enum.
+ */
+typedef enum ZydisBroadcastMode_
+{
+ ZYDIS_BROADCAST_MODE_INVALID,
+ ZYDIS_BROADCAST_MODE_1_TO_2,
+ ZYDIS_BROADCAST_MODE_1_TO_4,
+ ZYDIS_BROADCAST_MODE_1_TO_8,
+ ZYDIS_BROADCAST_MODE_1_TO_16,
+ ZYDIS_BROADCAST_MODE_1_TO_32,
+ ZYDIS_BROADCAST_MODE_1_TO_64,
+ ZYDIS_BROADCAST_MODE_2_TO_4,
+ ZYDIS_BROADCAST_MODE_2_TO_8,
+ ZYDIS_BROADCAST_MODE_2_TO_16,
+ ZYDIS_BROADCAST_MODE_4_TO_8,
+ ZYDIS_BROADCAST_MODE_4_TO_16,
+ ZYDIS_BROADCAST_MODE_8_TO_16,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_BROADCAST_MODE_MAX_VALUE = ZYDIS_BROADCAST_MODE_8_TO_16,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_BROADCAST_MODE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_BROADCAST_MODE_MAX_VALUE)
+} ZydisBroadcastMode;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* AVX rounding-mode */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisRoundingMode` enum.
+ */
+typedef enum ZydisRoundingMode_
+{
+ ZYDIS_ROUNDING_MODE_INVALID,
+ /**
+ * Round to nearest.
+ */
+ ZYDIS_ROUNDING_MODE_RN,
+ /**
+ * Round down.
+ */
+ ZYDIS_ROUNDING_MODE_RD,
+ /**
+ * Round up.
+ */
+ ZYDIS_ROUNDING_MODE_RU,
+ /**
+ * Round towards zero.
+ */
+ ZYDIS_ROUNDING_MODE_RZ,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_ROUNDING_MODE_MAX_VALUE = ZYDIS_ROUNDING_MODE_RZ,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_ROUNDING_MODE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_ROUNDING_MODE_MAX_VALUE)
+} ZydisRoundingMode;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* KNC swizzle-mode */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisSwizzleMode` enum.
+ */
+typedef enum ZydisSwizzleMode_
+{
+ ZYDIS_SWIZZLE_MODE_INVALID,
+ ZYDIS_SWIZZLE_MODE_DCBA,
+ ZYDIS_SWIZZLE_MODE_CDAB,
+ ZYDIS_SWIZZLE_MODE_BADC,
+ ZYDIS_SWIZZLE_MODE_DACB,
+ ZYDIS_SWIZZLE_MODE_AAAA,
+ ZYDIS_SWIZZLE_MODE_BBBB,
+ ZYDIS_SWIZZLE_MODE_CCCC,
+ ZYDIS_SWIZZLE_MODE_DDDD,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_SWIZZLE_MODE_MAX_VALUE = ZYDIS_SWIZZLE_MODE_DDDD,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_SWIZZLE_MODE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_SWIZZLE_MODE_MAX_VALUE)
+} ZydisSwizzleMode;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* KNC conversion-mode */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisConversionMode` enum.
+ */
+typedef enum ZydisConversionMode_
+{
+ ZYDIS_CONVERSION_MODE_INVALID,
+ ZYDIS_CONVERSION_MODE_FLOAT16,
+ ZYDIS_CONVERSION_MODE_SINT8,
+ ZYDIS_CONVERSION_MODE_UINT8,
+ ZYDIS_CONVERSION_MODE_SINT16,
+ ZYDIS_CONVERSION_MODE_UINT16,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_CONVERSION_MODE_MAX_VALUE = ZYDIS_CONVERSION_MODE_UINT16,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_CONVERSION_MODE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_CONVERSION_MODE_MAX_VALUE)
+} ZydisConversionMode;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Legacy prefix type */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisPrefixType` enum.
+ */
+typedef enum ZydisPrefixType_
+{
+ /**
+ * The prefix is ignored by the instruction.
+ *
+ * This applies to all prefixes that are not accepted by the instruction in general or the
+ * ones that are overwritten by a prefix of the same group closer to the instruction opcode.
+ */
+ ZYDIS_PREFIX_TYPE_IGNORED,
+ /**
+ * The prefix is effectively used by the instruction.
+ */
+ ZYDIS_PREFIX_TYPE_EFFECTIVE,
+ /**
+ * The prefix is used as a mandatory prefix.
+ *
+ * A mandatory prefix is interpreted as an opcode extension and has no further effect on the
+ * instruction.
+ */
+ ZYDIS_PREFIX_TYPE_MANDATORY,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_PREFIX_TYPE_MAX_VALUE = ZYDIS_PREFIX_TYPE_MANDATORY,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_PREFIX_TYPE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_PREFIX_TYPE_MAX_VALUE)
+} ZydisPrefixType;
+
+// TODO: Check effective for 66/67 prefixes (currently defaults to EFFECTIVE)
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Decoded instruction */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Information about a decoded instruction.
+ */
+typedef struct ZydisDecodedInstruction_
+{
+ /**
+ * The machine mode used to decode this instruction.
+ */
+ ZydisMachineMode machine_mode;
+ /**
+ * The instruction-mnemonic.
+ */
+ ZydisMnemonic mnemonic;
+ /**
+ * The length of the decoded instruction.
+ */
+ ZyanU8 length;
+ /**
+ * The instruction-encoding (`LEGACY`, `3DNOW`, `VEX`, `EVEX`, `XOP`).
+ */
+ ZydisInstructionEncoding encoding;
+ /**
+ * The opcode-map.
+ */
+ ZydisOpcodeMap opcode_map;
+ /**
+ * The instruction-opcode.
+ */
+ ZyanU8 opcode;
+ /**
+ * The stack width.
+ */
+ ZyanU8 stack_width;
+ /**
+ * The effective operand width.
+ */
+ ZyanU8 operand_width;
+ /**
+ * The effective address width.
+ */
+ ZyanU8 address_width;
+ /**
+ * The number of instruction-operands.
+ */
+ ZyanU8 operand_count;
+ /**
+ * Detailed info for all instruction operands.
+ *
+ * Explicit operands are guaranteed to be in the front and ordered as they are printed
+ * by the formatter in Intel mode. No assumptions can be made about the order of hidden
+ * operands, except that they always located behind the explicit operands.
+ */
+ ZydisDecodedOperand operands[ZYDIS_MAX_OPERAND_COUNT];
+ /**
+ * Instruction attributes.
+ */
+ ZydisInstructionAttributes attributes;
+ /**
+ * Information about accessed CPU flags.
+ *
+ * DEPRECATED. This field will be removed in the next major release. Please use the
+ * `cpu_flags_read`/`cpu_flags_written` or `fpu_flags_read`/`fpu_flags_written` fields
+ * instead.
+ */
+ struct ZydisDecodedInstructionAccessedFlags_
+ {
+ /**
+ * The CPU-flag action.
+ *
+ * Use `ZydisGetAccessedFlagsByAction` to get a mask with all flags matching a specific
+ * action.
+ */
+ ZydisCPUFlagAction action;
+ } accessed_flags[ZYDIS_CPUFLAG_MAX_VALUE + 1];
+ /**
+ * A mask containing the CPU flags read by the instruction.
+ *
+ * The bits in this mask correspond to the actual bits in the `FLAGS/EFLAGS/RFLAGS`
+ * register.
+ *
+ * This mask includes the actions `TESTED` and `TESTED_MODIFIED`.
+ */
+ ZydisCPUFlags cpu_flags_read;
+ /**
+ * A mask containing the CPU flags written by the instruction.
+ *
+ * The bits in this mask correspond to the actual bits in the `FLAGS/EFLAGS/RFLAGS`
+ * register.
+ *
+ * This mask includes the actions `TESTED_MODIFIED`, `SET_0`, `SET_1` and `UNDEFINED`.
+ */
+ ZydisCPUFlags cpu_flags_written;
+ /**
+ * A mask containing the FPU flags read by the instruction.
+ */
+ ZydisFPUFlags fpu_flags_read;
+ /**
+ * A mask containing the FPU flags written by the instruction.
+ */
+ ZydisFPUFlags fpu_flags_written;
+ /**
+ * Extended info for `AVX` instructions.
+ */
+ struct ZydisDecodedInstructionAvx_
+ {
+ /**
+ * The `AVX` vector-length.
+ */
+ ZyanU16 vector_length;
+ /**
+ * Info about the embedded writemask-register (`AVX-512` and `KNC` only).
+ */
+ struct ZydisDecodedInstructionAvxMask_
+ {
+ /**
+ * The masking mode.
+ */
+ ZydisMaskMode mode;
+ /**
+ * The mask register.
+ */
+ ZydisRegister reg;
+ } mask;
+ /**
+ * Contains info about the `AVX` broadcast.
+ */
+ struct ZydisDecodedInstructionAvxBroadcast_
+ {
+ /**
+ * Signals, if the broadcast is a static broadcast.
+ *
+ * This is the case for instructions with inbuilt broadcast functionality, which is
+ * always active and not controlled by the `EVEX/MVEX.RC` bits.
+ */
+ ZyanBool is_static;
+ /**
+ * The `AVX` broadcast-mode.
+ */
+ ZydisBroadcastMode mode;
+ } broadcast;
+ /**
+ * Contains info about the `AVX` rounding.
+ */
+ struct ZydisDecodedInstructionAvxRounding_
+ {
+ /**
+ * The `AVX` rounding-mode.
+ */
+ ZydisRoundingMode mode;
+ } rounding;
+ /**
+ * Contains info about the `AVX` register-swizzle (`KNC` only).
+ */
+ struct ZydisDecodedInstructionAvxSwizzle_
+ {
+ /**
+ * The `AVX` register-swizzle mode.
+ */
+ ZydisSwizzleMode mode;
+ } swizzle;
+ /**
+ * Contains info about the `AVX` data-conversion (`KNC` only).
+ */
+ struct ZydisDecodedInstructionAvxConversion_
+ {
+ /**
+ * The `AVX` data-conversion mode.
+ */
+ ZydisConversionMode mode;
+ } conversion;
+ /**
+ * Signals, if the `SAE` (suppress-all-exceptions) functionality is
+ * enabled for the instruction.
+ */
+ ZyanBool has_sae;
+ /**
+ * Signals, if the instruction has a memory-eviction-hint (`KNC` only).
+ */
+ ZyanBool has_eviction_hint;
+ // TODO: publish EVEX tuple-type and MVEX functionality
+ } avx;
+ /**
+ * Meta info.
+ */
+ struct ZydisDecodedInstructionMeta_
+ {
+ /**
+ * The instruction category.
+ */
+ ZydisInstructionCategory category;
+ /**
+ * The ISA-set.
+ */
+ ZydisISASet isa_set;
+ /**
+ * The ISA-set extension.
+ */
+ ZydisISAExt isa_ext;
+ /**
+ * The branch type.
+ */
+ ZydisBranchType branch_type;
+ /**
+ * The exception class.
+ */
+ ZydisExceptionClass exception_class;
+ } meta;
+ /**
+ * Detailed info about different instruction-parts like `ModRM`, `SIB` or
+ * encoding-prefixes.
+ */
+ struct ZydisDecodedInstructionRaw_
+ {
+ /**
+ * The number of legacy prefixes.
+ */
+ ZyanU8 prefix_count;
+ /**
+ * Detailed info about the legacy prefixes (including `REX`).
+ */
+ struct ZydisDecodedInstructionRawPrefixes_
+ {
+ /**
+ * The prefix type.
+ */
+ ZydisPrefixType type;
+ /**
+ * The prefix byte.
+ */
+ ZyanU8 value;
+ } prefixes[ZYDIS_MAX_INSTRUCTION_LENGTH];
+ /**
+ * Detailed info about the `REX` prefix.
+ */
+ struct ZydisDecodedInstructionRawRex_
+ {
+ /**
+ * 64-bit operand-size promotion.
+ */
+ ZyanU8 W;
+ /**
+ * Extension of the `ModRM.reg` field.
+ */
+ ZyanU8 R;
+ /**
+ * Extension of the `SIB.index` field.
+ */
+ ZyanU8 X;
+ /**
+ * Extension of the `ModRM.rm`, `SIB.base`, or `opcode.reg` field.
+ */
+ ZyanU8 B;
+ /**
+ * The offset of the effective `REX` byte, relative to the beginning of the
+ * instruction, in bytes.
+ *
+ * This offset always points to the "effective" `REX` prefix (the one closest to the
+ * instruction opcode), if multiple `REX` prefixes are present.
+ *
+ * Note that the `REX` byte can be the first byte of the instruction, which would lead
+ * to an offset of `0`. Please refer to the instruction attributes to check for the
+ * presence of the `REX` prefix.
+ */
+ ZyanU8 offset;
+ } rex;
+ /**
+ * Detailed info about the `XOP` prefix.
+ */
+ struct ZydisDecodedInstructionRawXop_
+ {
+ /**
+ * Extension of the `ModRM.reg` field (inverted).
+ */
+ ZyanU8 R;
+ /**
+ * Extension of the `SIB.index` field (inverted).
+ */
+ ZyanU8 X;
+ /**
+ * Extension of the `ModRM.rm`, `SIB.base`, or `opcode.reg` field (inverted).
+ */
+ ZyanU8 B;
+ /**
+ * Opcode-map specifier.
+ */
+ ZyanU8 m_mmmm;
+ /**
+ * 64-bit operand-size promotion or opcode-extension.
+ */
+ ZyanU8 W;
+ /**
+ * `NDS`/`NDD` (non-destructive-source/destination) register
+ * specifier (inverted).
+ */
+ ZyanU8 vvvv;
+ /**
+ * Vector-length specifier.
+ */
+ ZyanU8 L;
+ /**
+ * Compressed legacy prefix.
+ */
+ ZyanU8 pp;
+ /**
+ * The offset of the first xop byte, relative to the beginning of
+ * the instruction, in bytes.
+ */
+ ZyanU8 offset;
+ } xop;
+ /**
+ * Detailed info about the `VEX` prefix.
+ */
+ struct ZydisDecodedInstructionRawVex_
+ {
+ /**
+ * Extension of the `ModRM.reg` field (inverted).
+ */
+ ZyanU8 R;
+ /**
+ * Extension of the `SIB.index` field (inverted).
+ */
+ ZyanU8 X;
+ /**
+ * Extension of the `ModRM.rm`, `SIB.base`, or `opcode.reg` field (inverted).
+ */
+ ZyanU8 B;
+ /**
+ * Opcode-map specifier.
+ */
+ ZyanU8 m_mmmm;
+ /**
+ * 64-bit operand-size promotion or opcode-extension.
+ */
+ ZyanU8 W;
+ /**
+ * `NDS`/`NDD` (non-destructive-source/destination) register specifier
+ * (inverted).
+ */
+ ZyanU8 vvvv;
+ /**
+ * Vector-length specifier.
+ */
+ ZyanU8 L;
+ /**
+ * Compressed legacy prefix.
+ */
+ ZyanU8 pp;
+ /**
+ * The offset of the first `VEX` byte, relative to the beginning of the instruction, in
+ * bytes.
+ */
+ ZyanU8 offset;
+ /**
+ * The size of the `VEX` prefix, in bytes.
+ */
+ ZyanU8 size;
+ } vex;
+ /**
+ * Detailed info about the `EVEX` prefix.
+ */
+ struct ZydisDecodedInstructionRawEvex_
+ {
+ /**
+ * Extension of the `ModRM.reg` field (inverted).
+ */
+ ZyanU8 R;
+ /**
+ * Extension of the `SIB.index/vidx` field (inverted).
+ */
+ ZyanU8 X;
+ /**
+ * Extension of the `ModRM.rm` or `SIB.base` field (inverted).
+ */
+ ZyanU8 B;
+ /**
+ * High-16 register specifier modifier (inverted).
+ */
+ ZyanU8 R2;
+ /**
+ * Opcode-map specifier.
+ */
+ ZyanU8 mm;
+ /**
+ * 64-bit operand-size promotion or opcode-extension.
+ */
+ ZyanU8 W;
+ /**
+ * `NDS`/`NDD` (non-destructive-source/destination) register specifier
+ * (inverted).
+ */
+ ZyanU8 vvvv;
+ /**
+ * Compressed legacy prefix.
+ */
+ ZyanU8 pp;
+ /**
+ * Zeroing/Merging.
+ */
+ ZyanU8 z;
+ /**
+ * Vector-length specifier or rounding-control (most significant bit).
+ */
+ ZyanU8 L2;
+ /**
+ * Vector-length specifier or rounding-control (least significant bit).
+ */
+ ZyanU8 L;
+ /**
+ * Broadcast/RC/SAE context.
+ */
+ ZyanU8 b;
+ /**
+ * High-16 `NDS`/`VIDX` register specifier.
+ */
+ ZyanU8 V2;
+ /**
+ * Embedded opmask register specifier.
+ */
+ ZyanU8 aaa;
+ /**
+ * The offset of the first evex byte, relative to the beginning of the
+ * instruction, in bytes.
+ */
+ ZyanU8 offset;
+ } evex;
+ /**
+ * Detailed info about the `MVEX` prefix.
+ */
+ struct ZydisDecodedInstructionRawMvex_
+ {
+ /**
+ * Extension of the `ModRM.reg` field (inverted).
+ */
+ ZyanU8 R;
+ /**
+ * Extension of the `SIB.index/vidx` field (inverted).
+ */
+ ZyanU8 X;
+ /**
+ * Extension of the `ModRM.rm` or `SIB.base` field (inverted).
+ */
+ ZyanU8 B;
+ /**
+ * High-16 register specifier modifier (inverted).
+ */
+ ZyanU8 R2;
+ /**
+ * Opcode-map specifier.
+ */
+ ZyanU8 mmmm;
+ /**
+ * 64-bit operand-size promotion or opcode-extension.
+ */
+ ZyanU8 W;
+ /**
+ * `NDS`/`NDD` (non-destructive-source/destination) register specifier
+ * (inverted).
+ */
+ ZyanU8 vvvv;
+ /**
+ * Compressed legacy prefix.
+ */
+ ZyanU8 pp;
+ /**
+ * Non-temporal/eviction hint.
+ */
+ ZyanU8 E;
+ /**
+ * Swizzle/broadcast/up-convert/down-convert/static-rounding controls.
+ */
+ ZyanU8 SSS;
+ /**
+ * High-16 `NDS`/`VIDX` register specifier.
+ */
+ ZyanU8 V2;
+ /**
+ * Embedded opmask register specifier.
+ */
+ ZyanU8 kkk;
+ /**
+ * The offset of the first mvex byte, relative to the beginning of the
+ * instruction, in bytes.
+ */
+ ZyanU8 offset;
+ } mvex;
+ /**
+ * Detailed info about the `ModRM` byte.
+ */
+ struct ZydisDecodedInstructionModRm_
+ {
+ /**
+ * The addressing mode.
+ */
+ ZyanU8 mod;
+ /**
+ * Register specifier or opcode-extension.
+ */
+ ZyanU8 reg;
+ /**
+ * Register specifier or opcode-extension.
+ */
+ ZyanU8 rm;
+ /**
+ * The offset of the `ModRM` byte, relative to the beginning of the
+ * instruction, in bytes.
+ */
+ ZyanU8 offset;
+ } modrm;
+ /**
+ * Detailed info about the `SIB` byte.
+ */
+ struct ZydisDecodedInstructionRawSib_
+ {
+ /**
+ * The scale factor.
+ */
+ ZyanU8 scale;
+ /**
+ * The index-register specifier.
+ */
+ ZyanU8 index;
+ /**
+ * The base-register specifier.
+ */
+ ZyanU8 base;
+ /**
+ * The offset of the `SIB` byte, relative to the beginning of the
+ * instruction, in bytes.
+ */
+ ZyanU8 offset;
+ } sib;
+ /**
+ * Detailed info about displacement-bytes.
+ */
+ struct ZydisDecodedInstructionRawDisp_
+ {
+ /**
+ * The displacement value
+ */
+ ZyanI64 value;
+ /**
+ * The physical displacement size, in bits.
+ */
+ ZyanU8 size;
+ // TODO: publish cd8 scale
+ /**
+ * The offset of the displacement data, relative to the beginning of the
+ * instruction, in bytes.
+ */
+ ZyanU8 offset;
+ } disp;
+ /**
+ * Detailed info about immediate-bytes.
+ */
+ struct ZydisDecodedInstructionRawImm_
+ {
+ /**
+ * Signals, if the immediate value is signed.
+ */
+ ZyanBool is_signed;
+ /**
+ * Signals, if the immediate value contains a relative offset. You can use
+ * `ZydisCalcAbsoluteAddress` to determine the absolute address value.
+ */
+ ZyanBool is_relative;
+ /**
+ * The immediate value.
+ */
+ union ZydisDecodedInstructionRawImmValue_
+ {
+ ZyanU64 u;
+ ZyanI64 s;
+ } value;
+ /**
+ * The physical immediate size, in bits.
+ */
+ ZyanU8 size;
+ /**
+ * The offset of the immediate data, relative to the beginning of the
+ * instruction, in bytes.
+ */
+ ZyanU8 offset;
+ } imm[2];
+ } raw;
+} ZydisDecodedInstruction;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYDIS_INSTRUCTIONINFO_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Formatter.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Formatter.h
new file mode 100644
index 0000000..c68bcde
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Formatter.h
@@ -0,0 +1,1179 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Functions for formatting instructions to human-readable text.
+ */
+
+#ifndef ZYDIS_FORMATTER_H
+#define ZYDIS_FORMATTER_H
+
+#include
+#include
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Constants */
+/* ============================================================================================== */
+
+/**
+ * Use this constant as value for `runtime_address` in `ZydisFormatterFormatInstruction(Ex)`
+ * or `ZydisFormatterFormatOperand(Ex)` to print relative values for all addresses.
+ */
+#define ZYDIS_RUNTIME_ADDRESS_NONE (ZyanU64)(-1)
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Formatter style */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisFormatterStyle` enum.
+ */
+typedef enum ZydisFormatterStyle_
+{
+ /**
+ * Generates `AT&T`-style disassembly.
+ */
+ ZYDIS_FORMATTER_STYLE_ATT,
+ /**
+ * Generates `Intel`-style disassembly.
+ */
+ ZYDIS_FORMATTER_STYLE_INTEL,
+ /**
+ * Generates `MASM`-style disassembly that is directly accepted as input for
+ * the `MASM` assembler.
+ *
+ * The runtime-address is ignored in this mode.
+ */
+ ZYDIS_FORMATTER_STYLE_INTEL_MASM,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_FORMATTER_STYLE_MAX_VALUE = ZYDIS_FORMATTER_STYLE_INTEL_MASM,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_FORMATTER_STYLE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_FORMATTER_STYLE_MAX_VALUE)
+} ZydisFormatterStyle;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Properties */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisFormatterProperty` enum.
+ */
+typedef enum ZydisFormatterProperty_
+{
+ /* ---------------------------------------------------------------------------------------- */
+ /* General */
+ /* ---------------------------------------------------------------------------------------- */
+
+ /**
+ * Controls the printing of effective operand-size suffixes (`AT&T`) or operand-sizes
+ * of memory operands (`INTEL`).
+ *
+ * Pass `ZYAN_TRUE` as value to force the formatter to always print the size, or `ZYAN_FALSE`
+ * to only print it if needed.
+ */
+ ZYDIS_FORMATTER_PROP_FORCE_SIZE,
+ /**
+ * Controls the printing of segment prefixes.
+ *
+ * Pass `ZYAN_TRUE` as value to force the formatter to always print the segment register of
+ * memory-operands or `ZYAN_FALSE` to omit implicit `DS`/`SS` segments.
+ */
+ ZYDIS_FORMATTER_PROP_FORCE_SEGMENT,
+ /**
+ * Controls the printing of branch addresses.
+ *
+ * Pass `ZYAN_TRUE` as value to force the formatter to always print relative branch addresses
+ * or `ZYAN_FALSE` to use absolute addresses, if a runtime-address different to
+ * `ZYDIS_RUNTIME_ADDRESS_NONE` was passed.
+ */
+ ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_BRANCHES,
+ /**
+ * Controls the printing of `EIP`/`RIP`-relative addresses.
+ *
+ * Pass `ZYAN_TRUE` as value to force the formatter to always print relative addresses for
+ * `EIP`/`RIP`-relative operands or `ZYAN_FALSE` to use absolute addresses, if a runtime-
+ * address different to `ZYDIS_RUNTIME_ADDRESS_NONE` was passed.
+ */
+ ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_RIPREL,
+ /**
+ * Controls the printing of branch-instructions sizes.
+ *
+ * Pass `ZYAN_TRUE` as value to print the size (`short`, `near`) of branch
+ * instructions or `ZYAN_FALSE` to hide it.
+ *
+ * Note that the `far`/`l` modifier is always printed.
+ */
+ ZYDIS_FORMATTER_PROP_PRINT_BRANCH_SIZE,
+
+ /**
+ * Controls the printing of instruction prefixes.
+ *
+ * Pass `ZYAN_TRUE` as value to print all instruction-prefixes (even ignored or duplicate
+ * ones) or `ZYAN_FALSE` to only print prefixes that are effectively used by the instruction.
+ */
+ ZYDIS_FORMATTER_PROP_DETAILED_PREFIXES,
+
+ /* ---------------------------------------------------------------------------------------- */
+ /* Numeric values */
+ /* ---------------------------------------------------------------------------------------- */
+
+ /**
+ * Controls the base of address values.
+ */
+ ZYDIS_FORMATTER_PROP_ADDR_BASE,
+ /**
+ * Controls the signedness of relative addresses. Absolute addresses are
+ * always unsigned.
+ */
+ ZYDIS_FORMATTER_PROP_ADDR_SIGNEDNESS,
+ /**
+ * Controls the padding of absolute address values.
+ *
+ * Pass `ZYDIS_PADDING_DISABLED` to disable padding, `ZYDIS_PADDING_AUTO` to padd all
+ * addresses to the current stack width (hexadecimal only), or any other integer value for
+ * custom padding.
+ */
+ ZYDIS_FORMATTER_PROP_ADDR_PADDING_ABSOLUTE,
+ /**
+ * Controls the padding of relative address values.
+ *
+ * Pass `ZYDIS_PADDING_DISABLED` to disable padding, `ZYDIS_PADDING_AUTO` to padd all
+ * addresses to the current stack width (hexadecimal only), or any other integer value for
+ * custom padding.
+ */
+ ZYDIS_FORMATTER_PROP_ADDR_PADDING_RELATIVE,
+
+ /* ---------------------------------------------------------------------------------------- */
+
+ /**
+ * Controls the base of displacement values.
+ */
+ ZYDIS_FORMATTER_PROP_DISP_BASE,
+ /**
+ * Controls the signedness of displacement values.
+ */
+ ZYDIS_FORMATTER_PROP_DISP_SIGNEDNESS,
+ /**
+ * Controls the padding of displacement values.
+ *
+ * Pass `ZYDIS_PADDING_DISABLED` to disable padding, or any other integer value for custom
+ * padding.
+ */
+ ZYDIS_FORMATTER_PROP_DISP_PADDING,
+
+ /* ---------------------------------------------------------------------------------------- */
+
+ /**
+ * Controls the base of immediate values.
+ */
+ ZYDIS_FORMATTER_PROP_IMM_BASE,
+ /**
+ * Controls the signedness of immediate values.
+ *
+ * Pass `ZYDIS_SIGNEDNESS_AUTO` to automatically choose the most suitable mode based on the
+ * operands `ZydisDecodedOperand.imm.is_signed` attribute.
+ */
+ ZYDIS_FORMATTER_PROP_IMM_SIGNEDNESS,
+ /**
+ * Controls the padding of immediate values.
+ *
+ * Pass `ZYDIS_PADDING_DISABLED` to disable padding, `ZYDIS_PADDING_AUTO` to padd all
+ * immediates to the operand-width (hexadecimal only), or any other integer value for custom
+ * padding.
+ */
+ ZYDIS_FORMATTER_PROP_IMM_PADDING,
+
+ /* ---------------------------------------------------------------------------------------- */
+ /* Text formatting */
+ /* ---------------------------------------------------------------------------------------- */
+
+ /**
+ * Controls the letter-case for prefixes.
+ *
+ * Pass `ZYAN_TRUE` as value to format in uppercase or `ZYAN_FALSE` to format in lowercase.
+ */
+ ZYDIS_FORMATTER_PROP_UPPERCASE_PREFIXES,
+ /**
+ * Controls the letter-case for the mnemonic.
+ *
+ * Pass `ZYAN_TRUE` as value to format in uppercase or `ZYAN_FALSE` to format in lowercase.
+ */
+ ZYDIS_FORMATTER_PROP_UPPERCASE_MNEMONIC,
+ /**
+ * Controls the letter-case for registers.
+ *
+ * Pass `ZYAN_TRUE` as value to format in uppercase or `ZYAN_FALSE` to format in lowercase.
+ */
+ ZYDIS_FORMATTER_PROP_UPPERCASE_REGISTERS,
+ /**
+ * Controls the letter-case for typecasts.
+ *
+ * Pass `ZYAN_TRUE` as value to format in uppercase or `ZYAN_FALSE` to format in lowercase.
+ */
+ ZYDIS_FORMATTER_PROP_UPPERCASE_TYPECASTS,
+ /**
+ * Controls the letter-case for decorators.
+ *
+ * Pass `ZYAN_TRUE` as value to format in uppercase or `ZYAN_FALSE` to format in lowercase.
+ */
+ ZYDIS_FORMATTER_PROP_UPPERCASE_DECORATORS,
+
+ /* ---------------------------------------------------------------------------------------- */
+ /* Number formatting */
+ /* ---------------------------------------------------------------------------------------- */
+
+ /**
+ * Controls the prefix for decimal values.
+ *
+ * Pass a pointer to a null-terminated C-style string with a maximum length of 10 characters
+ * to set a custom prefix, or `ZYAN_NULL` to disable it.
+ *
+ * The string is deep-copied into an internal buffer.
+ */
+ ZYDIS_FORMATTER_PROP_DEC_PREFIX,
+ /**
+ * Controls the suffix for decimal values.
+ *
+ * Pass a pointer to a null-terminated C-style string with a maximum length of 10 characters
+ * to set a custom suffix, or `ZYAN_NULL` to disable it.
+ *
+ * The string is deep-copied into an internal buffer.
+ */
+ ZYDIS_FORMATTER_PROP_DEC_SUFFIX,
+
+ /* ---------------------------------------------------------------------------------------- */
+
+ /**
+ * Controls the letter-case of hexadecimal values.
+ *
+ * Pass `ZYAN_TRUE` as value to format in uppercase and `ZYAN_FALSE` to format in lowercase.
+ *
+ * The default value is `ZYAN_TRUE`.
+ */
+ ZYDIS_FORMATTER_PROP_HEX_UPPERCASE,
+ /**
+ * Controls the prefix for hexadecimal values.
+ *
+ * Pass a pointer to a null-terminated C-style string with a maximum length of 10 characters
+ * to set a custom prefix, or `ZYAN_NULL` to disable it.
+ *
+ * The string is deep-copied into an internal buffer.
+ */
+ ZYDIS_FORMATTER_PROP_HEX_PREFIX,
+ /**
+ * Controls the suffix for hexadecimal values.
+ *
+ * Pass a pointer to a null-terminated C-style string with a maximum length of 10 characters
+ * to set a custom suffix, or `ZYAN_NULL` to disable it.
+ *
+ * The string is deep-copied into an internal buffer.
+ */
+ ZYDIS_FORMATTER_PROP_HEX_SUFFIX,
+
+ /* ---------------------------------------------------------------------------------------- */
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_FORMATTER_PROP_MAX_VALUE = ZYDIS_FORMATTER_PROP_HEX_SUFFIX,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_FORMATTER_PROP_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_FORMATTER_PROP_MAX_VALUE)
+} ZydisFormatterProperty;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisNumericBase` enum.
+ */
+typedef enum ZydisNumericBase_
+{
+ /**
+ * Decimal system.
+ */
+ ZYDIS_NUMERIC_BASE_DEC,
+ /**
+ * Hexadecimal system.
+ */
+ ZYDIS_NUMERIC_BASE_HEX,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_NUMERIC_BASE_MAX_VALUE = ZYDIS_NUMERIC_BASE_HEX,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_NUMERIC_BASE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_NUMERIC_BASE_MAX_VALUE)
+} ZydisNumericBase;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisSignedness` enum.
+ */
+typedef enum ZydisSignedness_
+{
+ /**
+ * Automatically choose the most suitable mode based on the operands
+ * ZydisDecodedOperand.imm.is_signed` attribute.
+ */
+ ZYDIS_SIGNEDNESS_AUTO,
+ /**
+ * Force signed values.
+ */
+ ZYDIS_SIGNEDNESS_SIGNED,
+ /**
+ * Force unsigned values.
+ */
+ ZYDIS_SIGNEDNESS_UNSIGNED,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_SIGNEDNESS_MAX_VALUE = ZYDIS_SIGNEDNESS_UNSIGNED,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_SIGNEDNESS_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_SIGNEDNESS_MAX_VALUE)
+} ZydisSignedness;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisPadding` enum.
+ */
+typedef enum ZydisPadding_
+{
+ /**
+ * Disables padding.
+ */
+ ZYDIS_PADDING_DISABLED = 0,
+ /**
+ * Padds the value to the current stack-width for addresses, or to the
+ * operand-width for immediate values (hexadecimal only).
+ */
+ ZYDIS_PADDING_AUTO = (-1),
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_PADDING_MAX_VALUE = ZYDIS_PADDING_AUTO,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_PADDING_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_PADDING_MAX_VALUE)
+} ZydisPadding;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Function types */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisFormatterFunction` enum.
+ *
+ * Do NOT change the order of the values this enum or the function fields inside the
+ * `ZydisFormatter` struct.
+ */
+typedef enum ZydisFormatterFunction_
+{
+ /* ---------------------------------------------------------------------------------------- */
+ /* Instruction */
+ /* ---------------------------------------------------------------------------------------- */
+
+ /**
+ * This function is invoked before the formatter formats an instruction.
+ */
+ ZYDIS_FORMATTER_FUNC_PRE_INSTRUCTION,
+ /**
+ * This function is invoked after the formatter formatted an instruction.
+ */
+ ZYDIS_FORMATTER_FUNC_POST_INSTRUCTION,
+
+ /* ---------------------------------------------------------------------------------------- */
+
+ /**
+ * This function refers to the main formatting function.
+ *
+ * Replacing this function allows for complete custom formatting, but indirectly disables all
+ * other hooks except for `ZYDIS_FORMATTER_FUNC_PRE_INSTRUCTION` and
+ * `ZYDIS_FORMATTER_FUNC_POST_INSTRUCTION`.
+ */
+ ZYDIS_FORMATTER_FUNC_FORMAT_INSTRUCTION,
+
+ /* ---------------------------------------------------------------------------------------- */
+ /* Operands */
+ /* ---------------------------------------------------------------------------------------- */
+
+ /**
+ * This function is invoked before the formatter formats an operand.
+ */
+ ZYDIS_FORMATTER_FUNC_PRE_OPERAND,
+ /**
+ * This function is invoked after the formatter formatted an operand.
+ */
+ ZYDIS_FORMATTER_FUNC_POST_OPERAND,
+
+ /* ---------------------------------------------------------------------------------------- */
+
+ /**
+ * This function is invoked to format a register operand.
+ */
+ ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REG,
+ /**
+ * This function is invoked to format a memory operand.
+ *
+ * Replacing this function might indirectly disable some specific calls to the
+ * `ZYDIS_FORMATTER_FUNC_PRINT_TYPECAST`, `ZYDIS_FORMATTER_FUNC_PRINT_SEGMENT`,
+ * `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS` and `ZYDIS_FORMATTER_FUNC_PRINT_DISP` functions.
+ */
+ ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEM,
+ /**
+ * This function is invoked to format a pointer operand.
+ */
+ ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTR,
+ /**
+ * This function is invoked to format an immediate operand.
+ *
+ * Replacing this function might indirectly disable some specific calls to the
+ * `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS`, `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_REL` and
+ * `ZYDIS_FORMATTER_FUNC_PRINT_IMM` functions.
+ */
+ ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM,
+
+ /* ---------------------------------------------------------------------------------------- */
+ /* Elemental tokens */
+ /* ---------------------------------------------------------------------------------------- */
+
+ /**
+ * This function is invoked to print the instruction mnemonic.
+ */
+ ZYDIS_FORMATTER_FUNC_PRINT_MNEMONIC,
+
+ /* ---------------------------------------------------------------------------------------- */
+
+ /**
+ * This function is invoked to print a register.
+ */
+ ZYDIS_FORMATTER_FUNC_PRINT_REGISTER,
+ /**
+ * This function is invoked to print absolute addresses.
+ *
+ * Conditionally invoked, if a runtime-address different to `ZYDIS_RUNTIME_ADDRESS_NONE` was
+ * passed:
+ * - `IMM` operands with relative address (e.g. `JMP`, `CALL`, ...)
+ * - `MEM` operands with `EIP`/`RIP`-relative address (e.g. `MOV RAX, [RIP+0x12345678]`)
+ *
+ * Always invoked for:
+ * - `MEM` operands with absolute address (e.g. `MOV RAX, [0x12345678]`)
+ */
+ ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS,
+ /**
+ * This function is invoked to print relative addresses.
+ *
+ * Conditionally invoked, if `ZYDIS_RUNTIME_ADDRESS_NONE` was passed as runtime-address:
+ * - `IMM` operands with relative address (e.g. `JMP`, `CALL`, ...)
+ */
+ ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_REL,
+ /**
+ * This function is invoked to print a memory displacement value.
+ *
+ * If the memory displacement contains an address and a runtime-address different to
+ * `ZYDIS_RUNTIME_ADDRESS_NONE` was passed, `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS` is called
+ * instead.
+ */
+ ZYDIS_FORMATTER_FUNC_PRINT_DISP,
+ /**
+ * This function is invoked to print an immediate value.
+ *
+ * If the immediate contains an address and a runtime-address different to
+ * `ZYDIS_RUNTIME_ADDRESS_NONE` was passed, `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS` is called
+ * instead.
+ *
+ * If the immediate contains an address and `ZYDIS_RUNTIME_ADDRESS_NONE` was passed as
+ * runtime-address, `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_REL` is called instead.
+ */
+ ZYDIS_FORMATTER_FUNC_PRINT_IMM,
+
+ /* ---------------------------------------------------------------------------------------- */
+ /* Optional tokens */
+ /* ---------------------------------------------------------------------------------------- */
+
+ /**
+ * This function is invoked to print the size of a memory operand (`INTEL` only).
+ */
+ ZYDIS_FORMATTER_FUNC_PRINT_TYPECAST,
+ /**
+ * This function is invoked to print the segment-register of a memory operand.
+ */
+ ZYDIS_FORMATTER_FUNC_PRINT_SEGMENT,
+ /**
+ * This function is invoked to print the instruction prefixes.
+ */
+ ZYDIS_FORMATTER_FUNC_PRINT_PREFIXES,
+ /**
+ * This function is invoked after formatting an operand to print a `EVEX`/`MVEX`
+ * decorator.
+ */
+ ZYDIS_FORMATTER_FUNC_PRINT_DECORATOR,
+
+ /* ---------------------------------------------------------------------------------------- */
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_FORMATTER_FUNC_MAX_VALUE = ZYDIS_FORMATTER_FUNC_PRINT_DECORATOR,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_FORMATTER_FUNC_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_FORMATTER_FUNC_MAX_VALUE)
+} ZydisFormatterFunction;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Decorator types */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisDecorator` enum.
+ */
+typedef enum ZydisDecorator_
+{
+ ZYDIS_DECORATOR_INVALID,
+ /**
+ * The embedded-mask decorator.
+ */
+ ZYDIS_DECORATOR_MASK,
+ /**
+ * The broadcast decorator.
+ */
+ ZYDIS_DECORATOR_BC,
+ /**
+ * The rounding-control decorator.
+ */
+ ZYDIS_DECORATOR_RC,
+ /**
+ * The suppress-all-exceptions decorator.
+ */
+ ZYDIS_DECORATOR_SAE,
+ /**
+ * The register-swizzle decorator.
+ */
+ ZYDIS_DECORATOR_SWIZZLE,
+ /**
+ * The conversion decorator.
+ */
+ ZYDIS_DECORATOR_CONVERSION,
+ /**
+ * The eviction-hint decorator.
+ */
+ ZYDIS_DECORATOR_EH,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_DECORATOR_MAX_VALUE = ZYDIS_DECORATOR_EH,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_DECORATOR_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_DECORATOR_MAX_VALUE)
+} ZydisDecorator;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Formatter context */
+/* ---------------------------------------------------------------------------------------------- */
+
+typedef struct ZydisFormatter_ ZydisFormatter;
+
+/**
+ * Defines the `ZydisFormatterContext` struct.
+ */
+typedef struct ZydisFormatterContext_
+{
+ /**
+ * A pointer to the `ZydisDecodedInstruction` struct.
+ */
+ const ZydisDecodedInstruction* instruction;
+ /**
+ * A pointer to the `ZydisDecodedOperand` struct.
+ */
+ const ZydisDecodedOperand* operand;
+ /**
+ * The runtime address of the instruction.
+ */
+ ZyanU64 runtime_address;
+ /**
+ * A pointer to user-defined data.
+ */
+ void* user_data;
+} ZydisFormatterContext;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Function prototypes */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisFormatterFunc` function prototype.
+ *
+ * @param formatter A pointer to the `ZydisFormatter` instance.
+ * @param buffer A pointer to the `ZydisFormatterBuffer` struct.
+ * @param context A pointer to the `ZydisFormatterContext` struct.
+ *
+ * @return A zyan status code.
+ *
+ * Returning a status code other than `ZYAN_STATUS_SUCCESS` will immediately cause the formatting
+ * process to fail (see exceptions below).
+ *
+ * Returning `ZYDIS_STATUS_SKIP_TOKEN` is valid for functions of the following types and will
+ * instruct the formatter to omit the whole operand:
+ * - `ZYDIS_FORMATTER_FUNC_PRE_OPERAND`
+ * - `ZYDIS_FORMATTER_FUNC_POST_OPERAND`
+ * - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REG`
+ * - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEM`
+ * - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTR`
+ * - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM`
+ *
+ * This function prototype is used by functions of the following types:
+ * - `ZYDIS_FORMATTER_FUNC_PRE_INSTRUCTION`
+ * - `ZYDIS_FORMATTER_FUNC_POST_INSTRUCTION`
+ * - `ZYDIS_FORMATTER_FUNC_PRE_OPERAND`
+ * - `ZYDIS_FORMATTER_FUNC_POST_OPERAND`
+ * - `ZYDIS_FORMATTER_FUNC_FORMAT_INSTRUCTION`
+ * - `ZYDIS_FORMATTER_FUNC_PRINT_MNEMONIC`
+ * - `ZYDIS_FORMATTER_FUNC_PRINT_PREFIXES`
+ * - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REG`
+ * - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEM`
+ * - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTR`
+ * - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM`
+ * - `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS`
+ * - `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_REL`
+ * - `ZYDIS_FORMATTER_FUNC_PRINT_DISP`
+ * - `ZYDIS_FORMATTER_FUNC_PRINT_IMM`
+ * - `ZYDIS_FORMATTER_FUNC_PRINT_TYPECAST`
+ * - `ZYDIS_FORMATTER_FUNC_PRINT_SEGMENT`
+ */
+typedef ZyanStatus (*ZydisFormatterFunc)(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+ /**
+ * Defines the `ZydisFormatterRegisterFunc` function prototype.
+ *
+ * @param formatter A pointer to the `ZydisFormatter` instance.
+ * @param buffer A pointer to the `ZydisFormatterBuffer` struct.
+ * @param context A pointer to the `ZydisFormatterContext` struct.
+ * @param reg The register.
+ *
+ * @return Returning a status code other than `ZYAN_STATUS_SUCCESS` will immediately cause the
+ * formatting process to fail.
+ *
+ * This function prototype is used by functions of the following types:
+ * - `ZYDIS_FORMATTER_FUNC_PRINT_REGISTER`.
+ */
+typedef ZyanStatus (*ZydisFormatterRegisterFunc)(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context, ZydisRegister reg);
+
+/**
+ * Defines the `ZydisFormatterDecoratorFunc` function prototype.
+ *
+ * @param formatter A pointer to the `ZydisFormatter` instance.
+ * @param buffer A pointer to the `ZydisFormatterBuffer` struct.
+ * @param context A pointer to the `ZydisFormatterContext` struct.
+ * @param decorator The decorator type.
+ *
+ * @return Returning a status code other than `ZYAN_STATUS_SUCCESS` will immediately cause the
+ * formatting process to fail.
+ *
+ * This function type is used for:
+ * - `ZYDIS_FORMATTER_FUNC_PRINT_DECORATOR`
+ */
+typedef ZyanStatus (*ZydisFormatterDecoratorFunc)(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context, ZydisDecorator decorator);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Formatter struct */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisFormatter` struct.
+ *
+ * All fields in this struct should be considered as "private". Any changes may lead to unexpected
+ * behavior.
+ *
+ * Do NOT change the order of the function fields or the values of the `ZydisFormatterFunction`
+ * enum.
+ */
+struct ZydisFormatter_
+{
+ /**
+ * The formatter style.
+ */
+ ZydisFormatterStyle style;
+ /**
+ * The `ZYDIS_FORMATTER_PROP_FORCE_SIZE` property.
+ */
+ ZyanBool force_memory_size;
+ /**
+ * The `ZYDIS_FORMATTER_PROP_FORCE_SEGMENT` property.
+ */
+ ZyanBool force_memory_segment;
+ /**
+ * The `ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_BRANCHES` property.
+ */
+ ZyanBool force_relative_branches;
+ /**
+ * The `ZYDIS_FORMATTER_PROP_FORCE_RELATIVE_RIPREL` property.
+ */
+ ZyanBool force_relative_riprel;
+ /**
+ * The `ZYDIS_FORMATTER_PROP_PRINT_BRANCH_SIZE` property.
+ */
+ ZyanBool print_branch_size;
+ /**
+ * The `ZYDIS_FORMATTER_DETAILED_PREFIXES` property.
+ */
+ ZyanBool detailed_prefixes;
+ /**
+ * The `ZYDIS_FORMATTER_ADDR_BASE` property.
+ */
+ ZydisNumericBase addr_base;
+ /**
+ * The `ZYDIS_FORMATTER_ADDR_SIGNEDNESS` property.
+ */
+ ZydisSignedness addr_signedness;
+ /**
+ * The `ZYDIS_FORMATTER_ADDR_PADDING_ABSOLUTE` property.
+ */
+ ZydisPadding addr_padding_absolute;
+ /**
+ * The `ZYDIS_FORMATTER_ADDR_PADDING_RELATIVE` property.
+ */
+ ZydisPadding addr_padding_relative;
+ /**
+ * The `ZYDIS_FORMATTER_DISP_BASE` property.
+ */
+ ZydisNumericBase disp_base;
+ /**
+ * The `ZYDIS_FORMATTER_DISP_SIGNEDNESS` property.
+ */
+ ZydisSignedness disp_signedness;
+ /**
+ * The `ZYDIS_FORMATTER_DISP_PADDING` property.
+ */
+ ZydisPadding disp_padding;
+ /**
+ * The `ZYDIS_FORMATTER_IMM_BASE` property.
+ */
+ ZydisNumericBase imm_base;
+ /**
+ * The `ZYDIS_FORMATTER_IMM_SIGNEDNESS` property.
+ */
+ ZydisSignedness imm_signedness;
+ /**
+ * The `ZYDIS_FORMATTER_IMM_PADDING` property.
+ */
+ ZydisPadding imm_padding;
+ /**
+ * The `ZYDIS_FORMATTER_UPPERCASE_PREFIXES` property.
+ */
+ ZyanI32 case_prefixes;
+ /**
+ * The `ZYDIS_FORMATTER_UPPERCASE_MNEMONIC` property.
+ */
+ ZyanI32 case_mnemonic;
+ /**
+ * The `ZYDIS_FORMATTER_UPPERCASE_REGISTERS` property.
+ */
+ ZyanI32 case_registers;
+ /**
+ * The `ZYDIS_FORMATTER_UPPERCASE_TYPECASTS` property.
+ */
+ ZyanI32 case_typecasts;
+ /**
+ * The `ZYDIS_FORMATTER_UPPERCASE_DECORATORS` property.
+ */
+ ZyanI32 case_decorators;
+ /**
+ * The `ZYDIS_FORMATTER_HEX_UPPERCASE` property.
+ */
+ ZyanBool hex_uppercase;
+ /**
+ * The number formats for all numeric bases.
+ *
+ * Index 0 = prefix
+ * Index 1 = suffix
+ */
+ struct
+ {
+ /**
+ * A pointer to the `ZyanStringView` to use as prefix/suffix.
+ */
+ const ZyanStringView* string;
+ /**
+ * The `ZyanStringView` to use as prefix/suffix
+ */
+ ZyanStringView string_data;
+ /**
+ * The actual string data.
+ */
+ char buffer[11];
+ } number_format[ZYDIS_NUMERIC_BASE_MAX_VALUE + 1][2];
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_PRE_INSTRUCTION` function.
+ */
+ ZydisFormatterFunc func_pre_instruction;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_POST_INSTRUCTION` function.
+ */
+ ZydisFormatterFunc func_post_instruction;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_FORMAT_INSTRUCTION` function.
+ */
+ ZydisFormatterFunc func_format_instruction;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_PRE_OPERAND` function.
+ */
+ ZydisFormatterFunc func_pre_operand;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_POST_OPERAND` function.
+ */
+ ZydisFormatterFunc func_post_operand;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REG` function.
+ */
+ ZydisFormatterFunc func_format_operand_reg;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEM` function.
+ */
+ ZydisFormatterFunc func_format_operand_mem;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTR` function.
+ */
+ ZydisFormatterFunc func_format_operand_ptr;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM` function.
+ */
+ ZydisFormatterFunc func_format_operand_imm;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_PRINT_MNEMONIC function.
+ */
+ ZydisFormatterFunc func_print_mnemonic;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_PRINT_REGISTER` function.
+ */
+ ZydisFormatterRegisterFunc func_print_register;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_ABS` function.
+ */
+ ZydisFormatterFunc func_print_address_abs;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_PRINT_ADDRESS_REL` function.
+ */
+ ZydisFormatterFunc func_print_address_rel;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_PRINT_DISP` function.
+ */
+ ZydisFormatterFunc func_print_disp;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_PRINT_IMM` function.
+ */
+ ZydisFormatterFunc func_print_imm;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_PRINT_TYPECAST` function.
+ */
+ ZydisFormatterFunc func_print_typecast;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_PRINT_SEGMENT` function.
+ */
+ ZydisFormatterFunc func_print_segment;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_PRINT_PREFIXES` function.
+ */
+ ZydisFormatterFunc func_print_prefixes;
+ /**
+ * The `ZYDIS_FORMATTER_FUNC_PRINT_DECORATOR` function.
+ */
+ ZydisFormatterDecoratorFunc func_print_decorator;
+};
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/**
+ * @addtogroup formatter Formatter
+ * Functions allowing formatting of previously decoded instructions to human readable text.
+ * @{
+ */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Initialization */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Initializes the given `ZydisFormatter` instance.
+ *
+ * @param formatter A pointer to the `ZydisFormatter` instance.
+ * @param style The base formatter style (either `AT&T` or `Intel` style).
+ *
+ * @return A zyan status code.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterInit(ZydisFormatter* formatter, ZydisFormatterStyle style);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Setter */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Changes the value of the specified formatter `property`.
+ *
+ * @param formatter A pointer to the `ZydisFormatter` instance.
+ * @param property The id of the formatter-property.
+ * @param value The new value.
+ *
+ * @return A zyan status code.
+ *
+ * This function returns `ZYAN_STATUS_INVALID_OPERATION` if a property can't be changed for the
+ * current formatter-style.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterSetProperty(ZydisFormatter* formatter,
+ ZydisFormatterProperty property, ZyanUPointer value);
+
+/**
+ * Replaces a formatter function with a custom callback and/or retrieves the currently
+ * used function.
+ *
+ * @param formatter A pointer to the `ZydisFormatter` instance.
+ * @param type The formatter function-type.
+ * @param callback A pointer to a variable that contains the pointer of the callback function
+ * and receives the pointer of the currently used function.
+ *
+ * @return A zyan status code.
+ *
+ * Call this function with `callback` pointing to a `ZYAN_NULL` value to retrieve the currently
+ * used function without replacing it.
+ *
+ * This function returns `ZYAN_STATUS_INVALID_OPERATION` if a function can't be replaced for the
+ * current formatter-style.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterSetHook(ZydisFormatter* formatter,
+ ZydisFormatterFunction type, const void** callback);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Formatting */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Formats the given instruction and writes it into the output buffer.
+ *
+ * @param formatter A pointer to the `ZydisFormatter` instance.
+ * @param instruction A pointer to the `ZydisDecodedInstruction` struct.
+ * @param buffer A pointer to the output buffer.
+ * @param length The length of the output buffer (in characters).
+ * @param runtime_address The runtime address of the instruction or `ZYDIS_RUNTIME_ADDRESS_NONE`
+ * to print relative addresses.
+ *
+ * @return A zyan status code.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatInstruction(const ZydisFormatter* formatter,
+ const ZydisDecodedInstruction* instruction, char* buffer, ZyanUSize length,
+ ZyanU64 runtime_address);
+
+/**
+ * Formats the given instruction and writes it into the output buffer.
+ *
+ * @param formatter A pointer to the `ZydisFormatter` instance.
+ * @param instruction A pointer to the `ZydisDecodedInstruction` struct.
+ * @param buffer A pointer to the output buffer.
+ * @param length The length of the output buffer (in characters).
+ * @param runtime_address The runtime address of the instruction or `ZYDIS_RUNTIME_ADDRESS_NONE`
+ * to print relative addresses.
+ * @param user_data A pointer to user-defined data which can be used in custom formatter
+ * callbacks.
+ *
+ * @return A zyan status code.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatInstructionEx(const ZydisFormatter* formatter,
+ const ZydisDecodedInstruction* instruction, char* buffer, ZyanUSize length,
+ ZyanU64 runtime_address, void* user_data);
+
+/**
+ * Formats the given operand and writes it into the output buffer.
+ *
+ * @param formatter A pointer to the `ZydisFormatter` instance.
+ * @param instruction A pointer to the `ZydisDecodedInstruction` struct.
+ * @param index The index of the operand to format.
+ * @param buffer A pointer to the output buffer.
+ * @param length The length of the output buffer (in characters).
+ * @param runtime_address The runtime address of the instruction or `ZYDIS_RUNTIME_ADDRESS_NONE`
+ * to print relative addresses.
+ *
+ * @return A zyan status code.
+ *
+ * Use `ZydisFormatterFormatInstruction` or `ZydisFormatterFormatInstructionEx` to format a
+ * complete instruction.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatOperand(const ZydisFormatter* formatter,
+ const ZydisDecodedInstruction* instruction, ZyanU8 index, char* buffer, ZyanUSize length,
+ ZyanU64 runtime_address);
+
+/**
+ * Formats the given operand and writes it into the output buffer.
+ *
+ * @param formatter A pointer to the `ZydisFormatter` instance.
+ * @param instruction A pointer to the `ZydisDecodedInstruction` struct.
+ * @param index The index of the operand to format.
+ * @param buffer A pointer to the output buffer.
+ * @param length The length of the output buffer (in characters).
+ * @param runtime_address The runtime address of the instruction or `ZYDIS_RUNTIME_ADDRESS_NONE`
+ * to print relative addresses.
+ * @param user_data A pointer to user-defined data which can be used in custom formatter
+ * callbacks.
+ *
+ * @return A zyan status code.
+ *
+ * Use `ZydisFormatterFormatInstruction` or `ZydisFormatterFormatInstructionEx` to format a
+ * complete instruction.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterFormatOperandEx(const ZydisFormatter* formatter,
+ const ZydisDecodedInstruction* instruction, ZyanU8 index, char* buffer, ZyanUSize length,
+ ZyanU64 runtime_address, void* user_data);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Tokenizing */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Tokenizes the given instruction and writes it into the output buffer.
+ *
+ * @param formatter A pointer to the `ZydisFormatter` instance.
+ * @param instruction A pointer to the `ZydisDecodedInstruction` struct.
+ * @param buffer A pointer to the output buffer.
+ * @param length The length of the output buffer (in bytes).
+ * @param runtime_address The runtime address of the instruction or `ZYDIS_RUNTIME_ADDRESS_NONE`
+ * to print relative addresses.
+ * @param token Receives a pointer to the first token in the output buffer.
+ *
+ * @return A zyan status code.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeInstruction(const ZydisFormatter* formatter,
+ const ZydisDecodedInstruction* instruction, void* buffer, ZyanUSize length,
+ ZyanU64 runtime_address, ZydisFormatterTokenConst** token);
+
+/**
+ * Tokenizes the given instruction and writes it into the output buffer.
+ *
+ * @param formatter A pointer to the `ZydisFormatter` instance.
+ * @param instruction A pointer to the `ZydisDecodedInstruction` struct.
+ * @param buffer A pointer to the output buffer.
+ * @param length The length of the output buffer (in bytes).
+ * @param runtime_address The runtime address of the instruction or `ZYDIS_RUNTIME_ADDRESS_NONE`
+ * to print relative addresses.
+ * @param token Receives a pointer to the first token in the output buffer.
+ * @param user_data A pointer to user-defined data which can be used in custom formatter
+ * callbacks.
+ *
+ * @return A zyan status code.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeInstructionEx(const ZydisFormatter* formatter,
+ const ZydisDecodedInstruction* instruction, void* buffer, ZyanUSize length,
+ ZyanU64 runtime_address, ZydisFormatterTokenConst** token, void* user_data);
+
+/**
+ * Tokenizes the given operand and writes it into the output buffer.
+ *
+ * @param formatter A pointer to the `ZydisFormatter` instance.
+ * @param instruction A pointer to the `ZydisDecodedInstruction` struct.
+ * @param index The index of the operand to format.
+ * @param buffer A pointer to the output buffer.
+ * @param length The length of the output buffer (in bytes).
+ * @param runtime_address The runtime address of the instruction or `ZYDIS_RUNTIME_ADDRESS_NONE`
+ * to print relative addresses.
+ * @param token Receives a pointer to the first token in the output buffer.
+ *
+ * @return A zyan status code.
+ *
+ * Use `ZydisFormatterTokenizeInstruction` or `ZydisFormatterTokenizeInstructionEx` to tokenize a
+ * complete instruction.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeOperand(const ZydisFormatter* formatter,
+ const ZydisDecodedInstruction* instruction, ZyanU8 index, void* buffer, ZyanUSize length,
+ ZyanU64 runtime_address, ZydisFormatterTokenConst** token);
+
+/**
+ * Tokenizes the given operand and writes it into the output buffer.
+ *
+ * @param formatter A pointer to the `ZydisFormatter` instance.
+ * @param instruction A pointer to the `ZydisDecodedInstruction` struct.
+ * @param index The index of the operand to format.
+ * @param buffer A pointer to the output buffer.
+ * @param length The length of the output buffer (in bytes).
+ * @param runtime_address The runtime address of the instruction or `ZYDIS_RUNTIME_ADDRESS_NONE`
+ * to print relative addresses.
+ * @param token Receives a pointer to the first token in the output buffer.
+ * @param user_data A pointer to user-defined data which can be used in custom formatter
+ * callbacks.
+ *
+ * @return A zyan status code.
+ *
+ * Use `ZydisFormatterTokenizeInstruction` or `ZydisFormatterTokenizeInstructionEx` to tokenize a
+ * complete instruction.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenizeOperandEx(const ZydisFormatter* formatter,
+ const ZydisDecodedInstruction* instruction, ZyanU8 index, void* buffer, ZyanUSize length,
+ ZyanU64 runtime_address, ZydisFormatterTokenConst** token, void* user_data);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * @}
+ */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYDIS_FORMATTER_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/FormatterBuffer.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/FormatterBuffer.h
new file mode 100644
index 0000000..2ae2efe
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/FormatterBuffer.h
@@ -0,0 +1,306 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Implements the `ZydisFormatterToken` type and provides functions to use it.
+ */
+
+#ifndef ZYDIS_FORMATTER_TOKEN_H
+#define ZYDIS_FORMATTER_TOKEN_H
+
+#include
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Constants */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Token types */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * @biref Defines the `ZydisTokenType` data-type.
+ */
+typedef ZyanU8 ZydisTokenType;
+
+#define ZYDIS_TOKEN_INVALID 0x00
+/**
+ * A whitespace character.
+ */
+#define ZYDIS_TOKEN_WHITESPACE 0x01
+/**
+ * A delimiter character (like `','`, `':'`, `'+'`, `'-'`, `'*'`).
+ */
+#define ZYDIS_TOKEN_DELIMITER 0x02
+/**
+ * An opening parenthesis character (like `'('`, `'['`, `'{'`).
+ */
+#define ZYDIS_TOKEN_PARENTHESIS_OPEN 0x03
+/**
+ * A closing parenthesis character (like `')'`, `']'`, `'}'`).
+ */
+#define ZYDIS_TOKEN_PARENTHESIS_CLOSE 0x04
+/**
+ * A prefix literal (like `"LOCK"`, `"REP"`).
+ */
+#define ZYDIS_TOKEN_PREFIX 0x05
+/**
+ * A mnemonic literal (like `"MOV"`, `"VCMPPSD"`, `"LCALL"`).
+ */
+#define ZYDIS_TOKEN_MNEMONIC 0x06
+/**
+ * A register literal (like `"RAX"`, `"DS"`, `"%ECX"`).
+ */
+#define ZYDIS_TOKEN_REGISTER 0x07
+/**
+ * An absolute address literal (like `0x00400000`).
+ */
+#define ZYDIS_TOKEN_ADDRESS_ABS 0x08
+/**
+ * A relative address literal (like `-0x100`).
+ */
+#define ZYDIS_TOKEN_ADDRESS_REL 0x09
+/**
+ * A displacement literal (like `0xFFFFFFFF`, `-0x100`, `+0x1234`).
+ */
+#define ZYDIS_TOKEN_DISPLACEMENT 0x0A
+/**
+ * An immediate literal (like `0xC0`, `-0x1234`, `$0x0000`).
+ */
+#define ZYDIS_TOKEN_IMMEDIATE 0x0B
+/**
+ * A typecast literal (like `DWORD PTR`).
+ */
+#define ZYDIS_TOKEN_TYPECAST 0x0C
+/**
+ * A decorator literal (like `"Z"`, `"1TO4"`).
+ */
+#define ZYDIS_TOKEN_DECORATOR 0x0D
+/**
+ * A symbol literal.
+ */
+#define ZYDIS_TOKEN_SYMBOL 0x0E
+
+/**
+ * The base for user-defined token types.
+ */
+#define ZYDIS_TOKEN_USER 0x80
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Token */
+/* ---------------------------------------------------------------------------------------------- */
+
+#pragma pack(push, 1)
+
+/**
+ * Defines the `ZydisFormatterToken` struct.
+ *
+ * All fields in this struct should be considered as "private". Any changes may lead to unexpected
+ * behavior.
+ */
+typedef struct ZydisFormatterToken_
+{
+ /**
+ * The token type.
+ */
+ ZydisTokenType type;
+ /**
+ * An offset to the next token, or `0`.
+ */
+ ZyanU8 next;
+} ZydisFormatterToken;
+
+#pragma pack(pop)
+
+/**
+ * Defines the `ZydisFormatterTokenConst` data-type.
+ */
+typedef const ZydisFormatterToken ZydisFormatterTokenConst;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Buffer */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisFormatterBuffer` struct.
+ *
+ * All fields in this struct should be considered as "private". Any changes may
+ * lead to unexpected behavior.
+ */
+typedef struct ZydisFormatterBuffer_
+{
+ /**
+ * `ZYAN_TRUE`, if the buffer contains a token stream or `ZYAN_FALSE, if it
+ * contains a simple string.
+ */
+ ZyanBool is_token_list;
+ /**
+ * The remaining capacity of the buffer.
+ */
+ ZyanUSize capacity;
+ /**
+ * The `ZyanString` instance that refers to the literal value of the most
+ * recently added token.
+ */
+ ZyanString string;
+} ZydisFormatterBuffer;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Token */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the `type` and the string `value` of the given `token`.
+ *
+ * @param token A pointer to the `ZydisFormatterToken` struct.
+ * @param type Receives the token type.
+ * @param value Receives a pointer to the string value of the token.
+ *
+ * @return A zyan status code.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenGetValue(const ZydisFormatterToken* token,
+ ZydisTokenType* type, ZyanConstCharPointer* value);
+
+/**
+ * Obtains the next `token` linked to the passed one.
+ *
+ * @param token Receives a pointer to the next `ZydisFormatterToken` struct
+ * linked to the passed one.
+ *
+ * @return A zyan status code.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterTokenNext(ZydisFormatterTokenConst** token);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Buffer */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the current (most recently added) token.
+ *
+ * @param buffer A pointer to the `ZydisFormatterBuffer` struct.
+ * @param token Receives a pointer to the current token.
+ *
+ * @return A zyan status code.
+ *
+ * This function returns `ZYAN_STATUS_INVALID_OPERATION`, if the buffer does not contain at least
+ * one token.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterBufferGetToken(const ZydisFormatterBuffer* buffer,
+ ZydisFormatterTokenConst** token);
+
+/**
+ * Returns the `ZyanString` instance associated with the given buffer.
+ *
+ * @param buffer A pointer to the `ZydisFormatterBuffer` struct.
+ * @param string Receives a pointer to the `ZyanString` instance associated with the given
+ * buffer.
+ *
+ * @return A zyan status code.
+ *
+ * This function returns `ZYAN_STATUS_INVALID_OPERATION`, if the buffer does not contain at least
+ * one token.
+ *
+ * The returned string always refers to the literal value of the current (most recently added)
+ * token and will remain valid until the buffer is destroyed.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterBufferGetString(ZydisFormatterBuffer* buffer,
+ ZyanString** string);
+
+/**
+ * Appends a new token to the `buffer`.
+ *
+ * @param buffer A pointer to the `ZydisFormatterBuffer` struct.
+ * @param type The type of the new token.
+ *
+ * @return A zyan status code.
+ *
+ * Note that the `ZyanString` instance returned by `ZydisFormatterBufferGetString` will
+ * automatically be updated by calling this function.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterBufferAppend(ZydisFormatterBuffer* buffer,
+ ZydisTokenType type);
+
+/**
+ * Returns a snapshot of the buffer-state.
+ *
+ * @param buffer A pointer to the `ZydisFormatterBuffer` struct.
+ * @param state Receives a snapshot of the buffer-state.
+ *
+ * @return A zyan status code.
+ *
+ * Note that the buffer-state is saved inside the buffer itself and thus becomes invalid as soon
+ * as the buffer gets overwritten or destroyed.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterBufferRemember(const ZydisFormatterBuffer* buffer,
+ ZyanUPointer* state);
+
+/**
+ * Restores a previously saved buffer-state.
+ *
+ * @param buffer A pointer to the `ZydisFormatterBuffer` struct.
+ * @param state The buffer-state to restore.
+ *
+ * @return A zyan status code.
+ *
+ * All tokens added after obtaining the given `state` snapshot will be removed. This function
+ * does NOT restore any string content.
+ *
+ * Note that the `ZyanString` instance returned by `ZydisFormatterBufferGetString` will
+ * automatically be updated by calling this function.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisFormatterBufferRestore(ZydisFormatterBuffer* buffer,
+ ZyanUPointer state);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYDIS_FORMATTER_TOKEN_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Generated/EnumISAExt.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Generated/EnumISAExt.h
new file mode 100644
index 0000000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DIS_ISA_EXT_XSAVE,
+ ZYDIS_ISA_EXT_XSAVEC,
+ ZYDIS_ISA_EXT_XSAVEOPT,
+ ZYDIS_ISA_EXT_XSAVES,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_ISA_EXT_MAX_VALUE = ZYDIS_ISA_EXT_XSAVES,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_ISA_EXT_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_ISA_EXT_MAX_VALUE)
+} ZydisISAExt;
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Generated/EnumISASet.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Generated/EnumISASet.h
new file mode 100644
index 0000000..c04242c
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Generated/EnumISASet.h
@@ -0,0 +1,184 @@
+/**
+ * Defines the `ZydisISASet` enum.
+ */
+typedef enum ZydisISASet_
+{
+ ZYDIS_ISA_SET_INVALID,
+ ZYDIS_ISA_SET_ADOX_ADCX,
+ ZYDIS_ISA_SET_AES,
+ ZYDIS_ISA_SET_AMD,
+ ZYDIS_ISA_SET_AMD3DNOW,
+ ZYDIS_ISA_SET_AMX_BF16,
+ ZYDIS_ISA_SET_AMX_INT8,
+ ZYDIS_ISA_SET_AMX_TILE,
+ ZYDIS_ISA_SET_AVX,
+ ZYDIS_ISA_SET_AVX2,
+ ZYDIS_ISA_SET_AVX2GATHER,
+ ZYDIS_ISA_SET_AVX512BW_128,
+ ZYDIS_ISA_SET_AVX512BW_128N,
+ ZYDIS_ISA_SET_AVX512BW_256,
+ ZYDIS_ISA_SET_AVX512BW_512,
+ ZYDIS_ISA_SET_AVX512BW_KOP,
+ ZYDIS_ISA_SET_AVX512CD_128,
+ ZYDIS_ISA_SET_AVX512CD_256,
+ ZYDIS_ISA_SET_AVX512CD_512,
+ ZYDIS_ISA_SET_AVX512DQ_128,
+ ZYDIS_ISA_SET_AVX512DQ_128N,
+ ZYDIS_ISA_SET_AVX512DQ_256,
+ ZYDIS_ISA_SET_AVX512DQ_512,
+ ZYDIS_ISA_SET_AVX512DQ_KOP,
+ ZYDIS_ISA_SET_AVX512DQ_SCALAR,
+ ZYDIS_ISA_SET_AVX512ER_512,
+ ZYDIS_ISA_SET_AVX512ER_SCALAR,
+ ZYDIS_ISA_SET_AVX512F_128,
+ ZYDIS_ISA_SET_AVX512F_128N,
+ ZYDIS_ISA_SET_AVX512F_256,
+ ZYDIS_ISA_SET_AVX512F_512,
+ ZYDIS_ISA_SET_AVX512F_KOP,
+ ZYDIS_ISA_SET_AVX512F_SCALAR,
+ ZYDIS_ISA_SET_AVX512PF_512,
+ ZYDIS_ISA_SET_AVX512_4FMAPS_512,
+ ZYDIS_ISA_SET_AVX512_4FMAPS_SCALAR,
+ ZYDIS_ISA_SET_AVX512_4VNNIW_512,
+ ZYDIS_ISA_SET_AVX512_BF16_128,
+ ZYDIS_ISA_SET_AVX512_BF16_256,
+ ZYDIS_ISA_SET_AVX512_BF16_512,
+ ZYDIS_ISA_SET_AVX512_BITALG_128,
+ ZYDIS_ISA_SET_AVX512_BITALG_256,
+ ZYDIS_ISA_SET_AVX512_BITALG_512,
+ ZYDIS_ISA_SET_AVX512_GFNI_128,
+ ZYDIS_ISA_SET_AVX512_GFNI_256,
+ ZYDIS_ISA_SET_AVX512_GFNI_512,
+ ZYDIS_ISA_SET_AVX512_IFMA_128,
+ ZYDIS_ISA_SET_AVX512_IFMA_256,
+ ZYDIS_ISA_SET_AVX512_IFMA_512,
+ ZYDIS_ISA_SET_AVX512_VAES_128,
+ ZYDIS_ISA_SET_AVX512_VAES_256,
+ ZYDIS_ISA_SET_AVX512_VAES_512,
+ ZYDIS_ISA_SET_AVX512_VBMI2_128,
+ ZYDIS_ISA_SET_AVX512_VBMI2_256,
+ ZYDIS_ISA_SET_AVX512_VBMI2_512,
+ ZYDIS_ISA_SET_AVX512_VBMI_128,
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ZYDIS_ISA_SET_SERIALIZE,
+ ZYDIS_ISA_SET_SGX,
+ ZYDIS_ISA_SET_SGX_ENCLV,
+ ZYDIS_ISA_SET_SHA,
+ ZYDIS_ISA_SET_SMAP,
+ ZYDIS_ISA_SET_SMX,
+ ZYDIS_ISA_SET_SSE,
+ ZYDIS_ISA_SET_SSE2,
+ ZYDIS_ISA_SET_SSE2MMX,
+ ZYDIS_ISA_SET_SSE3,
+ ZYDIS_ISA_SET_SSE3X87,
+ ZYDIS_ISA_SET_SSE4,
+ ZYDIS_ISA_SET_SSE42,
+ ZYDIS_ISA_SET_SSE4A,
+ ZYDIS_ISA_SET_SSEMXCSR,
+ ZYDIS_ISA_SET_SSE_PREFETCH,
+ ZYDIS_ISA_SET_SSSE3,
+ ZYDIS_ISA_SET_SSSE3MMX,
+ ZYDIS_ISA_SET_SVM,
+ ZYDIS_ISA_SET_TBM,
+ ZYDIS_ISA_SET_TSX_LDTRK,
+ ZYDIS_ISA_SET_VAES,
+ ZYDIS_ISA_SET_VMFUNC,
+ ZYDIS_ISA_SET_VPCLMULQDQ,
+ ZYDIS_ISA_SET_VTX,
+ ZYDIS_ISA_SET_WAITPKG,
+ ZYDIS_ISA_SET_X87,
+ ZYDIS_ISA_SET_XOP,
+ ZYDIS_ISA_SET_XSAVE,
+ ZYDIS_ISA_SET_XSAVEC,
+ ZYDIS_ISA_SET_XSAVEOPT,
+ ZYDIS_ISA_SET_XSAVES,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_ISA_SET_MAX_VALUE = ZYDIS_ISA_SET_XSAVES,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_ISA_SET_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_ISA_SET_MAX_VALUE)
+} ZydisISASet;
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Generated/EnumInstructionCategory.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Generated/EnumInstructionCategory.h
new file mode 100644
index 0000000..755afbc
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Generated/EnumInstructionCategory.h
@@ -0,0 +1,117 @@
+/**
+ * Defines the `ZydisInstructionCategory` enum.
+ */
+typedef enum ZydisInstructionCategory_
+{
+ ZYDIS_CATEGORY_INVALID,
+ ZYDIS_CATEGORY_ADOX_ADCX,
+ ZYDIS_CATEGORY_AES,
+ ZYDIS_CATEGORY_AMD3DNOW,
+ ZYDIS_CATEGORY_AMX_TILE,
+ ZYDIS_CATEGORY_AVX,
+ ZYDIS_CATEGORY_AVX2,
+ ZYDIS_CATEGORY_AVX2GATHER,
+ ZYDIS_CATEGORY_AVX512,
+ ZYDIS_CATEGORY_AVX512_4FMAPS,
+ ZYDIS_CATEGORY_AVX512_4VNNIW,
+ ZYDIS_CATEGORY_AVX512_BITALG,
+ ZYDIS_CATEGORY_AVX512_VBMI,
+ ZYDIS_CATEGORY_AVX512_VP2INTERSECT,
+ ZYDIS_CATEGORY_BINARY,
+ ZYDIS_CATEGORY_BITBYTE,
+ ZYDIS_CATEGORY_BLEND,
+ ZYDIS_CATEGORY_BMI1,
+ ZYDIS_CATEGORY_BMI2,
+ ZYDIS_CATEGORY_BROADCAST,
+ ZYDIS_CATEGORY_CALL,
+ ZYDIS_CATEGORY_CET,
+ ZYDIS_CATEGORY_CLDEMOTE,
+ ZYDIS_CATEGORY_CLFLUSHOPT,
+ ZYDIS_CATEGORY_CLWB,
+ ZYDIS_CATEGORY_CLZERO,
+ ZYDIS_CATEGORY_CMOV,
+ ZYDIS_CATEGORY_COMPRESS,
+ ZYDIS_CATEGORY_COND_BR,
+ ZYDIS_CATEGORY_CONFLICT,
+ ZYDIS_CATEGORY_CONVERT,
+ ZYDIS_CATEGORY_DATAXFER,
+ ZYDIS_CATEGORY_DECIMAL,
+ ZYDIS_CATEGORY_ENQCMD,
+ ZYDIS_CATEGORY_EXPAND,
+ ZYDIS_CATEGORY_FCMO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CATEGORY_SMAP,
+ ZYDIS_CATEGORY_SSE,
+ ZYDIS_CATEGORY_STRINGOP,
+ ZYDIS_CATEGORY_STTNI,
+ ZYDIS_CATEGORY_SYSCALL,
+ ZYDIS_CATEGORY_SYSRET,
+ ZYDIS_CATEGORY_SYSTEM,
+ ZYDIS_CATEGORY_TBM,
+ ZYDIS_CATEGORY_TSX_LDTRK,
+ ZYDIS_CATEGORY_UFMA,
+ ZYDIS_CATEGORY_UNCOND_BR,
+ ZYDIS_CATEGORY_VAES,
+ ZYDIS_CATEGORY_VBMI2,
+ ZYDIS_CATEGORY_VFMA,
+ ZYDIS_CATEGORY_VPCLMULQDQ,
+ ZYDIS_CATEGORY_VTX,
+ ZYDIS_CATEGORY_WAITPKG,
+ ZYDIS_CATEGORY_WIDENOP,
+ ZYDIS_CATEGORY_X87_ALU,
+ ZYDIS_CATEGORY_XOP,
+ ZYDIS_CATEGORY_XSAVE,
+ ZYDIS_CATEGORY_XSAVEOPT,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_CATEGORY_MAX_VALUE = ZYDIS_CATEGORY_XSAVEOPT,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_CATEGORY_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_CATEGORY_MAX_VALUE)
+} ZydisInstructionCategory;
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Generated/EnumMnemonic.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Generated/EnumMnemonic.h
new file mode 100644
index 0000000..899efb8
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Generated/EnumMnemonic.h
@@ -0,0 +1,1643 @@
+/**
+ * Defines the `ZydisMnemonic` enum.
+ */
+typedef enum ZydisMnemonic_
+{
+ ZYDIS_MNEMONIC_INVALID,
+ ZYDIS_MNEMONIC_AAA,
+ ZYDIS_MNEMONIC_AAD,
+ ZYDIS_MN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ONIC_MAX_VALUE = ZYDIS_MNEMONIC_XTEST,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_MNEMONIC_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_MNEMONIC_MAX_VALUE)
+} ZydisMnemonic;
\ No newline at end of file
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Generated/EnumRegister.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Generated/EnumRegister.h
new file mode 100644
index 0000000..3135fe0
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Generated/EnumRegister.h
@@ -0,0 +1,301 @@
+/**
+ * Defines the `ZydisRegister` enum.
+ */
+typedef enum ZydisRegister_
+{
+ ZYDIS_REGISTER_NONE,
+
+ // General purpose registers 8-bit
+ ZYDIS_REGISTER_AL,
+ ZYDIS_REGISTER_CL,
+ ZYDIS_REGISTER_DL,
+ ZYDIS_REGISTER_BL,
+ ZYDIS_REGISTER_AH,
+ ZYDIS_REGISTER_CH,
+ ZYDIS_REGISTER_DH,
+ ZYDIS_REGISTER_BH,
+ ZYDIS_REGISTER_SPL,
+ ZYDIS_REGISTER_BPL,
+ ZYDIS_REGISTER_SIL,
+ ZYDIS_REGISTER_DIL,
+ ZYDIS_REGISTER_R8B,
+ ZYDIS_REGISTER_R9B,
+ ZYDIS_REGISTER_R10B,
+ ZYDIS_REGISTER_R11B,
+ ZYDIS_REGISTER_R12B,
+ ZYDIS_REGISTER_R13B,
+ ZYDIS_REGISTER_R14B,
+ ZYDIS_REGISTER_R15B,
+ // General purpose registers 16-bit
+ ZYDIS_REGISTER_AX,
+ ZYDIS_REGISTER_CX,
+ ZYDIS_REGISTER_DX,
+ ZYDIS_REGISTER_BX,
+ ZYDIS_REGISTER_SP,
+ ZYDIS_REGISTER_BP,
+ ZYDIS_REGISTER_SI,
+ ZYDIS_REGISTER_DI,
+ ZYDIS_REGISTER_R8W,
+ ZYDIS_REGISTER_R9W,
+ ZYDIS_REGISTER_R10W,
+ ZYDIS_REGISTER_R11W,
+ ZYDIS_REGISTER_R12W,
+ ZYDIS_REGISTER_R13W,
+ ZYDIS_REGISTER_R14W,
+ ZYDIS_REGISTER_R15W,
+ // General purpose registers 32-bit
+ ZYDIS_REGISTER_EAX,
+ ZYDIS_REGISTER_ECX,
+ ZYDIS_REGISTER_EDX,
+ ZYDIS_REGISTER_EBX,
+ ZYDIS_REGISTER_ESP,
+ ZYDIS_REGISTER_EBP,
+ ZYDIS_REGISTER_ESI,
+ ZYDIS_REGISTER_EDI,
+ ZYDIS_REGISTER_R8D,
+ ZYDIS_REGISTER_R9D,
+ ZYDIS_REGISTER_R10D,
+ ZYDIS_REGISTER_R11D,
+ ZYDIS_REGISTER_R12D,
+ ZYDIS_REGISTER_R13D,
+ ZYDIS_REGISTER_R14D,
+ ZYDIS_REGISTER_R15D,
+ // General purpose registers 64-bit
+ ZYDIS_REGISTER_RAX,
+ ZYDIS_REGISTER_RCX,
+ ZYDIS_REGISTER_RDX,
+ ZYDIS_REGISTER_RBX,
+ ZYDIS_REGISTER_RSP,
+ ZYDIS_REGISTER_RBP,
+ ZYDIS_REGISTER_RSI,
+ ZYDIS_REGISTER_RDI,
+ ZYDIS_REGISTER_R8,
+ ZYDIS_REGISTER_R9,
+ ZYDIS_REGISTER_R10,
+ ZYDIS_REGISTER_R11,
+ ZYDIS_REGISTER_R12,
+ ZYDIS_REGISTER_R13,
+ ZYDIS_REGISTER_R14,
+ ZYDIS_REGISTER_R15,
+ // Floating point legacy registers
+ ZYDIS_REGISTER_ST0,
+ ZYDIS_REGISTER_ST1,
+ ZYDIS_REGISTER_ST2,
+ ZYDIS_REGISTER_ST3,
+ ZYDIS_REGISTER_ST4,
+ ZYDIS_REGISTER_ST5,
+ ZYDIS_REGISTER_ST6,
+ ZYDIS_REGISTER_ST7,
+ ZYDIS_REGISTER_X87CONTROL,
+ ZYDIS_REGISTER_X87STATUS,
+ ZYDIS_REGISTER_X87TAG,
+ // Floating point multimedia registers
+ ZYDIS_REGISTER_MM0,
+ ZYDIS_REGISTER_MM1,
+ ZYDIS_REGISTER_MM2,
+ ZYDIS_REGISTER_MM3,
+ ZYDIS_REGISTER_MM4,
+ ZYDIS_REGISTER_MM5,
+ ZYDIS_REGISTER_MM6,
+ ZYDIS_REGISTER_MM7,
+ // Floating point vector registers 128-bit
+ ZYDIS_REGISTER_XMM0,
+ ZYDIS_REGISTER_XMM1,
+ ZYDIS_REGISTER_XMM2,
+ ZYDIS_REGISTER_XMM3,
+ ZYDIS_REGISTER_XMM4,
+ ZYDIS_REGISTER_XMM5,
+ ZYDIS_REGISTER_XMM6,
+ ZYDIS_REGISTER_XMM7,
+ ZYDIS_REGISTER_XMM8,
+ ZYDIS_REGISTER_XMM9,
+ ZYDIS_REGISTER_XMM10,
+ ZYDIS_REGISTER_XMM11,
+ ZYDIS_REGISTER_XMM12,
+ ZYDIS_REGISTER_XMM13,
+ ZYDIS_REGISTER_XMM14,
+ ZYDIS_REGISTER_XMM15,
+ ZYDIS_REGISTER_XMM16,
+ ZYDIS_REGISTER_XMM17,
+ ZYDIS_REGISTER_XMM18,
+ ZYDIS_REGISTER_XMM19,
+ ZYDIS_REGISTER_XMM20,
+ ZYDIS_REGISTER_XMM21,
+ ZYDIS_REGISTER_XMM22,
+ ZYDIS_REGISTER_XMM23,
+ ZYDIS_REGISTER_XMM24,
+ ZYDIS_REGISTER_XMM25,
+ ZYDIS_REGISTER_XMM26,
+ ZYDIS_REGISTER_XMM27,
+ ZYDIS_REGISTER_XMM28,
+ ZYDIS_REGISTER_XMM29,
+ ZYDIS_REGISTER_XMM30,
+ ZYDIS_REGISTER_XMM31,
+ // Floating point vector registers 256-bit
+ ZYDIS_REGISTER_YMM0,
+ ZYDIS_REGISTER_YMM1,
+ ZYDIS_REGISTER_YMM2,
+ ZYDIS_REGISTER_YMM3,
+ ZYDIS_REGISTER_YMM4,
+ ZYDIS_REGISTER_YMM5,
+ ZYDIS_REGISTER_YMM6,
+ ZYDIS_REGISTER_YMM7,
+ ZYDIS_REGISTER_YMM8,
+ ZYDIS_REGISTER_YMM9,
+ ZYDIS_REGISTER_YMM10,
+ ZYDIS_REGISTER_YMM11,
+ ZYDIS_REGISTER_YMM12,
+ ZYDIS_REGISTER_YMM13,
+ ZYDIS_REGISTER_YMM14,
+ ZYDIS_REGISTER_YMM15,
+ ZYDIS_REGISTER_YMM16,
+ ZYDIS_REGISTER_YMM17,
+ ZYDIS_REGISTER_YMM18,
+ ZYDIS_REGISTER_YMM19,
+ ZYDIS_REGISTER_YMM20,
+ ZYDIS_REGISTER_YMM21,
+ ZYDIS_REGISTER_YMM22,
+ ZYDIS_REGISTER_YMM23,
+ ZYDIS_REGISTER_YMM24,
+ ZYDIS_REGISTER_YMM25,
+ ZYDIS_REGISTER_YMM26,
+ ZYDIS_REGISTER_YMM27,
+ ZYDIS_REGISTER_YMM28,
+ ZYDIS_REGISTER_YMM29,
+ ZYDIS_REGISTER_YMM30,
+ ZYDIS_REGISTER_YMM31,
+ // Floating point vector registers 512-bit
+ ZYDIS_REGISTER_ZMM0,
+ ZYDIS_REGISTER_ZMM1,
+ ZYDIS_REGISTER_ZMM2,
+ ZYDIS_REGISTER_ZMM3,
+ ZYDIS_REGISTER_ZMM4,
+ ZYDIS_REGISTER_ZMM5,
+ ZYDIS_REGISTER_ZMM6,
+ ZYDIS_REGISTER_ZMM7,
+ ZYDIS_REGISTER_ZMM8,
+ ZYDIS_REGISTER_ZMM9,
+ ZYDIS_REGISTER_ZMM10,
+ ZYDIS_REGISTER_ZMM11,
+ ZYDIS_REGISTER_ZMM12,
+ ZYDIS_REGISTER_ZMM13,
+ ZYDIS_REGISTER_ZMM14,
+ ZYDIS_REGISTER_ZMM15,
+ ZYDIS_REGISTER_ZMM16,
+ ZYDIS_REGISTER_ZMM17,
+ ZYDIS_REGISTER_ZMM18,
+ ZYDIS_REGISTER_ZMM19,
+ ZYDIS_REGISTER_ZMM20,
+ ZYDIS_REGISTER_ZMM21,
+ ZYDIS_REGISTER_ZMM22,
+ ZYDIS_REGISTER_ZMM23,
+ ZYDIS_REGISTER_ZMM24,
+ ZYDIS_REGISTER_ZMM25,
+ ZYDIS_REGISTER_ZMM26,
+ ZYDIS_REGISTER_ZMM27,
+ ZYDIS_REGISTER_ZMM28,
+ ZYDIS_REGISTER_ZMM29,
+ ZYDIS_REGISTER_ZMM30,
+ ZYDIS_REGISTER_ZMM31,
+ // Matrix registers
+ ZYDIS_REGISTER_TMM0,
+ ZYDIS_REGISTER_TMM1,
+ ZYDIS_REGISTER_TMM2,
+ ZYDIS_REGISTER_TMM3,
+ ZYDIS_REGISTER_TMM4,
+ ZYDIS_REGISTER_TMM5,
+ ZYDIS_REGISTER_TMM6,
+ ZYDIS_REGISTER_TMM7,
+ // Flags registers
+ ZYDIS_REGISTER_FLAGS,
+ ZYDIS_REGISTER_EFLAGS,
+ ZYDIS_REGISTER_RFLAGS,
+ // Instruction-pointer registers
+ ZYDIS_REGISTER_IP,
+ ZYDIS_REGISTER_EIP,
+ ZYDIS_REGISTER_RIP,
+ // Segment registers
+ ZYDIS_REGISTER_ES,
+ ZYDIS_REGISTER_CS,
+ ZYDIS_REGISTER_SS,
+ ZYDIS_REGISTER_DS,
+ ZYDIS_REGISTER_FS,
+ ZYDIS_REGISTER_GS,
+ // Table registers
+ ZYDIS_REGISTER_GDTR,
+ ZYDIS_REGISTER_LDTR,
+ ZYDIS_REGISTER_IDTR,
+ ZYDIS_REGISTER_TR,
+ // Test registers
+ ZYDIS_REGISTER_TR0,
+ ZYDIS_REGISTER_TR1,
+ ZYDIS_REGISTER_TR2,
+ ZYDIS_REGISTER_TR3,
+ ZYDIS_REGISTER_TR4,
+ ZYDIS_REGISTER_TR5,
+ ZYDIS_REGISTER_TR6,
+ ZYDIS_REGISTER_TR7,
+ // Control registers
+ ZYDIS_REGISTER_CR0,
+ ZYDIS_REGISTER_CR1,
+ ZYDIS_REGISTER_CR2,
+ ZYDIS_REGISTER_CR3,
+ ZYDIS_REGISTER_CR4,
+ ZYDIS_REGISTER_CR5,
+ ZYDIS_REGISTER_CR6,
+ ZYDIS_REGISTER_CR7,
+ ZYDIS_REGISTER_CR8,
+ ZYDIS_REGISTER_CR9,
+ ZYDIS_REGISTER_CR10,
+ ZYDIS_REGISTER_CR11,
+ ZYDIS_REGISTER_CR12,
+ ZYDIS_REGISTER_CR13,
+ ZYDIS_REGISTER_CR14,
+ ZYDIS_REGISTER_CR15,
+ // Debug registers
+ ZYDIS_REGISTER_DR0,
+ ZYDIS_REGISTER_DR1,
+ ZYDIS_REGISTER_DR2,
+ ZYDIS_REGISTER_DR3,
+ ZYDIS_REGISTER_DR4,
+ ZYDIS_REGISTER_DR5,
+ ZYDIS_REGISTER_DR6,
+ ZYDIS_REGISTER_DR7,
+ ZYDIS_REGISTER_DR8,
+ ZYDIS_REGISTER_DR9,
+ ZYDIS_REGISTER_DR10,
+ ZYDIS_REGISTER_DR11,
+ ZYDIS_REGISTER_DR12,
+ ZYDIS_REGISTER_DR13,
+ ZYDIS_REGISTER_DR14,
+ ZYDIS_REGISTER_DR15,
+ // Mask registers
+ ZYDIS_REGISTER_K0,
+ ZYDIS_REGISTER_K1,
+ ZYDIS_REGISTER_K2,
+ ZYDIS_REGISTER_K3,
+ ZYDIS_REGISTER_K4,
+ ZYDIS_REGISTER_K5,
+ ZYDIS_REGISTER_K6,
+ ZYDIS_REGISTER_K7,
+ // Bound registers
+ ZYDIS_REGISTER_BND0,
+ ZYDIS_REGISTER_BND1,
+ ZYDIS_REGISTER_BND2,
+ ZYDIS_REGISTER_BND3,
+ ZYDIS_REGISTER_BNDCFG,
+ ZYDIS_REGISTER_BNDSTATUS,
+ // Uncategorized
+ ZYDIS_REGISTER_MXCSR,
+ ZYDIS_REGISTER_PKRU,
+ ZYDIS_REGISTER_XCR0,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_REGISTER_MAX_VALUE = ZYDIS_REGISTER_XCR0,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_REGISTER_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_REGISTER_MAX_VALUE)
+} ZydisRegister;
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/DecoderData.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/DecoderData.h
new file mode 100644
index 0000000..db6cf53
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/DecoderData.h
@@ -0,0 +1,331 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+#ifndef ZYDIS_INTERNAL_DECODERDATA_H
+#define ZYDIS_INTERNAL_DECODERDATA_H
+
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+// MSVC does not like types other than (un-)signed int for bit-fields
+#ifdef ZYAN_MSVC
+# pragma warning(push)
+# pragma warning(disable:4214)
+#endif
+
+#pragma pack(push, 1)
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Decoder tree */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisDecoderTreeNodeType` data-type.
+ */
+typedef ZyanU8 ZydisDecoderTreeNodeType;
+
+/**
+ * Values that represent zydis decoder tree node types.
+ */
+enum ZydisDecoderTreeNodeTypes
+{
+ ZYDIS_NODETYPE_INVALID = 0x00,
+ /**
+ * Reference to an instruction-definition.
+ */
+ ZYDIS_NODETYPE_DEFINITION_MASK = 0x80,
+ /**
+ * Reference to an XOP-map filter.
+ */
+ ZYDIS_NODETYPE_FILTER_XOP = 0x01,
+ /**
+ * Reference to an VEX-map filter.
+ */
+ ZYDIS_NODETYPE_FILTER_VEX = 0x02,
+ /**
+ * Reference to an EVEX/MVEX-map filter.
+ */
+ ZYDIS_NODETYPE_FILTER_EMVEX = 0x03,
+ /**
+ * Reference to an opcode filter.
+ */
+ ZYDIS_NODETYPE_FILTER_OPCODE = 0x04,
+ /**
+ * Reference to an instruction-mode filter.
+ */
+ ZYDIS_NODETYPE_FILTER_MODE = 0x05,
+ /**
+ * Reference to an compacted instruction-mode filter.
+ */
+ ZYDIS_NODETYPE_FILTER_MODE_COMPACT = 0x06,
+ /**
+ * Reference to a ModRM.mod filter.
+ */
+ ZYDIS_NODETYPE_FILTER_MODRM_MOD = 0x07,
+ /**
+ * Reference to a compacted ModRM.mod filter.
+ */
+ ZYDIS_NODETYPE_FILTER_MODRM_MOD_COMPACT = 0x08,
+ /**
+ * Reference to a ModRM.reg filter.
+ */
+ ZYDIS_NODETYPE_FILTER_MODRM_REG = 0x09,
+ /**
+ * Reference to a ModRM.rm filter.
+ */
+ ZYDIS_NODETYPE_FILTER_MODRM_RM = 0x0A,
+ /**
+ * Reference to a PrefixGroup1 filter.
+ */
+ ZYDIS_NODETYPE_FILTER_PREFIX_GROUP1 = 0x0B,
+ /**
+ * Reference to a mandatory-prefix filter.
+ */
+ ZYDIS_NODETYPE_FILTER_MANDATORY_PREFIX = 0x0C,
+ /**
+ * Reference to an operand-size filter.
+ */
+ ZYDIS_NODETYPE_FILTER_OPERAND_SIZE = 0x0D,
+ /**
+ * Reference to an address-size filter.
+ */
+ ZYDIS_NODETYPE_FILTER_ADDRESS_SIZE = 0x0E,
+ /**
+ * Reference to a vector-length filter.
+ */
+ ZYDIS_NODETYPE_FILTER_VECTOR_LENGTH = 0x0F,
+ /**
+ * Reference to an REX/VEX/EVEX.W filter.
+ */
+ ZYDIS_NODETYPE_FILTER_REX_W = 0x10,
+ /**
+ * Reference to an REX/VEX/EVEX.B filter.
+ */
+ ZYDIS_NODETYPE_FILTER_REX_B = 0x11,
+ /**
+ * Reference to an EVEX.b filter.
+ */
+ ZYDIS_NODETYPE_FILTER_EVEX_B = 0x12,
+ /**
+ * Reference to an MVEX.E filter.
+ */
+ ZYDIS_NODETYPE_FILTER_MVEX_E = 0x13,
+ /**
+ * Reference to a AMD-mode filter.
+ */
+ ZYDIS_NODETYPE_FILTER_MODE_AMD = 0x14,
+ /**
+ * Reference to a KNC-mode filter.
+ */
+ ZYDIS_NODETYPE_FILTER_MODE_KNC = 0x15,
+ /**
+ * Reference to a MPX-mode filter.
+ */
+ ZYDIS_NODETYPE_FILTER_MODE_MPX = 0x16,
+ /**
+ * Reference to a CET-mode filter.
+ */
+ ZYDIS_NODETYPE_FILTER_MODE_CET = 0x17,
+ /**
+ * Reference to a LZCNT-mode filter.
+ */
+ ZYDIS_NODETYPE_FILTER_MODE_LZCNT = 0x18,
+ /**
+ * Reference to a TZCNT-mode filter.
+ */
+ ZYDIS_NODETYPE_FILTER_MODE_TZCNT = 0x19,
+ /**
+ * Reference to a WBNOINVD-mode filter.
+ */
+ ZYDIS_NODETYPE_FILTER_MODE_WBNOINVD = 0x1A,
+ /**
+ * Reference to a CLDEMOTE-mode filter.
+ */
+ ZYDIS_NODETYPE_FILTER_MODE_CLDEMOTE = 0x1B
+};
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisDecoderTreeNodeValue` data-type.
+ */
+typedef ZyanU16 ZydisDecoderTreeNodeValue;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisDecoderTreeNode` struct.
+ */
+typedef struct ZydisDecoderTreeNode_
+{
+ ZydisDecoderTreeNodeType type;
+ ZydisDecoderTreeNodeValue value;
+} ZydisDecoderTreeNode;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+#pragma pack(pop)
+
+#ifdef ZYAN_MSVC
+# pragma warning(pop)
+#endif
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Physical instruction encoding info */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisInstructionEncodingFlags` data-type.
+ */
+typedef ZyanU8 ZydisInstructionEncodingFlags;
+
+/**
+ * The instruction has an optional modrm byte.
+ */
+#define ZYDIS_INSTR_ENC_FLAG_HAS_MODRM 0x01
+
+/**
+ * The instruction has an optional displacement value.
+ */
+#define ZYDIS_INSTR_ENC_FLAG_HAS_DISP 0x02
+
+/**
+ * The instruction has an optional immediate value.
+ */
+#define ZYDIS_INSTR_ENC_FLAG_HAS_IMM0 0x04
+
+/**
+ * The instruction has a second optional immediate value.
+ */
+#define ZYDIS_INSTR_ENC_FLAG_HAS_IMM1 0x08
+
+/**
+ * The instruction ignores the value of `modrm.mod` and always assumes `modrm.mod == 3`
+ * ("reg, reg" - form).
+ *
+ * Instructions with this flag can't have a SIB byte or a displacement value.
+ */
+#define ZYDIS_INSTR_ENC_FLAG_FORCE_REG_FORM 0x10
+
+/**
+ * Defines the `ZydisInstructionEncodingInfo` struct.
+ */
+typedef struct ZydisInstructionEncodingInfo_
+{
+ /**
+ * Contains flags with information about the physical instruction-encoding.
+ */
+ ZydisInstructionEncodingFlags flags;
+ /**
+ * Displacement info.
+ */
+ struct
+ {
+ /**
+ * The size of the displacement value.
+ */
+ ZyanU8 size[3];
+ } disp;
+ /**
+ * Immediate info.
+ */
+ struct
+ {
+ /**
+ * The size of the immediate value.
+ */
+ ZyanU8 size[3];
+ /**
+ * Signals, if the value is signed.
+ */
+ ZyanBool is_signed;
+ /**
+ * Signals, if the value is a relative offset.
+ */
+ ZyanBool is_relative;
+ } imm[2];
+} ZydisInstructionEncodingInfo;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Decoder tree */
+/* ---------------------------------------------------------------------------------------------- */
+
+extern const ZydisDecoderTreeNode zydis_decoder_tree_root;
+
+/**
+ * Returns the root node of the instruction tree.
+ *
+ * @return The root node of the instruction tree.
+ */
+ZYAN_INLINE const ZydisDecoderTreeNode* ZydisDecoderTreeGetRootNode(void)
+{
+ return &zydis_decoder_tree_root;
+}
+
+/**
+ * Returns the child node of `parent` specified by `index`.
+ *
+ * @param parent The parent node.
+ * @param index The index of the child node to retrieve.
+ *
+ * @return The specified child node.
+ */
+ZYDIS_NO_EXPORT const ZydisDecoderTreeNode* ZydisDecoderTreeGetChildNode(
+ const ZydisDecoderTreeNode* parent, ZyanU16 index);
+
+/**
+ * Returns information about optional instruction parts (like modrm, displacement or
+ * immediates) for the instruction that is linked to the given `node`.
+ *
+ * @param node The instruction definition node.
+ * @param info A pointer to the `ZydisInstructionParts` struct.
+ */
+ZYDIS_NO_EXPORT void ZydisGetInstructionEncodingInfo(const ZydisDecoderTreeNode* node,
+ const ZydisInstructionEncodingInfo** info);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYDIS_INTERNAL_DECODERDATA_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/FormatterATT.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/FormatterATT.h
new file mode 100644
index 0000000..08b7134
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/FormatterATT.h
@@ -0,0 +1,178 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd, Joel Hoener
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Implements the `AT&T` style instruction-formatter.
+ */
+
+#ifndef ZYDIS_FORMATTER_ATT_H
+#define ZYDIS_FORMATTER_ATT_H
+
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Formatter functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Instruction */
+/* ---------------------------------------------------------------------------------------------- */
+
+ZyanStatus ZydisFormatterATTFormatInstruction(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Operands */
+/* ---------------------------------------------------------------------------------------------- */
+
+ZyanStatus ZydisFormatterATTFormatOperandMEM(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Elemental tokens */
+/* ---------------------------------------------------------------------------------------------- */
+
+ZyanStatus ZydisFormatterATTPrintMnemonic(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+ZyanStatus ZydisFormatterATTPrintRegister(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context, ZydisRegister reg);
+
+ZyanStatus ZydisFormatterATTPrintDISP(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+ZyanStatus ZydisFormatterATTPrintIMM(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Fomatter presets */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* AT&T */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * The default formatter configuration for `AT&T` style disassembly.
+ */
+static const ZydisFormatter FORMATTER_ATT =
+{
+ /* style */ ZYDIS_FORMATTER_STYLE_ATT,
+ /* force_memory_size */ ZYAN_FALSE,
+ /* force_memory_seg */ ZYAN_FALSE,
+ /* force_relative_branches */ ZYAN_FALSE,
+ /* force_relative_riprel */ ZYAN_FALSE,
+ /* print_branch_size */ ZYAN_FALSE,
+ /* detailed_prefixes */ ZYAN_FALSE,
+ /* addr_base */ ZYDIS_NUMERIC_BASE_HEX,
+ /* addr_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
+ /* addr_padding_absolute */ ZYDIS_PADDING_AUTO,
+ /* addr_padding_relative */ 2,
+ /* disp_base */ ZYDIS_NUMERIC_BASE_HEX,
+ /* disp_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
+ /* disp_padding */ 2,
+ /* imm_base */ ZYDIS_NUMERIC_BASE_HEX,
+ /* imm_signedness */ ZYDIS_SIGNEDNESS_AUTO,
+ /* imm_padding */ 2,
+ /* case_prefixes */ ZYDIS_LETTER_CASE_DEFAULT,
+ /* case_mnemonic */ ZYDIS_LETTER_CASE_DEFAULT,
+ /* case_registers */ ZYDIS_LETTER_CASE_DEFAULT,
+ /* case_typecasts */ ZYDIS_LETTER_CASE_DEFAULT,
+ /* case_decorators */ ZYDIS_LETTER_CASE_DEFAULT,
+ /* hex_uppercase */ ZYAN_TRUE,
+ /* number_format */
+ {
+ // ZYDIS_NUMERIC_BASE_DEC
+ {
+ // Prefix
+ {
+ /* string */ ZYAN_NULL,
+ /* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
+ /* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ // Suffix
+ {
+ /* string */ ZYAN_NULL,
+ /* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
+ /* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ }
+ },
+ // ZYDIS_NUMERIC_BASE_HEX
+ {
+ // Prefix
+ {
+ /* string */ &FORMATTER_ATT.number_format[
+ ZYDIS_NUMERIC_BASE_HEX][0].string_data,
+ /* string_data */ ZYAN_DEFINE_STRING_VIEW("0x"),
+ /* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ // Suffix
+ {
+ /* string */ ZYAN_NULL,
+ /* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
+ /* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ }
+ }
+ },
+ /* func_pre_instruction */ ZYAN_NULL,
+ /* func_post_instruction */ ZYAN_NULL,
+ /* func_format_instruction */ &ZydisFormatterATTFormatInstruction,
+ /* func_pre_operand */ ZYAN_NULL,
+ /* func_post_operand */ ZYAN_NULL,
+ /* func_format_operand_reg */ &ZydisFormatterBaseFormatOperandREG,
+ /* func_format_operand_mem */ &ZydisFormatterATTFormatOperandMEM,
+ /* func_format_operand_ptr */ &ZydisFormatterBaseFormatOperandPTR,
+ /* func_format_operand_imm */ &ZydisFormatterBaseFormatOperandIMM,
+ /* func_print_mnemonic */ &ZydisFormatterATTPrintMnemonic,
+ /* func_print_register */ &ZydisFormatterATTPrintRegister,
+ /* func_print_address_abs */ &ZydisFormatterBasePrintAddressABS,
+ /* func_print_address_rel */ &ZydisFormatterBasePrintAddressREL,
+ /* func_print_disp */ &ZydisFormatterATTPrintDISP,
+ /* func_print_imm */ &ZydisFormatterATTPrintIMM,
+ /* func_print_typecast */ ZYAN_NULL,
+ /* func_print_segment */ &ZydisFormatterBasePrintSegment,
+ /* func_print_prefixes */ &ZydisFormatterBasePrintPrefixes,
+ /* func_print_decorator */ &ZydisFormatterBasePrintDecorator
+};
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ZYDIS_FORMATTER_ATT_H
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/FormatterBase.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/FormatterBase.h
new file mode 100644
index 0000000..0a61747
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/FormatterBase.h
@@ -0,0 +1,318 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd, Joel Hoener
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Provides formatter functions that are shared between the different formatters.
+ */
+
+#ifndef ZYDIS_FORMATTER_BASE_H
+#define ZYDIS_FORMATTER_BASE_H
+
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Macros */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* String */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Appends an unsigned numeric value to the given string.
+ *
+ * @param formatter A pointer to the `ZydisFormatter` instance.
+ * @param base The numeric base.
+ * @param str The destination string.
+ * @param value The value.
+ * @param padding_length The padding length.
+ */
+#define ZYDIS_STRING_APPEND_NUM_U(formatter, base, str, value, padding_length) \
+ switch (base) \
+ { \
+ case ZYDIS_NUMERIC_BASE_DEC: \
+ ZYAN_CHECK(ZydisStringAppendDecU(str, value, padding_length, \
+ (formatter)->number_format[base][0].string, \
+ (formatter)->number_format[base][1].string)); \
+ break; \
+ case ZYDIS_NUMERIC_BASE_HEX: \
+ ZYAN_CHECK(ZydisStringAppendHexU(str, value, padding_length, \
+ (formatter)->hex_uppercase, \
+ (formatter)->number_format[base][0].string, \
+ (formatter)->number_format[base][1].string)); \
+ break; \
+ default: \
+ return ZYAN_STATUS_INVALID_ARGUMENT; \
+ }
+
+/**
+ * Appends a signed numeric value to the given string.
+ *
+ * @param formatter A pointer to the `ZydisFormatter` instance.
+ * @param base The numeric base.
+ * @param str The destination string.
+ * @param value The value.
+ * @param padding_length The padding length.
+ * @param force_sign Forces printing of the '+' sign for positive numbers.
+ */
+#define ZYDIS_STRING_APPEND_NUM_S(formatter, base, str, value, padding_length, force_sign) \
+ switch (base) \
+ { \
+ case ZYDIS_NUMERIC_BASE_DEC: \
+ ZYAN_CHECK(ZydisStringAppendDecS(str, value, padding_length, force_sign, \
+ (formatter)->number_format[base][0].string, \
+ (formatter)->number_format[base][1].string)); \
+ break; \
+ case ZYDIS_NUMERIC_BASE_HEX: \
+ ZYAN_CHECK(ZydisStringAppendHexS(str, value, padding_length, \
+ (formatter)->hex_uppercase, force_sign, \
+ (formatter)->number_format[base][0].string, \
+ (formatter)->number_format[base][1].string)); \
+ break; \
+ default: \
+ return ZYAN_STATUS_INVALID_ARGUMENT; \
+ }
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Buffer */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Invokes the `ZydisFormatterBufferAppend` routine, if tokenization is enabled for the
+ * current pass.
+ *
+ * @param buffer A pointer to the `ZydisFormatterBuffer` struct.
+ * @param type The token type.
+ *
+ * Using this macro instead of direct calls to `ZydisFormatterBufferAppend` greatly improves the
+ * performance for non-tokenizing passes.
+ */
+#define ZYDIS_BUFFER_APPEND_TOKEN(buffer, type) \
+ if ((buffer)->is_token_list) \
+ { \
+ ZYAN_CHECK(ZydisFormatterBufferAppend(buffer, type)); \
+ }
+
+/**
+ * Returns a snapshot of the buffer-state.
+ *
+ * @param buffer A pointer to the `ZydisFormatterBuffer` struct.
+ * @param state Receives a snapshot of the buffer-state.
+ *
+ * Using this macro instead of direct calls to `ZydisFormatterBufferRemember` improves the
+ * performance for non-tokenizing passes.
+ */
+#define ZYDIS_BUFFER_REMEMBER(buffer, state) \
+ if ((buffer)->is_token_list) \
+ { \
+ (state) = (ZyanUPointer)(buffer)->string.vector.data; \
+ } else \
+ { \
+ (state) = (ZyanUPointer)(buffer)->string.vector.size; \
+ }
+
+/**
+ * Appends a string (`STR_`-prefix) or a predefined token-list (`TOK_`-prefix).
+ *
+ * @param buffer A pointer to the `ZydisFormatterBuffer` struct.
+ * @param name The base name (without prefix) of the string- or token.
+ */
+#define ZYDIS_BUFFER_APPEND(buffer, name) \
+ if ((buffer)->is_token_list) \
+ { \
+ ZYAN_CHECK(ZydisFormatterBufferAppendPredefined(buffer, TOK_ ## name)); \
+ } else \
+ { \
+ ZYAN_CHECK(ZydisStringAppendShort(&buffer->string, &STR_ ## name)); \
+ }
+
+// TODO: Implement `letter_case` for predefined tokens
+
+/**
+ * Appends a string (`STR_`-prefix) or a predefined token-list (`TOK_`-prefix).
+ *
+ * @param buffer A pointer to the `ZydisFormatterBuffer` struct.
+ * @param name The base name (without prefix) of the string- or token.
+ * @param letter-case The desired letter-case.
+ */
+#define ZYDIS_BUFFER_APPEND_CASE(buffer, name, letter_case) \
+ if ((buffer)->is_token_list) \
+ { \
+ ZYAN_CHECK(ZydisFormatterBufferAppendPredefined(buffer, TOK_ ## name)); \
+ } else \
+ { \
+ ZYAN_CHECK(ZydisStringAppendShortCase(&buffer->string, &STR_ ## name, letter_case)); \
+ }
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Helper functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Buffer */
+/* ---------------------------------------------------------------------------------------------- */
+
+// MSVC does not like the C99 flexible-array extension
+#ifdef ZYAN_MSVC
+# pragma warning(push)
+# pragma warning(disable:4200)
+#endif
+
+#pragma pack(push, 1)
+
+typedef struct ZydisPredefinedToken_
+{
+ ZyanU8 size;
+ ZyanU8 next;
+ ZyanU8 data[];
+} ZydisPredefinedToken;
+
+#pragma pack(pop)
+
+#ifdef ZYAN_MSVC
+# pragma warning(pop)
+#endif
+
+/**
+ * Appends a predefined token-list to the `buffer`.
+ *
+ * @param buffer A pointer to the `ZydisFormatterBuffer` struct.
+ * @param data A pointer to the `ZydisPredefinedToken` struct.
+ *
+ * @return A zycore status code.
+ *
+ * This function is internally used to improve performance while adding static strings or multiple
+ * tokens at once.
+ */
+ZYAN_INLINE ZyanStatus ZydisFormatterBufferAppendPredefined(ZydisFormatterBuffer* buffer,
+ const ZydisPredefinedToken* data)
+{
+ ZYAN_ASSERT(buffer);
+ ZYAN_ASSERT(data);
+
+ const ZyanUSize len = buffer->string.vector.size;
+ ZYAN_ASSERT((len > 0) && (len < 256));
+ if (buffer->capacity <= len + data->size)
+ {
+ return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
+ }
+
+ ZydisFormatterToken* const last = (ZydisFormatterToken*)buffer->string.vector.data - 1;
+ last->next = (ZyanU8)len;
+
+ ZYAN_MEMCPY((ZyanU8*)buffer->string.vector.data + len, &data->data[0], data->size);
+
+ const ZyanUSize delta = len + data->next;
+ buffer->capacity -= delta;
+ buffer->string.vector.data = (ZyanU8*)buffer->string.vector.data + delta;
+ buffer->string.vector.size = data->size - data->next;
+ buffer->string.vector.capacity = ZYAN_MIN(buffer->capacity, 255);
+
+ return ZYAN_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------------------------- */
+/* General */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the size to be used as explicit size suffix (`AT&T`) or explicit typecast
+ * (`INTEL`), if required.
+ *
+ * @param formatter A pointer to the `ZydisFormatter` instance.
+ * @param context A pointer to the `ZydisFormatterContext` struct.
+ * @param memop_id The operand-id of the instructions first memory operand.
+ *
+ * @return Returns the explicit size, if required, or `0`, if not needed.
+ *
+ * This function always returns a size different to `0`, if the `ZYDIS_FORMATTER_PROP_FORCE_SIZE`
+ * is set to `ZYAN_TRUE`.
+ */
+ZyanU32 ZydisFormatterHelperGetExplicitSize(const ZydisFormatter* formatter,
+ ZydisFormatterContext* context, ZyanU8 memop_id);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Formatter functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Operands */
+/* ---------------------------------------------------------------------------------------------- */
+
+ZyanStatus ZydisFormatterBaseFormatOperandREG(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+ZyanStatus ZydisFormatterBaseFormatOperandPTR(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+ZyanStatus ZydisFormatterBaseFormatOperandIMM(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Elemental tokens */
+/* ---------------------------------------------------------------------------------------------- */
+
+ZyanStatus ZydisFormatterBasePrintAddressABS(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+ZyanStatus ZydisFormatterBasePrintAddressREL(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+ZyanStatus ZydisFormatterBasePrintIMM(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Optional tokens */
+/* ---------------------------------------------------------------------------------------------- */
+
+ZyanStatus ZydisFormatterBasePrintSegment(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+ZyanStatus ZydisFormatterBasePrintPrefixes(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+ZyanStatus ZydisFormatterBasePrintDecorator(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context, ZydisDecorator decorator);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ZYDIS_FORMATTER_BASE_H
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/FormatterIntel.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/FormatterIntel.h
new file mode 100644
index 0000000..cd12d38
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/FormatterIntel.h
@@ -0,0 +1,267 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd, Joel Hoener
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Implements the `INTEL` style instruction-formatter.
+ */
+
+#ifndef ZYDIS_FORMATTER_INTEL_H
+#define ZYDIS_FORMATTER_INTEL_H
+
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Formatter functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Intel */
+/* ---------------------------------------------------------------------------------------------- */
+
+ZyanStatus ZydisFormatterIntelFormatInstruction(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+ZyanStatus ZydisFormatterIntelFormatOperandMEM(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+ZyanStatus ZydisFormatterIntelPrintMnemonic(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+ZyanStatus ZydisFormatterIntelPrintRegister(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context, ZydisRegister reg);
+
+ZyanStatus ZydisFormatterIntelPrintDISP(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+ZyanStatus ZydisFormatterIntelPrintTypecast(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* MASM */
+/* ---------------------------------------------------------------------------------------------- */
+
+ZyanStatus ZydisFormatterIntelFormatInstructionMASM(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+ZyanStatus ZydisFormatterIntelPrintAddressMASM(const ZydisFormatter* formatter,
+ ZydisFormatterBuffer* buffer, ZydisFormatterContext* context);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Fomatter presets */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* INTEL */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * The default formatter configuration for `INTEL` style disassembly.
+ */
+static const ZydisFormatter FORMATTER_INTEL =
+{
+ /* style */ ZYDIS_FORMATTER_STYLE_INTEL,
+ /* force_memory_size */ ZYAN_FALSE,
+ /* force_memory_seg */ ZYAN_FALSE,
+ /* force_relative_branches */ ZYAN_FALSE,
+ /* force_relative_riprel */ ZYAN_FALSE,
+ /* print_branch_size */ ZYAN_FALSE,
+ /* detailed_prefixes */ ZYAN_FALSE,
+ /* addr_base */ ZYDIS_NUMERIC_BASE_HEX,
+ /* addr_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
+ /* addr_padding_absolute */ ZYDIS_PADDING_AUTO,
+ /* addr_padding_relative */ 2,
+ /* disp_base */ ZYDIS_NUMERIC_BASE_HEX,
+ /* disp_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
+ /* disp_padding */ 2,
+ /* imm_base */ ZYDIS_NUMERIC_BASE_HEX,
+ /* imm_signedness */ ZYDIS_SIGNEDNESS_UNSIGNED,
+ /* imm_padding */ 2,
+ /* case_prefixes */ ZYDIS_LETTER_CASE_DEFAULT,
+ /* case_mnemonic */ ZYDIS_LETTER_CASE_DEFAULT,
+ /* case_registers */ ZYDIS_LETTER_CASE_DEFAULT,
+ /* case_typecasts */ ZYDIS_LETTER_CASE_DEFAULT,
+ /* case_decorators */ ZYDIS_LETTER_CASE_DEFAULT,
+ /* hex_uppercase */ ZYAN_TRUE,
+ /* number_format */
+ {
+ // ZYDIS_NUMERIC_BASE_DEC
+ {
+ // Prefix
+ {
+ /* string */ ZYAN_NULL,
+ /* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
+ /* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ // Suffix
+ {
+ /* string */ ZYAN_NULL,
+ /* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
+ /* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ }
+ },
+ // ZYDIS_NUMERIC_BASE_HEX
+ {
+ // Prefix
+ {
+ /* string */ &FORMATTER_INTEL.number_format[
+ ZYDIS_NUMERIC_BASE_HEX][0].string_data,
+ /* string_data */ ZYAN_DEFINE_STRING_VIEW("0x"),
+ /* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ // Suffix
+ {
+ /* string */ ZYAN_NULL,
+ /* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
+ /* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ }
+ }
+ },
+ /* func_pre_instruction */ ZYAN_NULL,
+ /* func_post_instruction */ ZYAN_NULL,
+ /* func_format_instruction */ &ZydisFormatterIntelFormatInstruction,
+ /* func_pre_operand */ ZYAN_NULL,
+ /* func_post_operand */ ZYAN_NULL,
+ /* func_format_operand_reg */ &ZydisFormatterBaseFormatOperandREG,
+ /* func_format_operand_mem */ &ZydisFormatterIntelFormatOperandMEM,
+ /* func_format_operand_ptr */ &ZydisFormatterBaseFormatOperandPTR,
+ /* func_format_operand_imm */ &ZydisFormatterBaseFormatOperandIMM,
+ /* func_print_mnemonic */ &ZydisFormatterIntelPrintMnemonic,
+ /* func_print_register */ &ZydisFormatterIntelPrintRegister,
+ /* func_print_address_abs */ &ZydisFormatterBasePrintAddressABS,
+ /* func_print_address_rel */ &ZydisFormatterBasePrintAddressREL,
+ /* func_print_disp */ &ZydisFormatterIntelPrintDISP,
+ /* func_print_imm */ &ZydisFormatterBasePrintIMM,
+ /* func_print_typecast */ &ZydisFormatterIntelPrintTypecast,
+ /* func_print_segment */ &ZydisFormatterBasePrintSegment,
+ /* func_print_prefixes */ &ZydisFormatterBasePrintPrefixes,
+ /* func_print_decorator */ &ZydisFormatterBasePrintDecorator
+};
+
+/* ---------------------------------------------------------------------------------------------- */
+/* MASM */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * The default formatter configuration for `MASM` style disassembly.
+ */
+static const ZydisFormatter FORMATTER_INTEL_MASM =
+{
+ /* style */ ZYDIS_FORMATTER_STYLE_INTEL_MASM,
+ /* force_memory_size */ ZYAN_TRUE,
+ /* force_memory_seg */ ZYAN_FALSE,
+ /* force_relative_branches */ ZYAN_FALSE,
+ /* force_relative_riprel */ ZYAN_FALSE,
+ /* print_branch_size */ ZYAN_FALSE,
+ /* detailed_prefixes */ ZYAN_FALSE,
+ /* addr_base */ ZYDIS_NUMERIC_BASE_HEX,
+ /* addr_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
+ /* addr_padding_absolute */ ZYDIS_PADDING_DISABLED,
+ /* addr_padding_relative */ ZYDIS_PADDING_DISABLED,
+ /* disp_base */ ZYDIS_NUMERIC_BASE_HEX,
+ /* disp_signedness */ ZYDIS_SIGNEDNESS_SIGNED,
+ /* disp_padding */ ZYDIS_PADDING_DISABLED,
+ /* imm_base */ ZYDIS_NUMERIC_BASE_HEX,
+ /* imm_signedness */ ZYDIS_SIGNEDNESS_AUTO,
+ /* imm_padding */ ZYDIS_PADDING_DISABLED,
+ /* case_prefixes */ ZYDIS_LETTER_CASE_DEFAULT,
+ /* case_mnemonic */ ZYDIS_LETTER_CASE_DEFAULT,
+ /* case_registers */ ZYDIS_LETTER_CASE_DEFAULT,
+ /* case_typecasts */ ZYDIS_LETTER_CASE_DEFAULT,
+ /* case_decorators */ ZYDIS_LETTER_CASE_DEFAULT,
+ /* hex_uppercase */ ZYAN_TRUE,
+ /* number_format */
+ {
+ // ZYDIS_NUMERIC_BASE_DEC
+ {
+ // Prefix
+ {
+ /* string */ ZYAN_NULL,
+ /* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
+ /* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ // Suffix
+ {
+ /* string */ ZYAN_NULL,
+ /* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
+ /* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ }
+ },
+ // ZYDIS_NUMERIC_BASE_HEX
+ {
+ // Prefix
+ {
+ /* string */ ZYAN_NULL,
+ /* string_data */ ZYAN_DEFINE_STRING_VIEW(""),
+ /* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ },
+ // Suffix
+ {
+ /* string */ &FORMATTER_INTEL_MASM.number_format[
+ ZYDIS_NUMERIC_BASE_HEX][1].string_data,
+ /* string_data */ ZYAN_DEFINE_STRING_VIEW("h"),
+ /* buffer */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ }
+ }
+ },
+ /* func_pre_instruction */ ZYAN_NULL,
+ /* func_post_instruction */ ZYAN_NULL,
+ /* func_format_instruction */ &ZydisFormatterIntelFormatInstructionMASM,
+ /* func_pre_operand */ ZYAN_NULL,
+ /* func_post_operand */ ZYAN_NULL,
+ /* func_format_operand_reg */ &ZydisFormatterBaseFormatOperandREG,
+ /* func_format_operand_mem */ &ZydisFormatterIntelFormatOperandMEM,
+ /* func_format_operand_ptr */ &ZydisFormatterBaseFormatOperandPTR,
+ /* func_format_operand_imm */ &ZydisFormatterBaseFormatOperandIMM,
+ /* func_print_mnemonic */ &ZydisFormatterIntelPrintMnemonic,
+ /* func_print_register */ &ZydisFormatterIntelPrintRegister,
+ /* func_print_address_abs */ &ZydisFormatterIntelPrintAddressMASM,
+ /* func_print_address_rel */ &ZydisFormatterIntelPrintAddressMASM,
+ /* func_print_disp */ &ZydisFormatterIntelPrintDISP,
+ /* func_print_imm */ &ZydisFormatterBasePrintIMM,
+ /* func_print_typecast */ &ZydisFormatterIntelPrintTypecast,
+ /* func_print_segment */ &ZydisFormatterBasePrintSegment,
+ /* func_print_prefixes */ &ZydisFormatterBasePrintPrefixes,
+ /* func_print_decorator */ &ZydisFormatterBasePrintDecorator
+};
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ZYDIS_FORMATTER_INTEL_H
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/SharedData.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/SharedData.h
new file mode 100644
index 0000000..d8db4fb
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/SharedData.h
@@ -0,0 +1,974 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+#ifndef ZYDIS_INTERNAL_SHAREDDATA_H
+#define ZYDIS_INTERNAL_SHAREDDATA_H
+
+#include
+#include
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+// MSVC does not like types other than (un-)signed int for bit-fields
+#ifdef ZYAN_MSVC
+# pragma warning(push)
+# pragma warning(disable:4214)
+#endif
+
+#pragma pack(push, 1)
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Operand definition */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisSemanticOperandType` enum.
+ */
+typedef enum ZydisSemanticOperandType_
+{
+ ZYDIS_SEMANTIC_OPTYPE_UNUSED,
+ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_REG,
+ ZYDIS_SEMANTIC_OPTYPE_IMPLICIT_MEM,
+ ZYDIS_SEMANTIC_OPT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DIS_SEMANTIC_OPTYPE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_SEMANTIC_OPTYPE_MAX_VALUE)
+} ZydisSemanticOperandType;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisInternalElementType` enum.
+ */
+typedef enum ZydisInternalElementType_
+{
+ ZYDIS_IELEMENT_TYPE_INVALID,
+ ZYDIS_IELEMENT_TYPE_VARIABLE,
+ ZYDIS_IELEMENT_TYPE_STRUCT,
+ ZYDIS_IELEMENT_TYPE_INT,
+ ZYDIS_IELEMENT_TYPE_UINT,
+ ZYDIS_IELEMENT_TYPE_INT1,
+ ZYDIS_IELEMENT_TYPE_INT8,
+ ZYDIS_IELEMENT_TYPE_INT16,
+ ZYDIS_IELEMENT_TYPE_INT32,
+ ZYDIS_IELEMENT_TYPE_INT64,
+ ZYDIS_IELEMENT_TYPE_UINT8,
+ ZYDIS_IELEMENT_TYPE_UINT16,
+ ZYDIS_IELEMENT_TYPE_UINT32,
+ ZYDIS_IELEMENT_TYPE_UINT64,
+ ZYDIS_IELEMENT_TYPE_UINT128,
+ ZYDIS_IELEMENT_TYPE_UINT256,
+ ZYDIS_IELEMENT_TYPE_FLOAT16,
+ ZYDIS_IELEMENT_TYPE_FLOAT32,
+ ZYDIS_IELEMENT_TYPE_FLOAT64,
+ ZYDIS_IELEMENT_TYPE_FLOAT80,
+ ZYDIS_IELEMENT_TYPE_BCD80,
+ ZYDIS_IELEMENT_TYPE_CC3,
+ ZYDIS_IELEMENT_TYPE_CC5,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_IELEMENT_TYPE_MAX_VALUE = ZYDIS_IELEMENT_TYPE_CC5,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_IELEMENT_TYPE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_IELEMENT_TYPE_MAX_VALUE)
+} ZydisInternalElementType;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisImplicitRegisterType` enum.
+ */
+typedef enum ZydisImplicitRegisterType_
+{
+ ZYDIS_IMPLREG_TYPE_STATIC,
+ ZYDIS_IMPLREG_TYPE_GPR_OSZ,
+ ZYDIS_IMPLREG_TYPE_GPR_ASZ,
+ ZYDIS_IMPLREG_TYPE_GPR_SSZ,
+ ZYDIS_IMPLREG_TYPE_IP_ASZ,
+ ZYDIS_IMPLREG_TYPE_IP_SSZ,
+ ZYDIS_IMPLREG_TYPE_FLAGS_SSZ,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_IMPLREG_TYPE_MAX_VALUE = ZYDIS_IMPLREG_TYPE_FLAGS_SSZ,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_IMPLREG_TYPE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_IMPLREG_TYPE_MAX_VALUE)
+} ZydisImplicitRegisterType;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisImplicitMemBase` enum.
+ */
+typedef enum ZydisImplicitMemBase_
+{
+ ZYDIS_IMPLMEM_BASE_AGPR_REG,
+ ZYDIS_IMPLMEM_BASE_AGPR_RM,
+ ZYDIS_IMPLMEM_BASE_AAX,
+ ZYDIS_IMPLMEM_BASE_ADX,
+ ZYDIS_IMPLMEM_BASE_ABX,
+ ZYDIS_IMPLMEM_BASE_ASP,
+ ZYDIS_IMPLMEM_BASE_ABP,
+ ZYDIS_IMPLMEM_BASE_ASI,
+ ZYDIS_IMPLMEM_BASE_ADI,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_IMPLMEM_BASE_MAX_VALUE = ZYDIS_IMPLMEM_BASE_ADI,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_IMPLMEM_BASE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_IMPLMEM_BASE_MAX_VALUE)
+} ZydisImplicitMemBase;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+// MSVC does not correctly execute the `pragma pack(1)` compiler-directive, if we use the correct
+// enum types
+ZYAN_STATIC_ASSERT(ZYDIS_SEMANTIC_OPTYPE_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_OPERAND_VISIBILITY_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_OPERAND_ACTION_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_IELEMENT_TYPE_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_OPERAND_ENCODING_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_IMPLREG_TYPE_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_REGISTER_REQUIRED_BITS <= 16);
+ZYAN_STATIC_ASSERT(ZYDIS_IMPLMEM_BASE_REQUIRED_BITS <= 8);
+
+/**
+ * Defines the `ZydisOperandDefinition` struct.
+ */
+typedef struct ZydisOperandDefinition_
+{
+ ZyanU8 type ZYAN_BITFIELD(ZYDIS_SEMANTIC_OPTYPE_REQUIRED_BITS);
+ ZyanU8 visibility ZYAN_BITFIELD(ZYDIS_OPERAND_VISIBILITY_REQUIRED_BITS);
+ ZyanU8 actions ZYAN_BITFIELD(ZYDIS_OPERAND_ACTION_REQUIRED_BITS);
+ ZyanU16 size[3];
+ ZyanU8 element_type ZYAN_BITFIELD(ZYDIS_IELEMENT_TYPE_REQUIRED_BITS);
+ union
+ {
+ ZyanU8 encoding ZYAN_BITFIELD(ZYDIS_OPERAND_ENCODING_REQUIRED_BITS);
+ struct
+ {
+ ZyanU8 type ZYAN_BITFIELD(ZYDIS_IMPLREG_TYPE_REQUIRED_BITS);
+ union
+ {
+ ZyanU16 reg ZYAN_BITFIELD(ZYDIS_REGISTER_REQUIRED_BITS);
+ ZyanU8 id ZYAN_BITFIELD(6);
+ } reg;
+ } reg;
+ struct
+ {
+ ZyanU8 seg ZYAN_BITFIELD(3);
+ ZyanU8 base ZYAN_BITFIELD(ZYDIS_IMPLMEM_BASE_REQUIRED_BITS);
+ } mem;
+ } op;
+} ZydisOperandDefinition;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Instruction definition */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisReadWriteAction` enum.
+ */
+typedef enum ZydisReadWriteAction_
+{
+ ZYDIS_RW_ACTION_NONE,
+ ZYDIS_RW_ACTION_READ,
+ ZYDIS_RW_ACTION_WRITE,
+ ZYDIS_RW_ACTION_READWRITE,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_RW_ACTION_MAX_VALUE = ZYDIS_RW_ACTION_READWRITE,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_RW_ACTION_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_RW_ACTION_MAX_VALUE)
+} ZydisReadWriteAction;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisRegisterConstraint` enum.
+ */
+typedef enum ZydisRegisterConstraint_
+{
+ ZYDIS_REG_CONSTRAINTS_UNUSED,
+ ZYDIS_REG_CONSTRAINTS_NONE,
+ ZYDIS_REG_CONSTRAINTS_GPR,
+ ZYDIS_REG_CONSTRAINTS_SR_DEST,
+ ZYDIS_REG_CONSTRAINTS_SR,
+ ZYDIS_REG_CONSTRAINTS_CR,
+ ZYDIS_REG_CONSTRAINTS_DR,
+ ZYDIS_REG_CONSTRAINTS_MASK,
+ ZYDIS_REG_CONSTRAINTS_BND,
+ ZYDIS_REG_CONSTRAINTS_VSIB,
+ ZYDIS_REG_CONSTRAINTS_NO_REL,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_REG_CONSTRAINTS_MAX_VALUE = ZYDIS_REG_CONSTRAINTS_NO_REL,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_REG_CONSTRAINTS_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_REG_CONSTRAINTS_MAX_VALUE)
+} ZydisRegisterConstraint;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisInternalVectorLength` enum.
+ */
+typedef enum ZydisInternalVectorLength_
+{
+ ZYDIS_IVECTOR_LENGTH_DEFAULT,
+ ZYDIS_IVECTOR_LENGTH_FIXED_128,
+ ZYDIS_IVECTOR_LENGTH_FIXED_256,
+ ZYDIS_IVECTOR_LENGTH_FIXED_512,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_IVECTOR_LENGTH_MAX_VALUE = ZYDIS_IVECTOR_LENGTH_FIXED_512,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_IVECTOR_LENGTH_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_IVECTOR_LENGTH_MAX_VALUE)
+} ZydisInternalVectorLength;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisInternalElementSize` enum.
+ */
+typedef enum ZydisInternalElementSize_
+{
+ ZYDIS_IELEMENT_SIZE_INVALID,
+ ZYDIS_IELEMENT_SIZE_8,
+ ZYDIS_IELEMENT_SIZE_16,
+ ZYDIS_IELEMENT_SIZE_32,
+ ZYDIS_IELEMENT_SIZE_64,
+ ZYDIS_IELEMENT_SIZE_128,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_IELEMENT_SIZE_MAX_VALUE = ZYDIS_IELEMENT_SIZE_128,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_IELEMENT_SIZE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_IELEMENT_SIZE_MAX_VALUE)
+} ZydisInternalElementSize;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisEVEXFunctionality` enum.
+ */
+typedef enum ZydisEVEXFunctionality_
+{
+ ZYDIS_EVEX_FUNC_INVALID,
+ /**
+ * `EVEX.b` enables broadcast functionality.
+ */
+ ZYDIS_EVEX_FUNC_BC,
+ /**
+ * `EVEX.b` enables embedded-rounding functionality.
+ */
+ ZYDIS_EVEX_FUNC_RC,
+ /**
+ * `EVEX.b` enables sae functionality.
+ */
+ ZYDIS_EVEX_FUNC_SAE,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_EVEX_FUNC_MAX_VALUE = ZYDIS_EVEX_FUNC_SAE,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_EVEX_FUNC_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_EVEX_FUNC_MAX_VALUE)
+} ZydisEVEXFunctionality;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisEVEXTupleType` enum.
+ */
+typedef enum ZydisEVEXTupleType_
+{
+ ZYDIS_TUPLETYPE_INVALID,
+ /**
+ * Full Vector
+ */
+ ZYDIS_TUPLETYPE_FV,
+ /**
+ * Half Vector
+ */
+ ZYDIS_TUPLETYPE_HV,
+ /**
+ * Full Vector Mem
+ */
+ ZYDIS_TUPLETYPE_FVM,
+ /**
+ * Tuple1 Scalar
+ */
+ ZYDIS_TUPLETYPE_T1S,
+ /**
+ * Tuple1 Fixed
+ */
+ ZYDIS_TUPLETYPE_T1F,
+ /**
+ * Tuple1 4x32
+ */
+ ZYDIS_TUPLETYPE_T1_4X,
+ /**
+ * Gather / Scatter
+ */
+ ZYDIS_TUPLETYPE_GSCAT,
+ /**
+ * Tuple2
+ */
+ ZYDIS_TUPLETYPE_T2,
+ /**
+ * Tuple4
+ */
+ ZYDIS_TUPLETYPE_T4,
+ /**
+ * Tuple8
+ */
+ ZYDIS_TUPLETYPE_T8,
+ /**
+ * Half Mem
+ */
+ ZYDIS_TUPLETYPE_HVM,
+ /**
+ * QuarterMem
+ */
+ ZYDIS_TUPLETYPE_QVM,
+ /**
+ * OctMem
+ */
+ ZYDIS_TUPLETYPE_OVM,
+ /**
+ * Mem128
+ */
+ ZYDIS_TUPLETYPE_M128,
+ /**
+ * MOVDDUP
+ */
+ ZYDIS_TUPLETYPE_DUP,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_TUPLETYPE_MAX_VALUE = ZYDIS_TUPLETYPE_DUP,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_TUPLETYPE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_TUPLETYPE_MAX_VALUE)
+} ZydisEVEXTupleType;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisMVEXFunctionality` enum.
+ */
+typedef enum ZydisMVEXFunctionality_
+{
+ /**
+ * The `MVEX.SSS` value is ignored.
+ */
+ ZYDIS_MVEX_FUNC_IGNORED,
+ /**
+ * `MVEX.SSS` must be `000b`.
+ */
+ ZYDIS_MVEX_FUNC_INVALID,
+ /**
+ * `MVEX.SSS` controls embedded-rounding functionality.
+ */
+ ZYDIS_MVEX_FUNC_RC,
+ /**
+ * `MVEX.SSS` controls sae functionality.
+ */
+ ZYDIS_MVEX_FUNC_SAE,
+ /**
+ * No special operation (32bit float elements).
+ */
+ ZYDIS_MVEX_FUNC_F_32,
+ /**
+ * No special operation (32bit uint elements).
+ */
+ ZYDIS_MVEX_FUNC_I_32,
+ /**
+ * No special operation (64bit float elements).
+ */
+ ZYDIS_MVEX_FUNC_F_64,
+ /**
+ * No special operation (64bit uint elements).
+ */
+ ZYDIS_MVEX_FUNC_I_64,
+ /**
+ * Sf32(reg) or Si32(reg).
+ */
+ ZYDIS_MVEX_FUNC_SWIZZLE_32,
+ /**
+ * Sf64(reg) or Si64(reg).
+ */
+ ZYDIS_MVEX_FUNC_SWIZZLE_64,
+ /**
+ * Sf32(mem).
+ */
+ ZYDIS_MVEX_FUNC_SF_32,
+ /**
+ * Sf32(mem) broadcast only.
+ */
+ ZYDIS_MVEX_FUNC_SF_32_BCST,
+ /**
+ * Sf32(mem) broadcast 4to16 only.
+ */
+ ZYDIS_MVEX_FUNC_SF_32_BCST_4TO16,
+ /**
+ * Sf64(mem).
+ */
+ ZYDIS_MVEX_FUNC_SF_64,
+ /**
+ * Si32(mem).
+ */
+ ZYDIS_MVEX_FUNC_SI_32,
+ /**
+ * Si32(mem) broadcast only.
+ */
+ ZYDIS_MVEX_FUNC_SI_32_BCST,
+ /**
+ * Si32(mem) broadcast 4to16 only.
+ */
+ ZYDIS_MVEX_FUNC_SI_32_BCST_4TO16,
+ /**
+ * Si64(mem).
+ */
+ ZYDIS_MVEX_FUNC_SI_64,
+ /**
+ * Uf32.
+ */
+ ZYDIS_MVEX_FUNC_UF_32,
+ /**
+ * Uf64.
+ */
+ ZYDIS_MVEX_FUNC_UF_64,
+ /**
+ * Ui32.
+ */
+ ZYDIS_MVEX_FUNC_UI_32,
+ /**
+ * Ui64.
+ */
+ ZYDIS_MVEX_FUNC_UI_64,
+ /**
+ * Df32.
+ */
+ ZYDIS_MVEX_FUNC_DF_32,
+ /**
+ * Df64.
+ */
+ ZYDIS_MVEX_FUNC_DF_64,
+ /**
+ * Di32.
+ */
+ ZYDIS_MVEX_FUNC_DI_32,
+ /**
+ * Di64.
+ */
+ ZYDIS_MVEX_FUNC_DI_64,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_MVEX_FUNC_MAX_VALUE = ZYDIS_MVEX_FUNC_DI_64,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_MVEX_FUNC_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_MVEX_FUNC_MAX_VALUE)
+} ZydisMVEXFunctionality;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisVEXStaticBroadcast` enum.
+ */
+typedef enum ZydisVEXStaticBroadcast
+{
+ ZYDIS_VEX_STATIC_BROADCAST_NONE,
+ ZYDIS_VEX_STATIC_BROADCAST_1_TO_2,
+ ZYDIS_VEX_STATIC_BROADCAST_1_TO_4,
+ ZYDIS_VEX_STATIC_BROADCAST_1_TO_8,
+ ZYDIS_VEX_STATIC_BROADCAST_1_TO_16,
+ ZYDIS_VEX_STATIC_BROADCAST_1_TO_32,
+ ZYDIS_VEX_STATIC_BROADCAST_2_TO_4,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_VEX_STATIC_BROADCAST_MAX_VALUE = ZYDIS_VEX_STATIC_BROADCAST_2_TO_4,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_VEX_STATIC_BROADCAST_REQUIRED_BITS =
+ ZYAN_BITS_TO_REPRESENT(ZYDIS_VEX_STATIC_BROADCAST_MAX_VALUE)
+} ZydisVEXStaticBroadcast;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisEVEXStaticBroadcast` enum.
+ */
+typedef enum ZydisEVEXStaticBroadcast_
+{
+ ZYDIS_EVEX_STATIC_BROADCAST_NONE,
+ ZYDIS_EVEX_STATIC_BROADCAST_1_TO_2,
+ ZYDIS_EVEX_STATIC_BROADCAST_1_TO_4,
+ ZYDIS_EVEX_STATIC_BROADCAST_1_TO_8,
+ ZYDIS_EVEX_STATIC_BROADCAST_1_TO_16,
+ ZYDIS_EVEX_STATIC_BROADCAST_1_TO_32,
+ ZYDIS_EVEX_STATIC_BROADCAST_1_TO_64,
+ ZYDIS_EVEX_STATIC_BROADCAST_2_TO_4,
+ ZYDIS_EVEX_STATIC_BROADCAST_2_TO_8,
+ ZYDIS_EVEX_STATIC_BROADCAST_2_TO_16,
+ ZYDIS_EVEX_STATIC_BROADCAST_4_TO_8,
+ ZYDIS_EVEX_STATIC_BROADCAST_4_TO_16,
+ ZYDIS_EVEX_STATIC_BROADCAST_8_TO_16,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_EVEX_STATIC_BROADCAST_MAX_VALUE = ZYDIS_EVEX_STATIC_BROADCAST_8_TO_16,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_EVEX_STATIC_BROADCAST_REQUIRED_BITS =
+ ZYAN_BITS_TO_REPRESENT(ZYDIS_EVEX_STATIC_BROADCAST_MAX_VALUE)
+} ZydisEVEXStaticBroadcast;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisMVEXStaticBroadcast` enum.
+ */
+typedef enum ZydisMVEXStaticBroadcast_
+{
+ ZYDIS_MVEX_STATIC_BROADCAST_NONE,
+ ZYDIS_MVEX_STATIC_BROADCAST_1_TO_8,
+ ZYDIS_MVEX_STATIC_BROADCAST_1_TO_16,
+ ZYDIS_MVEX_STATIC_BROADCAST_4_TO_8,
+ ZYDIS_MVEX_STATIC_BROADCAST_4_TO_16,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_MVEX_STATIC_BROADCAST_MAX_VALUE = ZYDIS_MVEX_STATIC_BROADCAST_4_TO_16,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_MVEX_STATIC_BROADCAST_REQUIRED_BITS =
+ ZYAN_BITS_TO_REPRESENT(ZYDIS_MVEX_STATIC_BROADCAST_MAX_VALUE)
+} ZydisMVEXStaticBroadcast;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisMaskPolicy` enum.
+ */
+typedef enum ZydisMaskPolicy_
+{
+ ZYDIS_MASK_POLICY_INVALID,
+ /**
+ * The instruction accepts mask-registers other than the default-mask (K0), but
+ * does not require them.
+ */
+ ZYDIS_MASK_POLICY_ALLOWED,
+ /**
+ * The instruction requires a mask-register other than the default-mask (K0).
+ */
+ ZYDIS_MASK_POLICY_REQUIRED,
+ /**
+ * The instruction does not allow a mask-register other than the default-mask (K0).
+ */
+ ZYDIS_MASK_POLICY_FORBIDDEN,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_MASK_POLICY_MAX_VALUE = ZYDIS_MASK_POLICY_FORBIDDEN,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_MASK_POLICY_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_MASK_POLICY_MAX_VALUE)
+} ZydisMaskPolicy;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisMaskOverride` enum.
+ */
+typedef enum ZydisMaskOverride_
+{
+ ZYDIS_MASK_OVERRIDE_DEFAULT,
+ ZYDIS_MASK_OVERRIDE_ZEROING,
+ ZYDIS_MASK_OVERRIDE_CONTROL,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_MASK_OVERRIDE_MAX_VALUE = ZYDIS_MASK_OVERRIDE_CONTROL,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_MASK_OVERRIDE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_MASK_OVERRIDE_MAX_VALUE)
+} ZydisMaskOverride;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+// MSVC does not correctly execute the `pragma pack(1)` compiler-directive, if we use the correct
+// enum types
+ZYAN_STATIC_ASSERT(ZYDIS_MNEMONIC_REQUIRED_BITS <= 16);
+ZYAN_STATIC_ASSERT(ZYDIS_CATEGORY_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_ISA_SET_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_ISA_EXT_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_BRANCH_TYPE_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_EXCEPTION_CLASS_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_REG_CONSTRAINTS_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_RW_ACTION_REQUIRED_BITS <= 8);
+
+#ifndef ZYDIS_MINIMAL_MODE
+# define ZYDIS_INSTRUCTION_DEFINITION_BASE \
+ ZyanU16 mnemonic ZYAN_BITFIELD(ZYDIS_MNEMONIC_REQUIRED_BITS); \
+ ZyanU8 operand_count ZYAN_BITFIELD( 4); \
+ ZyanU16 operand_reference ZYAN_BITFIELD(15); \
+ ZyanU8 operand_size_map ZYAN_BITFIELD( 3); \
+ ZyanU8 address_size_map ZYAN_BITFIELD( 2); \
+ ZyanU8 flags_reference ZYAN_BITFIELD( 7); \
+ ZyanBool requires_protected_mode ZYAN_BITFIELD( 1); \
+ ZyanU8 category ZYAN_BITFIELD(ZYDIS_CATEGORY_REQUIRED_BITS); \
+ ZyanU8 isa_set ZYAN_BITFIELD(ZYDIS_ISA_SET_REQUIRED_BITS); \
+ ZyanU8 isa_ext ZYAN_BITFIELD(ZYDIS_ISA_EXT_REQUIRED_BITS); \
+ ZyanU8 branch_type ZYAN_BITFIELD(ZYDIS_BRANCH_TYPE_REQUIRED_BITS); \
+ ZyanU8 exception_class ZYAN_BITFIELD(ZYDIS_EXCEPTION_CLASS_REQUIRED_BITS); \
+ ZyanU8 constr_REG ZYAN_BITFIELD(ZYDIS_REG_CONSTRAINTS_REQUIRED_BITS); \
+ ZyanU8 constr_RM ZYAN_BITFIELD(ZYDIS_REG_CONSTRAINTS_REQUIRED_BITS); \
+ ZyanU8 cpu_state ZYAN_BITFIELD(ZYDIS_RW_ACTION_REQUIRED_BITS); \
+ ZyanU8 fpu_state ZYAN_BITFIELD(ZYDIS_RW_ACTION_REQUIRED_BITS); \
+ ZyanU8 xmm_state ZYAN_BITFIELD(ZYDIS_RW_ACTION_REQUIRED_BITS)
+#else
+# define ZYDIS_INSTRUCTION_DEFINITION_BASE \
+ ZyanU16 mnemonic ZYAN_BITFIELD(ZYDIS_MNEMONIC_REQUIRED_BITS); \
+ ZyanU8 operand_size_map ZYAN_BITFIELD( 3); \
+ ZyanU8 address_size_map ZYAN_BITFIELD( 2); \
+ ZyanBool requires_protected_mode ZYAN_BITFIELD( 1); \
+ ZyanU8 constr_REG ZYAN_BITFIELD(ZYDIS_REG_CONSTRAINTS_REQUIRED_BITS); \
+ ZyanU8 constr_RM ZYAN_BITFIELD(ZYDIS_REG_CONSTRAINTS_REQUIRED_BITS)
+#endif
+
+#define ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR \
+ ZYDIS_INSTRUCTION_DEFINITION_BASE; \
+ ZyanU8 constr_NDSNDD ZYAN_BITFIELD(ZYDIS_REG_CONSTRAINTS_REQUIRED_BITS)
+
+#define ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR_INTEL \
+ ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR; \
+ ZyanBool is_gather ZYAN_BITFIELD( 1)
+
+/**
+ * Defines the `ZydisInstructionDefinition` struct.
+ */
+typedef struct ZydisInstructionDefinition_
+{
+ ZYDIS_INSTRUCTION_DEFINITION_BASE;
+} ZydisInstructionDefinition;
+
+/**
+ * Defines the `ZydisInstructionDefinitionLEGACY` struct.
+ */
+typedef struct ZydisInstructionDefinitionLEGACY_
+{
+ ZYDIS_INSTRUCTION_DEFINITION_BASE;
+#ifndef ZYDIS_MINIMAL_MODE
+ ZyanBool is_privileged ZYAN_BITFIELD( 1);
+#endif
+ ZyanBool accepts_LOCK ZYAN_BITFIELD( 1);
+#ifndef ZYDIS_MINIMAL_MODE
+ ZyanBool accepts_REP ZYAN_BITFIELD( 1);
+ ZyanBool accepts_REPEREPZ ZYAN_BITFIELD( 1);
+ ZyanBool accepts_REPNEREPNZ ZYAN_BITFIELD( 1);
+ ZyanBool accepts_BOUND ZYAN_BITFIELD( 1);
+ ZyanBool accepts_XACQUIRE ZYAN_BITFIELD( 1);
+ ZyanBool accepts_XRELEASE ZYAN_BITFIELD( 1);
+ ZyanBool accepts_hle_without_lock ZYAN_BITFIELD( 1);
+ ZyanBool accepts_branch_hints ZYAN_BITFIELD( 1);
+ ZyanBool accepts_segment ZYAN_BITFIELD( 1);
+#endif
+} ZydisInstructionDefinitionLEGACY;
+
+/**
+ * Defines the `ZydisInstructionDefinition3DNOW` struct.
+ */
+typedef struct ZydisInstructionDefinition3DNOW_
+{
+ ZYDIS_INSTRUCTION_DEFINITION_BASE;
+} ZydisInstructionDefinition3DNOW;
+
+/**
+ * Defines the `ZydisInstructionDefinitionXOP` struct.
+ */
+typedef struct ZydisInstructionDefinitionXOP_
+{
+ ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR;
+} ZydisInstructionDefinitionXOP;
+
+// MSVC does not correctly execute the `pragma pack(1)` compiler-directive, if we use the correct
+// enum types
+ZYAN_STATIC_ASSERT(ZYDIS_VEX_STATIC_BROADCAST_REQUIRED_BITS <= 8);
+
+/**
+ * Defines the `ZydisInstructionDefinitionVEX` struct.
+ */
+typedef struct ZydisInstructionDefinitionVEX_
+{
+ ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR_INTEL;
+#ifndef ZYDIS_MINIMAL_MODE
+ ZyanU8 broadcast ZYAN_BITFIELD(ZYDIS_VEX_STATIC_BROADCAST_REQUIRED_BITS);
+#endif
+} ZydisInstructionDefinitionVEX;
+
+#ifndef ZYDIS_DISABLE_AVX512
+
+// MSVC does not correctly execute the `pragma pack(1)` compiler-directive, if we use the correct
+// enum types
+ZYAN_STATIC_ASSERT(ZYDIS_IVECTOR_LENGTH_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_TUPLETYPE_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_IELEMENT_SIZE_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_EVEX_FUNC_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_MASK_POLICY_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_MASK_OVERRIDE_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_EVEX_STATIC_BROADCAST_REQUIRED_BITS <= 8);
+
+/**
+ * Defines the `ZydisInstructionDefinitionEVEX` struct.
+ */
+typedef struct ZydisInstructionDefinitionEVEX_
+{
+ ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR_INTEL;
+#ifndef ZYDIS_MINIMAL_MODE
+ ZyanU8 vector_length ZYAN_BITFIELD(ZYDIS_IVECTOR_LENGTH_REQUIRED_BITS);
+ ZyanU8 tuple_type ZYAN_BITFIELD(ZYDIS_TUPLETYPE_REQUIRED_BITS);
+ ZyanU8 element_size ZYAN_BITFIELD(ZYDIS_IELEMENT_SIZE_REQUIRED_BITS);
+ ZyanU8 functionality ZYAN_BITFIELD(ZYDIS_EVEX_FUNC_REQUIRED_BITS);
+#endif
+ ZyanU8 mask_policy ZYAN_BITFIELD(ZYDIS_MASK_POLICY_REQUIRED_BITS);
+ ZyanBool accepts_zero_mask ZYAN_BITFIELD( 1);
+#ifndef ZYDIS_MINIMAL_MODE
+ ZyanU8 mask_override ZYAN_BITFIELD(ZYDIS_MASK_OVERRIDE_REQUIRED_BITS);
+ ZyanU8 broadcast ZYAN_BITFIELD(ZYDIS_EVEX_STATIC_BROADCAST_REQUIRED_BITS);
+#endif
+} ZydisInstructionDefinitionEVEX;
+#endif
+
+#ifndef ZYDIS_DISABLE_KNC
+
+// MSVC does not correctly execute the `pragma pack(1)` compiler-directive, if we use the correct
+// enum types
+ZYAN_STATIC_ASSERT(ZYDIS_MVEX_FUNC_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_MASK_POLICY_REQUIRED_BITS <= 8);
+ZYAN_STATIC_ASSERT(ZYDIS_MVEX_STATIC_BROADCAST_REQUIRED_BITS <= 8);
+
+/**
+ * Defines the `ZydisInstructionDefinitionMVEX` struct.
+ */
+typedef struct ZydisInstructionDefinitionMVEX_
+{
+ ZYDIS_INSTRUCTION_DEFINITION_BASE_VECTOR_INTEL;
+ ZyanU8 functionality ZYAN_BITFIELD(ZYDIS_MVEX_FUNC_REQUIRED_BITS);
+ ZyanU8 mask_policy ZYAN_BITFIELD(ZYDIS_MASK_POLICY_REQUIRED_BITS);
+#ifndef ZYDIS_MINIMAL_MODE
+ ZyanBool has_element_granularity ZYAN_BITFIELD( 1);
+ ZyanU8 broadcast ZYAN_BITFIELD(ZYDIS_MVEX_STATIC_BROADCAST_REQUIRED_BITS);
+#endif
+} ZydisInstructionDefinitionMVEX;
+#endif
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Accessed CPU flags */
+/* ---------------------------------------------------------------------------------------------- */
+
+typedef struct ZydisAccessedFlags_
+{
+ ZydisCPUFlagAction action[ZYDIS_CPUFLAG_MAX_VALUE + 1];
+ ZyanU32 cpu_flags_read ZYAN_BITFIELD(22);
+ ZyanU32 cpu_flags_written ZYAN_BITFIELD(22);
+ ZyanU8 fpu_flags_read ZYAN_BITFIELD( 4);
+ ZyanU8 fpu_flags_written ZYAN_BITFIELD( 4);
+} ZydisAccessedFlags;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+#pragma pack(pop)
+
+#ifdef ZYAN_MSVC
+# pragma warning(pop)
+#endif
+
+/* ============================================================================================== */
+/* Functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Instruction definition */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the instruction-definition with the given `encoding` and `id`.
+ *
+ * @param encoding The instruction-encoding.
+ * @param id The definition-id.
+ * @param definition A pointer to the variable that receives a pointer to the instruction-
+ * definition.
+ */
+ZYDIS_NO_EXPORT void ZydisGetInstructionDefinition(ZydisInstructionEncoding encoding,
+ ZyanU16 id, const ZydisInstructionDefinition** definition);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Operand definition */
+/* ---------------------------------------------------------------------------------------------- */
+
+#ifndef ZYDIS_MINIMAL_MODE
+/**
+ * Returns the the operand-definitions for the given instruction-`definition`.
+ *
+ * @param definition A pointer to the instruction-definition.
+ * @param operand A pointer to the variable that receives a pointer to the first operand-
+ * definition of the instruction.
+ *
+ * @return The number of operands for the given instruction-definition.
+ */
+ZYDIS_NO_EXPORT ZyanU8 ZydisGetOperandDefinitions(const ZydisInstructionDefinition* definition,
+ const ZydisOperandDefinition** operand);
+#endif
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Element info */
+/* ---------------------------------------------------------------------------------------------- */
+
+#ifndef ZYDIS_MINIMAL_MODE
+/**
+ * Returns the actual type and size of an internal element-type.
+ *
+ * @param element The internal element type.
+ * @param type The actual element type.
+ * @param size The element size.
+ */
+ZYDIS_NO_EXPORT void ZydisGetElementInfo(ZydisInternalElementType element, ZydisElementType* type,
+ ZydisElementSize* size);
+#endif
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Accessed CPU flags */
+/* ---------------------------------------------------------------------------------------------- */
+
+#ifndef ZYDIS_MINIMAL_MODE
+/**
+ * Returns the the operand-definitions for the given instruction-`definition`.
+ *
+ * @param definition A pointer to the instruction-definition.
+ * @param flags A pointer to the variable that receives the `ZydisAccessedFlags` struct.
+ *
+ * @return `ZYAN_TRUE`, if the instruction accesses any flags, or `ZYAN_FALSE`, if not.
+ */
+ZYDIS_NO_EXPORT ZyanBool ZydisGetAccessedFlags(const ZydisInstructionDefinition* definition,
+ const ZydisAccessedFlags** flags);
+#endif
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYDIS_INTERNAL_SHAREDDATA_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/String.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/String.h
new file mode 100644
index 0000000..18ed812
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Internal/String.h
@@ -0,0 +1,464 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd, Joel Hoener
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Provides some internal, more performant, but unsafe helper functions for the `ZyanString`
+ * data-type.
+ *
+ * Most of these functions are very similar to the ones in `Zycore/String.h`, but inlined and
+ * without optional overhead like parameter-validation checks, etc ...
+ *
+ * The `ZyanString` data-type is able to dynamically allocate memory on the heap, but as `Zydis` is
+ * designed to be a non-'malloc'ing library, all functions in this file assume that the instances
+ * they are operating on are created with a user-defined static-buffer.
+ */
+
+#ifndef ZYDIS_INTERNAL_STRING_H
+#define ZYDIS_INTERNAL_STRING_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Letter Case */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisLetterCase` enum.
+ */
+typedef enum ZydisLetterCase_
+{
+ /**
+ * Uses the given text "as is".
+ */
+ ZYDIS_LETTER_CASE_DEFAULT,
+ /**
+ * Converts the given text to lowercase letters.
+ */
+ ZYDIS_LETTER_CASE_LOWER,
+ /**
+ * Converts the given text to uppercase letters.
+ */
+ ZYDIS_LETTER_CASE_UPPER,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_LETTER_CASE_MAX_VALUE = ZYDIS_LETTER_CASE_UPPER,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_LETTER_CASE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_LETTER_CASE_MAX_VALUE)
+} ZydisLetterCase;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Macros */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Internal macros */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Checks for a terminating '\0' character at the end of the string data.
+ */
+#define ZYDIS_STRING_ASSERT_NULLTERMINATION(string) \
+ ZYAN_ASSERT(*(char*)((ZyanU8*)(string)->vector.data + (string)->vector.size - 1) == '\0');
+
+/**
+ * Writes a terminating '\0' character at the end of the string data.
+ */
+#define ZYDIS_STRING_NULLTERMINATE(string) \
+ *(char*)((ZyanU8*)(string)->vector.data + (string)->vector.size - 1) = '\0';
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Internal Functions */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Appending */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Appends the content of the source string to the end of the destination string.
+ *
+ * @param destination The destination string.
+ * @param source The source string.
+ *
+ * @return A zyan status code.
+ */
+ZYAN_INLINE ZyanStatus ZydisStringAppend(ZyanString* destination, const ZyanStringView* source)
+{
+ ZYAN_ASSERT(destination && source);
+ ZYAN_ASSERT(!destination->vector.allocator);
+ ZYAN_ASSERT(destination->vector.size && source->string.vector.size);
+
+ if (destination->vector.size + source->string.vector.size - 1 > destination->vector.capacity)
+ {
+ return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
+ }
+
+ ZYAN_MEMCPY((char*)destination->vector.data + destination->vector.size - 1,
+ source->string.vector.data, source->string.vector.size - 1);
+
+ destination->vector.size += source->string.vector.size - 1;
+ ZYDIS_STRING_NULLTERMINATE(destination);
+
+ return ZYAN_STATUS_SUCCESS;
+}
+
+/**
+ * Appends the content of the source string to the end of the destination
+ * string, converting the characters to the specified letter-case.
+ *
+ * @param destination The destination string.
+ * @param source The source string.
+ * @param letter_case The desired letter-case.
+ *
+ * @return A zyan status code.
+ */
+ZYAN_INLINE ZyanStatus ZydisStringAppendCase(ZyanString* destination, const ZyanStringView* source,
+ ZydisLetterCase letter_case)
+{
+ ZYAN_ASSERT(destination && source);
+ ZYAN_ASSERT(!destination->vector.allocator);
+ ZYAN_ASSERT(destination->vector.size && source->string.vector.size);
+
+ if (destination->vector.size + source->string.vector.size - 1 > destination->vector.capacity)
+ {
+ return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
+ }
+
+ ZYAN_MEMCPY((char*)destination->vector.data + destination->vector.size - 1,
+ source->string.vector.data, source->string.vector.size - 1);
+
+ switch (letter_case)
+ {
+ case ZYDIS_LETTER_CASE_DEFAULT:
+ break;
+ case ZYDIS_LETTER_CASE_LOWER:
+ {
+ const ZyanUSize index = destination->vector.size - 1;
+ const ZyanUSize count = source->string.vector.size - 1;
+ char* s = (char*)destination->vector.data + index;
+ for (ZyanUSize i = index; i < index + count; ++i)
+ {
+ const char c = *s;
+ if ((c >= 'A') && (c <= 'Z'))
+ {
+ *s = c | 32;
+ }
+ ++s;
+ }
+ break;
+ }
+ case ZYDIS_LETTER_CASE_UPPER:
+ {
+ const ZyanUSize index = destination->vector.size - 1;
+ const ZyanUSize count = source->string.vector.size - 1;
+ char* s = (char*)destination->vector.data + index;
+ for (ZyanUSize i = index; i < index + count; ++i)
+ {
+ const char c = *s;
+ if ((c >= 'a') && (c <= 'z'))
+ {
+ *s = c & ~32;
+ }
+ ++s;
+ }
+ break;
+ }
+ default:
+ ZYAN_UNREACHABLE;
+ }
+
+ destination->vector.size += source->string.vector.size - 1;
+ ZYDIS_STRING_NULLTERMINATE(destination);
+
+ return ZYAN_STATUS_SUCCESS;
+}
+
+/**
+ * Appends the content of the source short-string to the end of the destination string.
+ *
+ * @param destination The destination string.
+ * @param source The source string.
+ *
+ * @return A zyan status code.
+ */
+ZYAN_INLINE ZyanStatus ZydisStringAppendShort(ZyanString* destination,
+ const ZydisShortString* source)
+{
+ ZYAN_ASSERT(destination && source);
+ ZYAN_ASSERT(!destination->vector.allocator);
+ ZYAN_ASSERT(destination->vector.size && source->size);
+
+ if (destination->vector.size + source->size > destination->vector.capacity)
+ {
+ return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
+ }
+
+ ZYAN_MEMCPY((char*)destination->vector.data + destination->vector.size - 1, source->data,
+ (ZyanUSize)source->size + 1);
+
+ destination->vector.size += source->size;
+ ZYDIS_STRING_ASSERT_NULLTERMINATION(destination);
+
+ return ZYAN_STATUS_SUCCESS;
+}
+
+/**
+ * Appends the content of the source short-string to the end of the destination string,
+ * converting the characters to the specified letter-case.
+ *
+ * @param destination The destination string.
+ * @param source The source string.
+ * @param letter_case The desired letter-case.
+ *
+ * @return A zyan status code.
+ */
+ZYAN_INLINE ZyanStatus ZydisStringAppendShortCase(ZyanString* destination,
+ const ZydisShortString* source, ZydisLetterCase letter_case)
+{
+ ZYAN_ASSERT(destination && source);
+ ZYAN_ASSERT(!destination->vector.allocator);
+ ZYAN_ASSERT(destination->vector.size && source->size);
+
+ if (destination->vector.size + source->size > destination->vector.capacity)
+ {
+ return ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE;
+ }
+
+ ZYAN_MEMCPY((char*)destination->vector.data + destination->vector.size - 1, source->data,
+ (ZyanUSize)source->size + 1);
+
+ switch (letter_case)
+ {
+ case ZYDIS_LETTER_CASE_DEFAULT:
+ break;
+ case ZYDIS_LETTER_CASE_LOWER:
+ {
+ const ZyanUSize index = destination->vector.size - 1;
+ const ZyanUSize count = source->size;
+ char* s = (char*)destination->vector.data + index;
+ for (ZyanUSize i = index; i < index + count; ++i)
+ {
+ const char c = *s;
+ if ((c >= 'A') && (c <= 'Z'))
+ {
+ *s = c | 32;
+ }
+ ++s;
+ }
+ break;
+ }
+ case ZYDIS_LETTER_CASE_UPPER:
+ {
+ const ZyanUSize index = destination->vector.size - 1;
+ const ZyanUSize count = source->size;
+ char* s = (char*)destination->vector.data + index;
+ for (ZyanUSize i = index; i < index + count; ++i)
+ {
+ const char c = *s;
+ if ((c >= 'a') && (c <= 'z'))
+ {
+ *s = c & ~32;
+ }
+ ++s;
+ }
+ break;
+ }
+ default:
+ ZYAN_UNREACHABLE;
+ }
+
+ destination->vector.size += source->size;
+ ZYDIS_STRING_ASSERT_NULLTERMINATION(destination);
+
+ return ZYAN_STATUS_SUCCESS;
+}
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Formatting */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Formats the given unsigned ordinal `value` to its decimal text-representation and
+ * appends it to the `string`.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param value The value.
+ * @param padding_length Padds the converted value with leading zeros, if the number of chars is
+ * less than the `padding_length`.
+ * @param prefix The string to use as prefix or `ZYAN_NULL`, if not needed.
+ * @param suffix The string to use as suffix or `ZYAN_NULL`, if not needed.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZyanStatus ZydisStringAppendDecU(ZyanString* string, ZyanU64 value, ZyanU8 padding_length,
+ const ZyanStringView* prefix, const ZyanStringView* suffix);
+
+/**
+ * Formats the given signed ordinal `value` to its decimal text-representation and
+ * appends it to the `string`.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param value The value.
+ * @param padding_length Padds the converted value with leading zeros, if the number of chars is
+ * less than the `padding_length`.
+ * @param force_sign Set `ZYAN_TRUE`, to force printing of the `+` sign for positive numbers.
+ * @param prefix The string to use as prefix or `ZYAN_NULL`, if not needed.
+ * @param suffix The string to use as suffix or `ZYAN_NULL`, if not needed.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZYAN_INLINE ZyanStatus ZydisStringAppendDecS(ZyanString* string, ZyanI64 value,
+ ZyanU8 padding_length, ZyanBool force_sign, const ZyanStringView* prefix,
+ const ZyanStringView* suffix)
+{
+ static const ZydisShortString str_add = ZYDIS_MAKE_SHORTSTRING("+");
+ static const ZydisShortString str_sub = ZYDIS_MAKE_SHORTSTRING("-");
+
+ if (value < 0)
+ {
+ ZYAN_CHECK(ZydisStringAppendShort(string, &str_sub));
+ if (prefix)
+ {
+ ZYAN_CHECK(ZydisStringAppend(string, prefix));
+ }
+ return ZydisStringAppendDecU(string, ZyanAbsI64(value), padding_length,
+ (const ZyanStringView*)ZYAN_NULL, suffix);
+ }
+
+ if (force_sign)
+ {
+ ZYAN_ASSERT(value >= 0);
+ ZYAN_CHECK(ZydisStringAppendShort(string, &str_add));
+ }
+ return ZydisStringAppendDecU(string, value, padding_length, prefix, suffix);
+}
+
+/**
+ * Formats the given unsigned ordinal `value` to its hexadecimal text-representation and
+ * appends it to the `string`.
+ *
+ * @param string A pointer to the `ZyanString` instance.
+ * @param value The value.
+ * @param padding_length Padds the converted value with leading zeros, if the number of chars is
+ * less than the `padding_length`.
+ * @param uppercase Set `ZYAN_TRUE` to use uppercase letters ('A'-'F') instead of lowercase
+ * ones ('a'-'f').
+ * @param prefix The string to use as prefix or `ZYAN_NULL`, if not needed.
+ * @param suffix The string to use as suffix or `ZYAN_NULL`, if not needed.
+ *
+ * @return A zyan status code.
+ *
+ * This function will fail, if the `ZYAN_STRING_IS_IMMUTABLE` flag is set for the specified
+ * `ZyanString` instance.
+ */
+ZyanStatus ZydisStringAppendHexU(ZyanString* string, ZyanU64 value, ZyanU8 padding_length,
+ ZyanBool uppercase, const ZyanStringView* prefix, const ZyanStringView* suffix);
+
+/**
+ * Formats the given signed ordinal `value` to its hexadecimal text-representation and
+ * appends it to the `string`.
+ *
+ * @param string A pointer to the string.
+ * @param value The value.
+ * @param padding_length Padds the converted value with leading zeros, if the number of chars is
+ * less than the `padding_length` (the sign char is ignored).
+ * @param uppercase Set `ZYAN_TRUE` to print the hexadecimal value in uppercase letters
+ * instead of lowercase ones.
+ * @param force_sign Set to `ZYAN_TRUE`, to force printing of the `+` sign for positive
+ * numbers.
+ * @param prefix The string to use as prefix or `NULL`, if not needed.
+ * @param suffix The string to use as suffix or `NULL`, if not needed.
+ *
+ * @return `ZYAN_STATUS_SUCCESS`, if the function succeeded, or
+ * `ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE`, if the size of the buffer was not
+ * sufficient to append the given `value`.
+ *
+ * The string-buffer pointer is increased by the number of chars written, if the call was
+ * successful.
+ */
+ZYAN_INLINE ZyanStatus ZydisStringAppendHexS(ZyanString* string, ZyanI64 value,
+ ZyanU8 padding_length, ZyanBool uppercase, ZyanBool force_sign, const ZyanStringView* prefix,
+ const ZyanStringView* suffix)
+{
+ static const ZydisShortString str_add = ZYDIS_MAKE_SHORTSTRING("+");
+ static const ZydisShortString str_sub = ZYDIS_MAKE_SHORTSTRING("-");
+
+ if (value < 0)
+ {
+ ZYAN_CHECK(ZydisStringAppendShort(string, &str_sub));
+ if (prefix)
+ {
+ ZYAN_CHECK(ZydisStringAppend(string, prefix));
+ }
+ return ZydisStringAppendHexU(string, ZyanAbsI64(value), padding_length, uppercase,
+ (const ZyanStringView*)ZYAN_NULL, suffix);
+ }
+
+ if (force_sign)
+ {
+ ZYAN_ASSERT(value >= 0);
+ ZYAN_CHECK(ZydisStringAppendShort(string, &str_add));
+ }
+ return ZydisStringAppendHexU(string, value, padding_length, uppercase, prefix, suffix);
+}
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ZYDIS_INTERNAL_STRING_H
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/MetaInfo.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/MetaInfo.h
new file mode 100644
index 0000000..6867d32
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/MetaInfo.h
@@ -0,0 +1,88 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * @brief
+ */
+
+#ifndef ZYDIS_METAINFO_H
+#define ZYDIS_METAINFO_H
+
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+#include
+#include
+#include
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+ /**
+ * Returns the specified instruction category string.
+ *
+ * @param category The instruction category.
+ *
+ * @return The instruction category string or `ZYAN_NULL`, if an invalid category was passed.
+ */
+ZYDIS_EXPORT const char* ZydisCategoryGetString(ZydisInstructionCategory category);
+
+/**
+ * Returns the specified isa-set string.
+ *
+ * @param isa_set The isa-set.
+ *
+ * @return The isa-set string or `ZYAN_NULL`, if an invalid isa-set was passed.
+ */
+ZYDIS_EXPORT const char* ZydisISASetGetString(ZydisISASet isa_set);
+
+/**
+ * Returns the specified isa-extension string.
+ *
+ * @param isa_ext The isa-extension.
+ *
+ * @return The isa-extension string or `ZYAN_NULL`, if an invalid isa-extension was passed.
+ */
+ZYDIS_EXPORT const char* ZydisISAExtGetString(ZydisISAExt isa_ext);
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYDIS_METAINFO_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Mnemonic.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Mnemonic.h
new file mode 100644
index 0000000..dd8fec8
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Mnemonic.h
@@ -0,0 +1,88 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Mnemonic constant definitions and helper functions.
+ */
+
+#ifndef ZYDIS_MNEMONIC_H
+#define ZYDIS_MNEMONIC_H
+
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+#include
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/**
+ * @addtogroup mnemonic Mnemonic
+ * Functions for retrieving mnemonic names.
+ * @{
+ */
+
+/**
+ * Returns the specified instruction mnemonic string.
+ *
+ * @param mnemonic The mnemonic.
+ *
+ * @return The instruction mnemonic string or `ZYAN_NULL`, if an invalid mnemonic was passed.
+ */
+ZYDIS_EXPORT const char* ZydisMnemonicGetString(ZydisMnemonic mnemonic);
+
+/**
+ * Returns the specified instruction mnemonic as `ZydisShortString`.
+ *
+ * @param mnemonic The mnemonic.
+ *
+ * @return The instruction mnemonic string or `ZYAN_NULL`, if an invalid mnemonic was passed.
+ *
+ * The `buffer` of the returned struct is guaranteed to be zero-terminated in this special case.
+ */
+ZYDIS_EXPORT const ZydisShortString* ZydisMnemonicGetStringWrapped(ZydisMnemonic mnemonic);
+
+/**
+ * @}
+ */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYDIS_MNEMONIC_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Register.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Register.h
new file mode 100644
index 0000000..0ff955f
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Register.h
@@ -0,0 +1,293 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Utility functions and constants for registers.
+ */
+
+#ifndef ZYDIS_REGISTER_H
+#define ZYDIS_REGISTER_H
+
+#include
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Registers */
+/* ---------------------------------------------------------------------------------------------- */
+
+#include
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Register classes */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisRegisterClass` enum.
+ *
+ * Please note that this enum does not contain a matching entry for all values of the
+ * `ZydisRegister` enum, but only for those registers where it makes sense to logically group them
+ * for decoding/encoding purposes.
+ *
+ * These are mainly the registers that can be identified by an id within their corresponding
+ * register-class. The `IP` and `FLAGS` values are exceptions to this rule.
+ */
+typedef enum ZydisRegisterClass_
+{
+ ZYDIS_REGCLASS_INVALID,
+ /**
+ * 8-bit general-purpose registers.
+ */
+ ZYDIS_REGCLASS_GPR8,
+ /**
+ * 16-bit general-purpose registers.
+ */
+ ZYDIS_REGCLASS_GPR16,
+ /**
+ * 32-bit general-purpose registers.
+ */
+ ZYDIS_REGCLASS_GPR32,
+ /**
+ * 64-bit general-purpose registers.
+ */
+ ZYDIS_REGCLASS_GPR64,
+ /**
+ * Floating point legacy registers.
+ */
+ ZYDIS_REGCLASS_X87,
+ /**
+ * Floating point multimedia registers.
+ */
+ ZYDIS_REGCLASS_MMX,
+ /**
+ * 128-bit vector registers.
+ */
+ ZYDIS_REGCLASS_XMM,
+ /**
+ * 256-bit vector registers.
+ */
+ ZYDIS_REGCLASS_YMM,
+ /**
+ * 512-bit vector registers.
+ */
+ ZYDIS_REGCLASS_ZMM,
+ /**
+ * Matrix registers.
+ */
+ ZYDIS_REGCLASS_TMM,
+ /*
+ * Flags registers.
+ */
+ ZYDIS_REGCLASS_FLAGS,
+ /**
+ * Instruction-pointer registers.
+ */
+ ZYDIS_REGCLASS_IP,
+ /**
+ * Segment registers.
+ */
+ ZYDIS_REGCLASS_SEGMENT,
+ /**
+ * Test registers.
+ */
+ ZYDIS_REGCLASS_TEST,
+ /**
+ * Control registers.
+ */
+ ZYDIS_REGCLASS_CONTROL,
+ /**
+ * Debug registers.
+ */
+ ZYDIS_REGCLASS_DEBUG,
+ /**
+ * Mask registers.
+ */
+ ZYDIS_REGCLASS_MASK,
+ /**
+ * Bound registers.
+ */
+ ZYDIS_REGCLASS_BOUND,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_REGCLASS_MAX_VALUE = ZYDIS_REGCLASS_BOUND,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_REGCLASS_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_REGCLASS_MAX_VALUE)
+} ZydisRegisterClass;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Register width */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisRegisterWidth` data-type.
+ */
+typedef ZyanU16 ZydisRegisterWidth;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Register context */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisRegisterContext` struct.
+ */
+typedef struct ZydisRegisterContext_
+{
+ /**
+ * The values stored in the register context.
+ */
+ ZyanU64 values[ZYDIS_REGISTER_MAX_VALUE + 1];
+} ZydisRegisterContext;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/**
+ * @addtogroup register Register
+ * Functions allowing retrieval of information about registers.
+ * @{
+ */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Register */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the register specified by the `register_class` and `id` tuple.
+ *
+ * @param register_class The register class.
+ * @param id The register id.
+ *
+ * @return The register specified by the `register_class` and `id` tuple or `ZYDIS_REGISTER_NONE`,
+ * if an invalid parameter was passed.
+ */
+ZYDIS_EXPORT ZydisRegister ZydisRegisterEncode(ZydisRegisterClass register_class, ZyanU8 id);
+
+/**
+ * Returns the id of the specified register.
+ *
+ * @param reg The register.
+ *
+ * @return The id of the specified register, or -1 if an invalid parameter was passed.
+ */
+ZYDIS_EXPORT ZyanI8 ZydisRegisterGetId(ZydisRegister reg);
+
+/**
+ * Returns the register-class of the specified register.
+ *
+ * @param reg The register.
+ *
+ * @return The register-class of the specified register.
+ */
+ZYDIS_EXPORT ZydisRegisterClass ZydisRegisterGetClass(ZydisRegister reg);
+
+/**
+ * Returns the width of the specified register.
+ *
+ * @param mode The active machine mode.
+ * @param reg The register.
+ *
+ * @return The width of the specified register, or `ZYDIS_REGISTER_NONE` if the register is
+ * invalid for the active machine-mode.
+ */
+ZYDIS_EXPORT ZydisRegisterWidth ZydisRegisterGetWidth(ZydisMachineMode mode, ZydisRegister reg);
+
+/**
+ * Returns the largest enclosing register of the given register.
+ *
+ * @param mode The active machine mode.
+ * @param reg The register.
+ *
+ * @return The largest enclosing register of the given register, or `ZYDIS_REGISTER_NONE` if the
+ * register is invalid for the active machine-mode or does not have an enclosing-register.
+ */
+ZYDIS_EXPORT ZydisRegister ZydisRegisterGetLargestEnclosing(ZydisMachineMode mode,
+ ZydisRegister reg);
+
+/**
+ * Returns the specified register string.
+ *
+ * @param reg The register.
+ *
+ * @return The register string or `ZYAN_NULL`, if an invalid register was passed.
+ */
+ZYDIS_EXPORT const char* ZydisRegisterGetString(ZydisRegister reg);
+
+/**
+ * Returns the specified register string as `ZydisShortString`.
+ *
+ * @param reg The register.
+ *
+ * @return The register string or `ZYAN_NULL`, if an invalid register was passed.
+ *
+ * The `buffer` of the returned struct is guaranteed to be zero-terminated in this special case.
+ */
+ZYDIS_EXPORT const ZydisShortString* ZydisRegisterGetStringWrapped(ZydisRegister reg);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Register class */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns the width of the specified register-class.
+ *
+ * @param mode The active machine mode.
+ * @param register_class The register class.
+ *
+ * @return The width of the specified register.
+ */
+ZYDIS_EXPORT ZydisRegisterWidth ZydisRegisterClassGetWidth(ZydisMachineMode mode,
+ ZydisRegisterClass register_class);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * @}
+ */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYDIS_REGISTER_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/SharedTypes.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/SharedTypes.h
new file mode 100644
index 0000000..82a4121
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/SharedTypes.h
@@ -0,0 +1,480 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Defines decoder/encoder-shared macros and types.
+ */
+
+#ifndef ZYDIS_SHAREDTYPES_H
+#define ZYDIS_SHAREDTYPES_H
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Macros */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Constants */
+/* ---------------------------------------------------------------------------------------------- */
+
+#define ZYDIS_MAX_INSTRUCTION_LENGTH 15
+#define ZYDIS_MAX_OPERAND_COUNT 10
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Machine mode */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisMachineMode` enum.
+ */
+typedef enum ZydisMachineMode_
+{
+ /**
+ * 64 bit mode.
+ */
+ ZYDIS_MACHINE_MODE_LONG_64,
+ /**
+ * 32 bit protected mode.
+ */
+ ZYDIS_MACHINE_MODE_LONG_COMPAT_32,
+ /**
+ * 16 bit protected mode.
+ */
+ ZYDIS_MACHINE_MODE_LONG_COMPAT_16,
+ /**
+ * 32 bit protected mode.
+ */
+ ZYDIS_MACHINE_MODE_LEGACY_32,
+ /**
+ * 16 bit protected mode.
+ */
+ ZYDIS_MACHINE_MODE_LEGACY_16,
+ /**
+ * 16 bit real mode.
+ */
+ ZYDIS_MACHINE_MODE_REAL_16,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_MACHINE_MODE_MAX_VALUE = ZYDIS_MACHINE_MODE_REAL_16,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_MACHINE_MODE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_MACHINE_MODE_MAX_VALUE)
+} ZydisMachineMode;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Address width */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisAddressWidth` enum.
+ */
+typedef enum ZydisAddressWidth_
+{
+ ZYDIS_ADDRESS_WIDTH_16,
+ ZYDIS_ADDRESS_WIDTH_32,
+ ZYDIS_ADDRESS_WIDTH_64,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_ADDRESS_WIDTH_MAX_VALUE = ZYDIS_ADDRESS_WIDTH_64,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_ADDRESS_WIDTH_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_ADDRESS_WIDTH_MAX_VALUE)
+} ZydisAddressWidth;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Element type */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisElementType` enum.
+ */
+typedef enum ZydisElementType_
+{
+ ZYDIS_ELEMENT_TYPE_INVALID,
+ /**
+ * A struct type.
+ */
+ ZYDIS_ELEMENT_TYPE_STRUCT,
+ /**
+ * Unsigned integer value.
+ */
+ ZYDIS_ELEMENT_TYPE_UINT,
+ /**
+ * Signed integer value.
+ */
+ ZYDIS_ELEMENT_TYPE_INT,
+ /**
+ * 16-bit floating point value (`half`).
+ */
+ ZYDIS_ELEMENT_TYPE_FLOAT16,
+ /**
+ * 32-bit floating point value (`single`).
+ */
+ ZYDIS_ELEMENT_TYPE_FLOAT32,
+ /**
+ * 64-bit floating point value (`double`).
+ */
+ ZYDIS_ELEMENT_TYPE_FLOAT64,
+ /**
+ * 80-bit floating point value (`extended`).
+ */
+ ZYDIS_ELEMENT_TYPE_FLOAT80,
+ /**
+ * Binary coded decimal value.
+ */
+ ZYDIS_ELEMENT_TYPE_LONGBCD,
+ /**
+ * A condition code (e.g. used by `CMPPD`, `VCMPPD`, ...).
+ */
+ ZYDIS_ELEMENT_TYPE_CC,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_ELEMENT_TYPE_MAX_VALUE = ZYDIS_ELEMENT_TYPE_CC,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_ELEMENT_TYPE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_ELEMENT_TYPE_MAX_VALUE)
+} ZydisElementType;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Element size */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisElementSize` datatype.
+ */
+typedef ZyanU16 ZydisElementSize;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Operand type */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisOperandType` enum.
+ */
+typedef enum ZydisOperandType_
+{
+ /**
+ * The operand is not used.
+ */
+ ZYDIS_OPERAND_TYPE_UNUSED,
+ /**
+ * The operand is a register operand.
+ */
+ ZYDIS_OPERAND_TYPE_REGISTER,
+ /**
+ * The operand is a memory operand.
+ */
+ ZYDIS_OPERAND_TYPE_MEMORY,
+ /**
+ * The operand is a pointer operand with a segment:offset lvalue.
+ */
+ ZYDIS_OPERAND_TYPE_POINTER,
+ /**
+ * The operand is an immediate operand.
+ */
+ ZYDIS_OPERAND_TYPE_IMMEDIATE,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_OPERAND_TYPE_MAX_VALUE = ZYDIS_OPERAND_TYPE_IMMEDIATE,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_OPERAND_TYPE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_OPERAND_TYPE_MAX_VALUE)
+} ZydisOperandType;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Operand encoding */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisOperandEncoding` enum.
+ */
+typedef enum ZydisOperandEncoding_
+{
+ ZYDIS_OPERAND_ENCODING_NONE,
+ ZYDIS_OPERAND_ENCODING_MODRM_REG,
+ ZYDIS_OPERAND_ENCODING_MODRM_RM,
+ ZYDIS_OPERAND_ENCODING_OPCODE,
+ ZYDIS_OPERAND_ENCODING_NDSNDD,
+ ZYDIS_OPERAND_ENCODING_IS4,
+ ZYDIS_OPERAND_ENCODING_MASK,
+ ZYDIS_OPERAND_ENCODING_DISP8,
+ ZYDIS_OPERAND_ENCODING_DISP16,
+ ZYDIS_OPERAND_ENCODING_DISP32,
+ ZYDIS_OPERAND_ENCODING_DISP64,
+ ZYDIS_OPERAND_ENCODING_DISP16_32_64,
+ ZYDIS_OPERAND_ENCODING_DISP32_32_64,
+ ZYDIS_OPERAND_ENCODING_DISP16_32_32,
+ ZYDIS_OPERAND_ENCODING_UIMM8,
+ ZYDIS_OPERAND_ENCODING_UIMM16,
+ ZYDIS_OPERAND_ENCODING_UIMM32,
+ ZYDIS_OPERAND_ENCODING_UIMM64,
+ ZYDIS_OPERAND_ENCODING_UIMM16_32_64,
+ ZYDIS_OPERAND_ENCODING_UIMM32_32_64,
+ ZYDIS_OPERAND_ENCODING_UIMM16_32_32,
+ ZYDIS_OPERAND_ENCODING_SIMM8,
+ ZYDIS_OPERAND_ENCODING_SIMM16,
+ ZYDIS_OPERAND_ENCODING_SIMM32,
+ ZYDIS_OPERAND_ENCODING_SIMM64,
+ ZYDIS_OPERAND_ENCODING_SIMM16_32_64,
+ ZYDIS_OPERAND_ENCODING_SIMM32_32_64,
+ ZYDIS_OPERAND_ENCODING_SIMM16_32_32,
+ ZYDIS_OPERAND_ENCODING_JIMM8,
+ ZYDIS_OPERAND_ENCODING_JIMM16,
+ ZYDIS_OPERAND_ENCODING_JIMM32,
+ ZYDIS_OPERAND_ENCODING_JIMM64,
+ ZYDIS_OPERAND_ENCODING_JIMM16_32_64,
+ ZYDIS_OPERAND_ENCODING_JIMM32_32_64,
+ ZYDIS_OPERAND_ENCODING_JIMM16_32_32,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_OPERAND_ENCODING_MAX_VALUE = ZYDIS_OPERAND_ENCODING_JIMM16_32_32,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_OPERAND_ENCODING_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_OPERAND_ENCODING_MAX_VALUE)
+} ZydisOperandEncoding;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Operand visibility */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisOperandVisibility` enum.
+ */
+typedef enum ZydisOperandVisibility_
+{
+ ZYDIS_OPERAND_VISIBILITY_INVALID,
+ /**
+ * The operand is explicitly encoded in the instruction.
+ */
+ ZYDIS_OPERAND_VISIBILITY_EXPLICIT,
+ /**
+ * The operand is part of the opcode, but listed as an operand.
+ */
+ ZYDIS_OPERAND_VISIBILITY_IMPLICIT,
+ /**
+ * The operand is part of the opcode, and not typically listed as an operand.
+ */
+ ZYDIS_OPERAND_VISIBILITY_HIDDEN,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_OPERAND_VISIBILITY_MAX_VALUE = ZYDIS_OPERAND_VISIBILITY_HIDDEN,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_OPERAND_VISIBILITY_REQUIRED_BITS =
+ ZYAN_BITS_TO_REPRESENT(ZYDIS_OPERAND_VISIBILITY_MAX_VALUE)
+} ZydisOperandVisibility;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Operand action */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisOperandAction` enum.
+ */
+typedef enum ZydisOperandAction_
+{
+ /* ------------------------------------------------------------------------------------------ */
+ /* Elemental actions */
+ /* ------------------------------------------------------------------------------------------ */
+
+ /**
+ * The operand is read by the instruction.
+ */
+ ZYDIS_OPERAND_ACTION_READ = 0x01,
+ /**
+ * The operand is written by the instruction (must write).
+ */
+ ZYDIS_OPERAND_ACTION_WRITE = 0x02,
+ /**
+ * The operand is conditionally read by the instruction.
+ */
+ ZYDIS_OPERAND_ACTION_CONDREAD = 0x04,
+ /**
+ * The operand is conditionally written by the instruction (may write).
+ */
+ ZYDIS_OPERAND_ACTION_CONDWRITE = 0x08,
+
+ /* ------------------------------------------------------------------------------------------ */
+ /* Combined actions */
+ /* ------------------------------------------------------------------------------------------ */
+
+ /**
+ * The operand is read (must read) and written by the instruction (must write).
+ */
+ ZYDIS_OPERAND_ACTION_READWRITE = ZYDIS_OPERAND_ACTION_READ | ZYDIS_OPERAND_ACTION_WRITE,
+ /**
+ * The operand is conditionally read (may read) and conditionally written by
+ * the instruction (may write).
+ */
+ ZYDIS_OPERAND_ACTION_CONDREAD_CONDWRITE =
+ ZYDIS_OPERAND_ACTION_CONDREAD | ZYDIS_OPERAND_ACTION_CONDWRITE,
+ /**
+ * The operand is read (must read) and conditionally written by the
+ * instruction (may write).
+ */
+ ZYDIS_OPERAND_ACTION_READ_CONDWRITE =
+ ZYDIS_OPERAND_ACTION_READ | ZYDIS_OPERAND_ACTION_CONDWRITE,
+ /**
+ * The operand is written (must write) and conditionally read by the
+ * instruction (may read).
+ */
+ ZYDIS_OPERAND_ACTION_CONDREAD_WRITE =
+ ZYDIS_OPERAND_ACTION_CONDREAD | ZYDIS_OPERAND_ACTION_WRITE,
+
+ /**
+ * Mask combining all reading access flags.
+ */
+ ZYDIS_OPERAND_ACTION_MASK_READ = ZYDIS_OPERAND_ACTION_READ | ZYDIS_OPERAND_ACTION_CONDREAD,
+ /**
+ * Mask combining all writing access flags.
+ */
+ ZYDIS_OPERAND_ACTION_MASK_WRITE = ZYDIS_OPERAND_ACTION_WRITE | ZYDIS_OPERAND_ACTION_CONDWRITE,
+
+ /* ------------------------------------------------------------------------------------------ */
+
+ /**
+ * The minimum number of bits required to represent all values of this bitset.
+ */
+ ZYDIS_OPERAND_ACTION_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_OPERAND_ACTION_CONDWRITE)
+} ZydisOperandAction;
+
+/**
+ * Defines the `ZydisOperandActions` data-type.
+ */
+typedef ZyanU8 ZydisOperandActions;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Instruction encoding */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisInstructionEncoding` enum.
+ */
+typedef enum ZydisInstructionEncoding_
+{
+ /**
+ * The instruction uses the legacy encoding.
+ */
+ ZYDIS_INSTRUCTION_ENCODING_LEGACY,
+ /**
+ * The instruction uses the AMD 3DNow-encoding.
+ */
+ ZYDIS_INSTRUCTION_ENCODING_3DNOW,
+ /**
+ * The instruction uses the AMD XOP-encoding.
+ */
+ ZYDIS_INSTRUCTION_ENCODING_XOP,
+ /**
+ * The instruction uses the VEX-encoding.
+ */
+ ZYDIS_INSTRUCTION_ENCODING_VEX,
+ /**
+ * The instruction uses the EVEX-encoding.
+ */
+ ZYDIS_INSTRUCTION_ENCODING_EVEX,
+ /**
+ * The instruction uses the MVEX-encoding.
+ */
+ ZYDIS_INSTRUCTION_ENCODING_MVEX,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_INSTRUCTION_ENCODING_MAX_VALUE = ZYDIS_INSTRUCTION_ENCODING_MVEX,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_INSTRUCTION_ENCODING_REQUIRED_BITS =
+ ZYAN_BITS_TO_REPRESENT(ZYDIS_INSTRUCTION_ENCODING_MAX_VALUE)
+} ZydisInstructionEncoding;
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Opcode map */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Defines the `ZydisOpcodeMap` enum.
+ */
+typedef enum ZydisOpcodeMap_
+{
+ ZYDIS_OPCODE_MAP_DEFAULT,
+ ZYDIS_OPCODE_MAP_0F,
+ ZYDIS_OPCODE_MAP_0F38,
+ ZYDIS_OPCODE_MAP_0F3A,
+ ZYDIS_OPCODE_MAP_0F0F,
+ ZYDIS_OPCODE_MAP_XOP8,
+ ZYDIS_OPCODE_MAP_XOP9,
+ ZYDIS_OPCODE_MAP_XOPA,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_OPCODE_MAP_MAX_VALUE = ZYDIS_OPCODE_MAP_XOPA,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_OPCODE_MAP_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_OPCODE_MAP_MAX_VALUE)
+} ZydisOpcodeMap;
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYDIS_SHAREDTYPES_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/ShortString.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/ShortString.h
new file mode 100644
index 0000000..bed45af
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/ShortString.h
@@ -0,0 +1,90 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Defines the immutable and storage-efficient `ZydisShortString` struct, which
+ * is used to store strings in the generated tables.
+ */
+
+#ifndef ZYDIS_SHORTSTRING_H
+#define ZYDIS_SHORTSTRING_H
+
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+#pragma pack(push, 1)
+
+/**
+ * Defines the `ZydisShortString` struct.
+ *
+ * This compact struct is mainly used for internal string-tables to save up some bytes.
+ *
+ * All fields in this struct should be considered as "private". Any changes may lead to unexpected
+ * behavior.
+ */
+typedef struct ZydisShortString_
+{
+ /**
+ * The buffer that contains the actual (null-terminated) string.
+ */
+ const char* data;
+ /**
+ * The length (number of characters) of the string (without 0-termination).
+ */
+ ZyanU8 size;
+} ZydisShortString;
+
+#pragma pack(pop)
+
+/* ============================================================================================== */
+/* Macros */
+/* ============================================================================================== */
+
+/**
+ * Declares a `ZydisShortString` from a static C-style string.
+ *
+ * @param string The C-string constant.
+ */
+#define ZYDIS_MAKE_SHORTSTRING(string) \
+ { string, sizeof(string) - 1 }
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYDIS_SHORTSTRING_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Status.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Status.h
new file mode 100644
index 0000000..d2a75f3
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Status.h
@@ -0,0 +1,159 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Status code definitions and check macros.
+ */
+
+#ifndef ZYDIS_STATUS_H
+#define ZYDIS_STATUS_H
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Status codes */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Module IDs */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * The zydis module id.
+ */
+#define ZYAN_MODULE_ZYDIS 0x002u
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Status codes */
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Decoder */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * An attempt was made to read data from an input data-source that has no more
+ * data available.
+ */
+#define ZYDIS_STATUS_NO_MORE_DATA \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x00u)
+
+/**
+ * An general error occured while decoding the current instruction. The
+ * instruction might be undefined.
+ */
+#define ZYDIS_STATUS_DECODING_ERROR \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x01u)
+
+/**
+ * The instruction exceeded the maximum length of 15 bytes.
+ */
+#define ZYDIS_STATUS_INSTRUCTION_TOO_LONG \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x02u)
+
+/**
+ * The instruction encoded an invalid register.
+ */
+#define ZYDIS_STATUS_BAD_REGISTER \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x03u)
+
+/**
+ * A lock-prefix (F0) was found while decoding an instruction that does not
+ * support locking.
+ */
+#define ZYDIS_STATUS_ILLEGAL_LOCK \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x04u)
+
+/**
+ * A legacy-prefix (F2, F3, 66) was found while decoding a XOP/VEX/EVEX/MVEX
+ * instruction.
+ */
+#define ZYDIS_STATUS_ILLEGAL_LEGACY_PFX \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x05u)
+
+/**
+ * A rex-prefix was found while decoding a XOP/VEX/EVEX/MVEX instruction.
+ */
+#define ZYDIS_STATUS_ILLEGAL_REX \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x06u)
+
+/**
+ * An invalid opcode-map value was found while decoding a XOP/VEX/EVEX/MVEX-prefix.
+ */
+#define ZYDIS_STATUS_INVALID_MAP \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x07u)
+
+/**
+ * An error occured while decoding the EVEX-prefix.
+ */
+#define ZYDIS_STATUS_MALFORMED_EVEX \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x08u)
+
+/**
+ * An error occured while decoding the MVEX-prefix.
+ */
+#define ZYDIS_STATUS_MALFORMED_MVEX \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x09u)
+
+/**
+ * An invalid write-mask was specified for an EVEX/MVEX instruction.
+ */
+#define ZYDIS_STATUS_INVALID_MASK \
+ ZYAN_MAKE_STATUS(1u, ZYAN_MODULE_ZYDIS, 0x0Au)
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Formatter */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returning this status code in some specified formatter callbacks will cause
+ * the formatter to omit the corresponding token.
+ *
+ * Valid callbacks:
+ * - `ZYDIS_FORMATTER_FUNC_PRE_OPERAND`
+ * - `ZYDIS_FORMATTER_FUNC_POST_OPERAND`
+ * - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_REG`
+ * - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_MEM`
+ * - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_PTR`
+ * - `ZYDIS_FORMATTER_FUNC_FORMAT_OPERAND_IMM`
+ */
+#define ZYDIS_STATUS_SKIP_TOKEN \
+ ZYAN_MAKE_STATUS(0u, ZYAN_MODULE_ZYDIS, 0x0Bu)
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYDIS_STATUS_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Utils.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Utils.h
new file mode 100644
index 0000000..aef9e96
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Utils.h
@@ -0,0 +1,275 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Other utility functions.
+ */
+
+#ifndef ZYDIS_UTILS_H
+#define ZYDIS_UTILS_H
+
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Macros */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Constants */
+/* ---------------------------------------------------------------------------------------------- */
+
+#define ZYDIS_MAX_INSTRUCTION_SEGMENT_COUNT 9
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+/**
+ * Defines the `ZydisInstructionSegment` struct.
+ */
+typedef enum ZydisInstructionSegment_
+{
+ ZYDIS_INSTR_SEGMENT_NONE,
+ /**
+ * The legacy prefixes (including ignored `REX` prefixes).
+ */
+ ZYDIS_INSTR_SEGMENT_PREFIXES,
+ /**
+ * The effective `REX` prefix byte.
+ */
+ ZYDIS_INSTR_SEGMENT_REX,
+ /**
+ * The `XOP` prefix bytes.
+ */
+ ZYDIS_INSTR_SEGMENT_XOP,
+ /**
+ * The `VEX` prefix bytes.
+ */
+ ZYDIS_INSTR_SEGMENT_VEX,
+ /**
+ * The `EVEX` prefix bytes.
+ */
+ ZYDIS_INSTR_SEGMENT_EVEX,
+ /**
+ * The `MVEX` prefix bytes.
+ */
+ ZYDIS_INSTR_SEGMENT_MVEX,
+ /**
+ * The opcode bytes.
+ */
+ ZYDIS_INSTR_SEGMENT_OPCODE,
+ /**
+ * The `ModRM` byte.
+ */
+ ZYDIS_INSTR_SEGMENT_MODRM,
+ /**
+ * The `SIB` byte.
+ */
+ ZYDIS_INSTR_SEGMENT_SIB,
+ /**
+ * The displacement bytes.
+ */
+ ZYDIS_INSTR_SEGMENT_DISPLACEMENT,
+ /**
+ * The immediate bytes.
+ */
+ ZYDIS_INSTR_SEGMENT_IMMEDIATE,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_INSTR_SEGMENT_MAX_VALUE = ZYDIS_INSTR_SEGMENT_IMMEDIATE,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_INSTR_SEGMENT_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_INSTR_SEGMENT_MAX_VALUE)
+} ZydisInstructionSegment;
+
+/**
+ * Defines the `ZydisInstructionSegments` struct.
+ */
+typedef struct ZydisInstructionSegments_
+{
+ /**
+ * The number of logical instruction segments.
+ */
+ ZyanU8 count;
+ struct
+ {
+ /**
+ * The type of the segment.
+ */
+ ZydisInstructionSegment type;
+ /**
+ * The offset of the segment relative to the start of the instruction (in bytes).
+ */
+ ZyanU8 offset;
+ /**
+ * The size of the segment, in bytes.
+ */
+ ZyanU8 size;
+ } segments[ZYDIS_MAX_INSTRUCTION_SEGMENT_COUNT];
+} ZydisInstructionSegments;
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/**
+ * @addtogroup utils Utils
+ * Miscellaneous utility functions. Address translation and other helpers.
+ * @{
+ */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Address calculation */
+/* ---------------------------------------------------------------------------------------------- */
+
+// TODO: Provide a function that works in minimal-mode and does not require a operand parameter
+
+/**
+ * Calculates the absolute address value for the given instruction operand.
+ *
+ * @param instruction A pointer to the `ZydisDecodedInstruction` struct.
+ * @param operand A pointer to the `ZydisDecodedOperand` struct.
+ * @param runtime_address The runtime address of the instruction.
+ * @param result_address A pointer to the memory that receives the absolute address.
+ *
+ * @return A zyan status code.
+ *
+ * You should use this function in the following cases:
+ * - `IMM` operands with relative address (e.g. `JMP`, `CALL`, ...)
+ * - `MEM` operands with `RIP`/`EIP`-relative address (e.g. `MOV RAX, [RIP+0x12345678]`)
+ * - `MEM` operands with absolute address (e.g. `MOV RAX, [0x12345678]`)
+ * - The displacement needs to get truncated and zero extended
+ */
+ZYDIS_EXPORT ZyanStatus ZydisCalcAbsoluteAddress(const ZydisDecodedInstruction* instruction,
+ const ZydisDecodedOperand* operand, ZyanU64 runtime_address, ZyanU64* result_address);
+
+/**
+ * Calculates the absolute address value for the given instruction operand.
+ *
+ * @param instruction A pointer to the `ZydisDecodedInstruction` struct.
+ * @param operand A pointer to the `ZydisDecodedOperand` struct.
+ * @param runtime_address The runtime address of the instruction.
+ * @param register_context A pointer to the `ZydisRegisterContext` struct.
+ * @param result_address A pointer to the memory that receives the absolute target-address.
+ *
+ * @return A zyan status code.
+ *
+ * This function behaves like `ZydisCalcAbsoluteAddress` but takes an additional register-context
+ * argument to allow calculation of addresses depending on runtime register values.
+ *
+ * Note that `IP/EIP/RIP` from the register-context will be ignored in favor of the passed
+ * runtime-address.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisCalcAbsoluteAddressEx(const ZydisDecodedInstruction* instruction,
+ const ZydisDecodedOperand* operand, ZyanU64 runtime_address,
+ const ZydisRegisterContext* register_context, ZyanU64* result_address);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Accessed CPU flags */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns a mask of accessed CPU-flags matching the given `action`.
+ *
+ * @param instruction A pointer to the `ZydisDecodedInstruction` struct.
+ * @param action The CPU-flag action.
+ * @param flags Receives the flag mask.
+ *
+ * @return A zyan status code.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisGetAccessedFlagsByAction(const ZydisDecodedInstruction* instruction,
+ ZydisCPUFlagAction action, ZydisCPUFlags* flags);
+
+/**
+ * Returns a mask of accessed CPU-flags that are read (tested) by the current instruction.
+ *
+ * DEPRECATED. This function will be removed in the next major release. Please refer to the
+ * `cpu_flags_read` or `fpu_flags_read` fields of the `ZydisDecodedInstruction` instead.
+ *
+ * @param instruction A pointer to the `ZydisDecodedInstruction` struct.
+ * @param flags Receives the flag mask.
+ *
+ * @return A zyan status code.
+ */
+ZYDIS_DEPRECATED_EXPORT ZyanStatus ZydisGetAccessedFlagsRead(
+ const ZydisDecodedInstruction* instruction, ZydisCPUFlags* flags);
+
+/**
+ * Returns a mask of accessed CPU-flags that are written (modified, undefined) by the current
+ * instruction.
+ *
+ * DEPRECATED. This function will be removed in the next major release. Please refer to the
+ * `cpu_flags_written` or `fpu_flags_written` fields of the `ZydisDecodedInstruction` instead.
+ *
+ * @param instruction A pointer to the `ZydisDecodedInstruction` struct.
+ * @param flags Receives the flag mask.
+ *
+ * @return A zyan status code.
+ */
+ZYDIS_DEPRECATED_EXPORT ZyanStatus ZydisGetAccessedFlagsWritten(
+ const ZydisDecodedInstruction* instruction, ZydisCPUFlags* flags);
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Instruction segments */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Returns offsets and sizes of all logical instruction segments (e.g. `OPCODE`,
+ * `MODRM`, ...).
+ *
+ * @param instruction A pointer to the `ZydisDecodedInstruction` struct.
+ * @param segments Receives the instruction segments information.
+ *
+ * @return A zyan status code.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisGetInstructionSegments(const ZydisDecodedInstruction* instruction,
+ ZydisInstructionSegments* segments);
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * @}
+ */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYDIS_UTILS_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Zydis.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Zydis.h
new file mode 100644
index 0000000..a0d2d87
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/Zydis/Zydis.h
@@ -0,0 +1,169 @@
+/***************************************************************************************************
+
+ Zyan Disassembler Library (Zydis)
+
+ Original Author : Florian Bernd
+
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+
+***************************************************************************************************/
+
+/**
+ * @file
+ * Master include file, including everything else.
+ */
+
+#ifndef ZYDIS_H
+#define ZYDIS_H
+
+#include
+#include
+
+#ifndef ZYDIS_DISABLE_DECODER
+# include
+# include
+#endif
+
+#ifndef ZYDIS_DISABLE_FORMATTER
+# include
+#endif
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ============================================================================================== */
+/* Macros */
+/* ============================================================================================== */
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Constants */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * A macro that defines the zydis version.
+ */
+#define ZYDIS_VERSION (ZyanU64)0x0003000100000000
+
+/* ---------------------------------------------------------------------------------------------- */
+/* Helper macros */
+/* ---------------------------------------------------------------------------------------------- */
+
+/**
+ * Extracts the major-part of the zydis version.
+ *
+ * @param version The zydis version value
+ */
+#define ZYDIS_VERSION_MAJOR(version) (ZyanU16)(((version) & 0xFFFF000000000000) >> 48)
+
+/**
+ * Extracts the minor-part of the zydis version.
+ *
+ * @param version The zydis version value
+ */
+#define ZYDIS_VERSION_MINOR(version) (ZyanU16)(((version) & 0x0000FFFF00000000) >> 32)
+
+/**
+ * Extracts the patch-part of the zydis version.
+ *
+ * @param version The zydis version value
+ */
+#define ZYDIS_VERSION_PATCH(version) (ZyanU16)(((version) & 0x00000000FFFF0000) >> 16)
+
+/**
+ * Extracts the build-part of the zydis version.
+ *
+ * @param version The zydis version value
+ */
+#define ZYDIS_VERSION_BUILD(version) (ZyanU16)((version) & 0x000000000000FFFF)
+
+/* ---------------------------------------------------------------------------------------------- */
+
+/* ============================================================================================== */
+/* Enums and types */
+/* ============================================================================================== */
+
+/**
+ * Defines the `ZydisFeature` enum.
+ */
+typedef enum ZydisFeature_
+{
+ ZYDIS_FEATURE_DECODER,
+ ZYDIS_FEATURE_FORMATTER,
+ ZYDIS_FEATURE_AVX512,
+ ZYDIS_FEATURE_KNC,
+
+ /**
+ * Maximum value of this enum.
+ */
+ ZYDIS_FEATURE_MAX_VALUE = ZYDIS_FEATURE_KNC,
+ /**
+ * The minimum number of bits required to represent all values of this enum.
+ */
+ ZYDIS_FEATURE_REQUIRED_BITS = ZYAN_BITS_TO_REPRESENT(ZYDIS_FEATURE_MAX_VALUE)
+} ZydisFeature;
+
+/* ============================================================================================== */
+/* Exported functions */
+/* ============================================================================================== */
+
+/**
+ * @addtogroup version Version
+ * Functions for checking the library version and build options.
+ * @{
+ */
+
+/**
+ * Returns the zydis version.
+ *
+ * @return The zydis version.
+ *
+ * Use the macros provided in this file to extract the major, minor, patch and build part from the
+ * returned version value.
+ */
+ZYDIS_EXPORT ZyanU64 ZydisGetVersion(void);
+
+/**
+ * Checks, if the specified feature is enabled in the current zydis library instance.
+ *
+ * @param feature The feature.
+ *
+ * @return `ZYAN_STATUS_TRUE` if the feature is enabled, `ZYAN_STATUS_FALSE` if not. Another
+ * zyan status code, if an error occured.
+ */
+ZYDIS_EXPORT ZyanStatus ZydisIsFeatureEnabled(ZydisFeature feature);
+
+/**
+ * @}
+ */
+
+/* ============================================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZYDIS_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/ZydisExportConfig.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/ZydisExportConfig.h
new file mode 100644
index 0000000..2e0b4a2
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/ZydisExportConfig.h
@@ -0,0 +1,42 @@
+
+#ifndef ZYDIS_EXPORT_H
+#define ZYDIS_EXPORT_H
+
+#ifdef ZYDIS_STATIC_DEFINE
+# define ZYDIS_EXPORT
+# define ZYDIS_NO_EXPORT
+#else
+# ifndef ZYDIS_EXPORT
+# ifdef Zydis_EXPORTS
+ /* We are building this library */
+# define ZYDIS_EXPORT __declspec(dllexport)
+# else
+ /* We are using this library */
+# define ZYDIS_EXPORT __declspec(dllimport)
+# endif
+# endif
+
+# ifndef ZYDIS_NO_EXPORT
+# define ZYDIS_NO_EXPORT
+# endif
+#endif
+
+#ifndef ZYDIS_DEPRECATED
+# define ZYDIS_DEPRECATED __declspec(deprecated)
+#endif
+
+#ifndef ZYDIS_DEPRECATED_EXPORT
+# define ZYDIS_DEPRECATED_EXPORT ZYDIS_EXPORT ZYDIS_DEPRECATED
+#endif
+
+#ifndef ZYDIS_DEPRECATED_NO_EXPORT
+# define ZYDIS_DEPRECATED_NO_EXPORT ZYDIS_NO_EXPORT ZYDIS_DEPRECATED
+#endif
+
+#if 0 /* DEFINE_NO_DEPRECATED */
+# ifndef ZYDIS_NO_DEPRECATED
+# define ZYDIS_NO_DEPRECATED
+# endif
+#endif
+
+#endif /* ZYDIS_EXPORT_H */
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit.natvis b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit.natvis
new file mode 100644
index 0000000..b73d848
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit.natvis
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+ {_small.data, s8}
+ {_large.data, s8}
+
+
+ Small
+ Large
+ External
+
+ (int)_small.type, d
+ _large.size, d
+ asmjit::String::kSSOCapacity, d
+ _large.capacity, d
+ _small.data, s8
+ _large.data, s8
+
+
+
+
+ {{ [size={_size, d} capacity={_capacity, d}] }}
+
+ _size, d
+ _capacity, d
+
+ _size
+ (($T1*)_data)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [None]
+ [Reg] {{ id={_baseId, d} group={regGroup(), d} type={regType(), d} size={opSize(), d} }}
+ [Mem] {{ baseId={memBaseId(), d} indexId={memIndexId(), d} offset={(__int64)memOffset(), d} }}
+ [Imm] {{ val={immValue(), d} hex={immValue(), X} }}
+ [Label] {{ id={_baseId} }}
+ [Unknown]
+
+ _signature, X
+ (asmjit::Operand_::OpType)opType()
+ opSize(), d
+ (asmjit::BaseReg::RegType)regType()
+ (asmjit::BaseReg::RegGroup)regGroup()
+ (asmjit::BaseReg::RegType)memBaseType()
+ (asmjit::BaseReg::RegType)memIndexType()
+ (asmjit::BaseMem::AddrType)memAddrType()
+ (bool)memRegHome()
+ _baseId
+ _data[0]
+ _data[1]
+ _data[0]
+ _data[1]
+ _data[0]
+ _data[1]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [RegValue {{ regType={regType()} indirect={isIndirect()} done={isDone()} }}]
+ [StackValue {{ indirect={isIndirect()} done={isDone()} }}]
+ [Unknown]
+
+
+ _data
+ (asmjit::Type::Id)(typeId())
+ (asmjit::BaseReg::RegType)regType()
+ regId()
+ stackOffset()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [InstNode]
+ [SectionNode]
+ [LabelNode]
+ [AlignNode]
+ [EmbedDataNode]
+ [EmbedLabelNode]
+ [EmbedLabelDeltaNode]
+ [ConstPoolNode]
+ [CommentNode]
+ [SentinelNode]
+ [JumpNode]
+ [FuncNode]
+ [FuncRetNode]
+ [InvokeNode]
+ [UnknownNode {nodeType(), d}]
+
+
+ _prev
+ _next
+
+ (asmjit::BaseNode::NodeType)_any._nodeType
+ (asmjit::BaseNode::Flags)_any._nodeFlags
+
+ _position
+ _userDataU64
+ _userDataPtr
+ _passData
+ _inlineComment, s8
+
+ ((asmjit::InstNode*)this)->_baseInst
+ _inst._opCount
+ _inst._opCapacity
+ ((asmjit::InstNode*)this)->_opArray, [_inst._opCount]
+
+ ((asmjit::SectionNode*)this)->_id
+ ((asmjit::SectionNode*)this)->_nextSection
+
+ ((asmjit::LabelNode*)this)->_id
+
+ ((asmjit::AlignNode*)this)->_alignMode
+ ((asmjit::AlignNode*)this)->_alignment
+
+ _embed._typeId, d
+ _embed._typeSize, d
+ ((asmjit::EmbedDataNode*)this)->_itemCount
+ ((asmjit::EmbedDataNode*)this)->_repeatCount
+ ((asmjit::EmbedDataNode*)this)->_inlineData
+ ((asmjit::EmbedDataNode*)this)->_externalData
+
+ ((asmjit::EmbedLabelNode*)this)->_id
+
+ ((asmjit::EmbedLabelDeltaNode*)this)->_id
+ ((asmjit::EmbedLabelDeltaNode*)this)->_baseId
+ ((asmjit::EmbedLabelDeltaNode*)this)->_dataSize
+
+ ((asmjit::ConstPoolNode*)this)->_constPool
+
+ (asmjit::SentinelNode::SentinelType)_sentinel._sentinelType
+
+ ((asmjit::JumpNode*)this)->_annotation
+
+ ((asmjit::FuncNode*)this)->_funcDetail
+ ((asmjit::FuncNode*)this)->_frame
+ ((asmjit::FuncNode*)this)->_exitNode
+ ((asmjit::FuncNode*)this)->_end
+ ((asmjit::FuncNode*)this)->_args, [((asmjit::FuncNode*)this)->_funcDetail._argCount]
+
+ ((asmjit::InvokeNode*)this)->_funcDetail
+ ((asmjit::InvokeNode*)this)->_rets, [((asmjit::InvokeNode*)this)->_funcDetail._retCount]
+ ((asmjit::InvokeNode*)this)->_args, [((asmjit::InvokeNode*)this)->_funcDetail._argCount]
+
+
+
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/asmjit-scope-begin.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/asmjit-scope-begin.h
new file mode 100644
index 0000000..6ee5050
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/asmjit-scope-begin.h
@@ -0,0 +1,35 @@
+// AsmJit - Machine code generation for C++
+//
+// * Official AsmJit Home Page: https://asmjit.com
+// * Official Github Repository: https://github.com/asmjit/asmjit
+//
+// Copyright (c) 2008-2020 The AsmJit Authors
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+#ifdef _WIN32
+ #pragma push_macro("min")
+ #pragma push_macro("max")
+
+ #ifdef min
+ #undef min
+ #endif
+
+ #ifdef max
+ #undef max
+ #endif
+#endif
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/asmjit-scope-end.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/asmjit-scope-end.h
new file mode 100644
index 0000000..447105a
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/asmjit-scope-end.h
@@ -0,0 +1,27 @@
+// AsmJit - Machine code generation for C++
+//
+// * Official AsmJit Home Page: https://asmjit.com
+// * Official Github Repository: https://github.com/asmjit/asmjit
+//
+// Copyright (c) 2008-2020 The AsmJit Authors
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+#ifdef _WIN32
+ #pragma pop_macro("min")
+ #pragma pop_macro("max")
+#endif
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/asmjit.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/asmjit.h
new file mode 100644
index 0000000..400426c
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/asmjit.h
@@ -0,0 +1,37 @@
+// AsmJit - Machine code generation for C++
+//
+// * Official AsmJit Home Page: https://asmjit.com
+// * Official Github Repository: https://github.com/asmjit/asmjit
+//
+// Copyright (c) 2008-2020 The AsmJit Authors
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+#ifndef ASMJIT_ASMJIT_H_INCLUDED
+#define ASMJIT_ASMJIT_H_INCLUDED
+
+#include "./core.h"
+
+#ifdef ASMJIT_BUILD_X86
+ #include "./x86.h"
+#endif
+
+#ifdef ASMJIT_BUILD_ARM
+ #include "./arm.h"
+#endif
+
+#endif // ASMJIT_ASMJIT_H_INCLUDED
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core.h
new file mode 100644
index 0000000..52540ab
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core.h
@@ -0,0 +1,2063 @@
+// AsmJit - Machine code generation for C++
+//
+// * Official AsmJit Home Page: https://asmjit.com
+// * Official Github Repository: https://github.com/asmjit/asmjit
+//
+// Copyright (c) 2008-2020 The AsmJit Authors
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+#ifndef ASMJIT_CORE_H_INCLUDED
+#define ASMJIT_CORE_H_INCLUDED
+
+//! Root namespace used by AsmJit.
+namespace asmjit {
+
+// ============================================================================
+// [Documentation - mainpage]
+// ============================================================================
+
+//! \mainpage API Reference
+//!
+//! AsmJit C++ API reference documentation generated by Doxygen.
+//!
+//! AsmJit library uses one global namespace called \ref asmjit, which provides
+//! the whole functionality. Core functionality is within \ref asmjit namespace
+//! and architecture specific functionality is always in its own namespace. For
+//! example \ref asmjit::x86 provides both 32-bit and 64-bit X86 code generation.
+//!
+//! \section main_groups Documentation Groups
+//!
+//! AsmJit documentation is structured into groups. Groups can be followed in
+//! order to learn AsmJit, but knowledge from multiple groups is required to
+//! use AsmJit properly:
+//!
+//! $$DOCS_GROUP_OVERVIEW$$
+//!
+//! \note It's important to understand that in order to learn AsmJit all groups
+//! are important. Some groups can be omitted if a particular tool is out of
+//! interest - for example \ref asmjit_assembler users don't need to know about
+//! \ref asmjit_builder, but it's not the opposite. \ref asmjit_builder users
+//! must know about \ref asmjit_assembler as it also uses operands, labels, and
+//! other concepts. Similarly \ref asmjit_compiler users must know how both \ref
+//! asmjit_assembler and \ref asmjit_builder tools work.
+//!
+//! \section where_to_start Where To Start
+//!
+//! AsmJit \ref asmjit_core provides the following two classes that are essential
+//! from the code generation perspective:
+//!
+//! - \ref CodeHolder provides functionality
+//! to temporarily hold the generated code. It stores all the necessary
+//! information about the code - code buffers, sections, labels, symbols,
+//! and information about relocations.
+//!
+//! - \ref BaseEmitter provides interface used
+//! by emitter implementations. The interface provides basic building blocks
+//! that are then implemented by \ref BaseAssembler, \ref BaseBuilder, and
+//! \ref BaseCompiler.
+//!
+//! Code emitters:
+//!
+//! - \ref asmjit_assembler - provides direct machine code generation.
+//!
+//! - \ref asmjit_builder - provides intermediate code generation that can
+//! be processed before it's serialized to \ref BaseAssembler.
+//!
+//! - \ref asmjit_compiler - provides high-level code generation with built-in
+//! register allocation.
+//!
+//! - \ref FuncNode - provides insight into how function looks from the Compiler
+//! perspective and how it's stored in a node-list.
+//!
+//! \section main_recommendations Recommendations
+//!
+//! The following steps are recommended for all AsmJit users:
+//!
+//! - Make sure that you use \ref Logger, see \ref asmjit_logging.
+//!
+//! - Make sure that you use \ref ErrorHandler, see \ref asmjit_error_handling.
+//!
+//! - Instruction validation in your debug builds can reveal problems too.
+//! AsmJit provides validation at instruction level, that can be enabled
+//! by \ref BaseEmitter::addValidationOptions().
+//!
+//! See \ref BaseEmitter::ValidationOptions for more details.
+//!
+//! - Make sure you put a breakpoint into \ref DebugUtils::errored() function
+//! if you have a problem with AsmJit returning errors during instruction
+//! encoding or register allocation. Having an active breakpoint there can
+//! help to reveal the origin of the error, to inspect variables and other
+//! conditions that caused to it.
+//!
+//! The reason for using \ref Logger and \ref ErrorHandler is that they provide
+//! a very useful information about what's happening inside emitters. In many
+//! cases the information provided by these two is crucial to quickly fix issues
+//! that happen during development (for example wrong instruction, address, or
+//! register used). In addition, output from \ref Logger is always necessary
+//! when filling bug reports. In other words, using logging and proper error
+//! handling can save a lot of time during the development.
+//!
+//! \section main_other Other Pages
+//!
+//! - Class List - List of classes sorted alphabetically
+//! - AsmJit Namespace - List of symbols provided by `asmjit` namespace
+
+// ============================================================================
+// [Documentation - asmjit_build]
+// ============================================================================
+
+//! \defgroup asmjit_build Build Instructions
+//! \brief Build instructions, supported environments, and feature selection.
+//!
+//! ### Overview
+//!
+//! AsmJit is designed to be easy embeddable in any project. However, it depends
+//! on some compile-time definitions that can be used to enable or disable
+//! features to decrease the resulting binary size. A typical way of building
+//! AsmJit is to use [cmake](https://www.cmake.org), but it's also possible to
+//! just include AsmJit source code in your project and to just build it. The
+//! easiest way to include AsmJit in your project is to just include **src**
+//! directory in your project and to define \ref ASMJIT_STATIC. AsmJit can be
+//! just updated from time to time without any changes to this integration
+//! process. Do not embed AsmJit's `test` files in such case as these are used
+//! exclusively for testing.
+//!
+//! ### Supported C++ Compilers
+//!
+//! - Requirements:
+//!
+//! - AsmJit won't build without C++11 enabled. If you use older GCC or Clang
+//! you would have to enable at least C++11 standard through compiler flags.
+//!
+//! - Tested:
+//!
+//! - **Clang** - Tested by Travis-CI - Clang 3.9+ (with C++11 enabled) is
+//! officially supported (older Clang versions having C++11 support are
+//! probably fine, but are not regularly tested).
+//!
+//! - **GNU** - Tested by Travis-CI - GCC 4.8+ (with C++11 enabled) is
+//! officially supported.
+//!
+//! - **MINGW** - Tested by Travis-CI - Use the latest version, if possible.
+//!
+//! - **MSVC** - Tested by Travis-CI - VS2017+ is officially supported, VS2015
+//! is reported to work.
+//!
+//! - Untested:
+//!
+//! - **Intel** - No maintainers and no CI environment to regularly test
+//! this compiler.
+//!
+//! - **Other** C++ compilers would require basic support in
+//! [core/api-config.h](https://github.com/asmjit/asmjit/tree/master/src/asmjit/core/api-config.h).
+//!
+//! ### Supported Operating Systems and Platforms
+//!
+//! - Tested:
+//!
+//! - **Linux** - Tested by Travis-CI (any distribution is generally supported).
+//!
+//! - **OSX** - Tested by Travis-CI (any version is supported).
+//!
+//! - **Windows** - Tested by Travis-CI - (Windows 7+ is officially supported).
+//!
+//! - **Emscripten** - Works if compiled with \ref ASMJIT_NO_JIT. AsmJit
+//! cannot generate WASM code, but can be used to generate X86/X64 code
+//! within a browser, for example.
+//!
+//! - Untested:
+//!
+//! - **BSDs** - No maintainers, no CI environment to regularly test BSDs,
+//! but they should work out of box.
+//!
+//! - **Haiku** - Not regularly tested, but reported to work.
+//!
+//! - **Other** operating systems would require some testing and support in
+//! the following files:
+//! - [core/api-config.h](https://github.com/asmjit/asmjit/tree/master/src/asmjit/core/api-config.h)
+//! - [core/osutils.cpp](https://github.com/asmjit/asmjit/tree/master/src/asmjit/core/osutils.cpp)
+//! - [core/virtmem.cpp](https://github.com/asmjit/asmjit/tree/master/src/asmjit/core/virtmem.cpp)
+//!
+//! ### Supported Backends / Architectures
+//!
+//! - **X86** - Both 32-bit and 64-bit backends tested by Travis-CI.
+//! - **ARM** - Work-in-progress (not public at the moment).
+//!
+//! ### Static Builds and Embedding
+//!
+//! These definitions can be used to enable static library build. Embed is used
+//! when AsmJit's source code is embedded directly in another project, implies
+//! static build as well.
+//!
+//! - \ref ASMJIT_EMBED - Asmjit is embedded, implies \ref ASMJIT_STATIC.
+//! - \ref ASMJIT_STATIC - Enable static-library build.
+//!
+//! \note Projects that use AsmJit statically must define \ref ASMJIT_STATIC in
+//! all compilation units that use AsmJit, otherwise AsmJit would use dynamic
+//! library imports in \ref ASMJIT_API decorator. The recommendation is to
+//! define this macro across the whole project that uses AsmJit this way.
+//!
+//! ### Build Configuration
+//!
+//! These definitions control whether asserts are active or not. By default
+//! AsmJit would autodetect build configuration from existing pre-processor
+//! definitions, but this behavior can be overridden, for example to enable
+//! debug asserts in release configuration.
+//!
+//! - \ref ASMJIT_BUILD_DEBUG - Overrides build configuration to debug,
+//! asserts will be enabled in this case.
+//! - \ref ASMJIT_BUILD_RELEASE - Overrides build configuration to release,
+//! asserts will be disabled in this case.
+//!
+//! \note There is usually no need to override the build configuration. AsmJit
+//! detects the build configuration by checking whether `NDEBUG` is defined and
+//! automatically defines \ref ASMJIT_BUILD_RELEASE if configuration overrides
+//! were not used. We only recommend using build configuration overrides in
+//! special situations, like using AsmJit in release configuration with asserts
+//! enabled for whatever reason.
+//!
+//! ### AsmJit Backends
+//!
+//! AsmJit currently supports only X86/X64 backend, but the plan is to add more
+//! backends in the future. By default AsmJit builds only the host backend, which
+//! is autodetected at compile-time, but this can be overridden.
+//!
+//! - \ref ASMJIT_BUILD_X86 - Always build X86 backend (X86 and X86_64).
+//! - \ref ASMJIT_BUILD_ARM - Always build ARM backend (ARM and AArch64).
+//! - \ref ASMJIT_BUILD_HOST - Always build the host backend.
+//!
+//! ### Features Selection
+//!
+//! AsmJit builds by defaults all supported features, which includes all emitters,
+//! logging, instruction validation and introspection, and JIT memory allocation.
+//! Features can be disabled at compile time by using `ASMJIT_NO_...` definitions.
+//!
+//! - \ref ASMJIT_NO_DEPRECATED - Disables deprecated API at compile time
+//! so it won't be available and the compilation will fail if there is
+//! attempt to use such API. This includes deprecated classes, namespaces,
+//! enumerations, and functions.
+//!
+//! - \ref ASMJIT_NO_FOREIGN - Disables the support for foreign architectures.
+//! If defined, it would internally set \ref ASMJIT_BUILD_HOST to true.
+//!
+//! - \ref ASMJIT_NO_BUILDER - Disables \ref asmjit_builder functionality
+//! completely. This implies \ref ASMJIT_NO_COMPILER as \ref asmjit_compiler
+//! cannot be used without \ref asmjit_builder.
+//!
+//! - \ref ASMJIT_NO_COMPILER - Disables \ref asmjit_compiler functionality
+//! completely.
+//!
+//! - \ref ASMJIT_NO_JIT - Disables JIT memory management and \ref JitRuntime.
+//!
+//! - \ref ASMJIT_NO_LOGGING - Disables \ref Logger and \ref Formatter.
+//!
+//! - \ref ASMJIT_NO_TEXT - Disables everything that contains string
+//! representation of AsmJit constants, should be used together with
+//! \ref ASMJIT_NO_LOGGING as logging doesn't make sense without the
+//! ability to quiry instruction names, register names, etc...
+//!
+//! - \ref ASMJIT_NO_VALIDATION - Disables validation API.
+//!
+//! - \ref ASMJIT_NO_INTROSPECTION - Disables instruction introspection API,
+//! must be used together with \ref ASMJIT_NO_COMPILER as \ref asmjit_compiler
+//! requires introspection for its liveness analysis and register allocation.
+//!
+//! \note It's not recommended to disable features if you plan to build AsmJit
+//! as a shared library that will be used by multiple projects that you don't
+//! control how AsmJit was built (for example AsmJit in a Linux distribution).
+//! The possibility to disable certain features exists mainly for customized
+//! AsmJit builds.
+
+// ============================================================================
+// [Documentation - asmjit_breaking_changes]
+// ============================================================================
+
+//! \defgroup asmjit_breaking_changes Breaking Changes
+//! \brief Documentation of breaking changes
+//!
+//! ### Overview
+//!
+//! AsmJit is a live project that is being actively developed. Deprecating the
+//! existing API in favor of a new one is preferred, but it's not always
+//! possible if the changes are significant. AsmJit authors prefer to do
+//! accumulated breaking changes at once instead of breaking the API often.
+//! This page documents deprecated and removed APIs and should serve as a how-to
+//! guide for people that want to port existing code to work with the newest AsmJit.
+//!
+//! ### Tips
+//!
+//! Useful tips before you start:
+//!
+//! - Visit our [Public Gitter Channel](https://gitter.im/asmjit/asmjit) if
+//! you need a quick help.
+//!
+//! - Build AsmJit with `ASMJIT_NO_DEPRECATED` macro defined to make sure that
+//! you are not using deprecated functionality at all. Deprecated functions
+//! are decorated with `ASMJIT_DEPRECATED()` macro, but sometimes it's not
+//! possible to decorate everything like classes, which are used by deprecated
+//! functions as well, because some compilers would warn about that. If your
+//! project compiles fine with `ASMJIT_NO_DEPRECATED` it's not using anything,
+//! which was deprecated.
+//!
+//! ### Changes committed at 2020-05-30
+//!
+//! AsmJit has been cleaned up significantly, many todo items have been fixed
+//! and many functions and classes have been redesigned, some in an incompatible
+//! way.
+//!
+//! Core changes:
+//!
+//! - \ref Imm operand has now only \ref Imm::value() and \ref Imm::valueAs()
+//! functions that return its value content, and \ref Imm::setValue() function
+//! that sets the content. Functions like `setI8()`, `setU8()` were deprecated.
+//!
+//! Old functions were deprecated, but code using them should still compile.
+//!
+//! - `ArchInfo` has been replaced with \ref Environment. Environment provides
+//! more details about the architecture, but drops some properties that
+//! were used by arch info - `gpSize(`) and `gpCount()`. `gpSize()` can
+//! be replaced with `registerSize()` getter, which returns a native register
+//! size of the architecture the environment uses. However, `gpCount()` was
+//! removed - at the moment \ref ArchRegs can be used to access such properties.
+//!
+//! Some other functions were renamed, like `ArchInfo::isX86Family()` is
+//! now \ref Environment::isFamilyX86(), etc. The reason for changing the
+//! order was support for more propertries and all the accessors now
+//! start with the type of the property, like \ref Environment::isPlatformWindows().
+//!
+//! This function causes many other classes to provide `environment()` getter
+//! instead of `archInfo()` getter. In addition, AsmJit now uses `arch()` to
+//! get an architecture instead of `archId()`. `ArchInfo::kIdXXX` was renamed
+//! to `Environment::kArchXXX`.
+//!
+//! Some functions were deprecated, some removed...
+//!
+//! - `CodeInfo` has been removed in favor of \ref Environment. If you used
+//! `CodeInfo` to set architecture and base address, this is now possible
+//! with \ref Environment and setting base address explicitly by \ref
+//! CodeHolder::init() - the first argument is \ref Environment, and the
+//! second argument is base address, which defaults to \ref
+//! Globals::kNoBaseAddress.
+//!
+//! CodeInfo class was deprecated, but the code using it should still
+//! compile with warnings.
+//!
+//! - \ref CallConv has been updated to offer a more unified way of representing
+//! calling conventions - many calling conventions were abstracted to follow
+//! standard naming like \ref CallConv::kIdCDecl or \ref CallConv::kIdStdCall.
+//!
+//! This change means that other APIs like \ref FuncDetail::init() now
+//! require both, calling convention and target \ref Environment.
+//!
+//! - `Logging` namespace has been renamed to \ref Formatter, which now
+//! provides general functionality for formatting in AsmJit.
+//!
+//! Logging namespace should still work, but its use is deprecated.
+//! Unfortunately this will be without deprecation warnings, so please
+//! make sure you don't use it.
+//!
+//! - `Data64`, `Data128`, and `Data256` structs were deprecated and should
+//! no longer be used. There is no replacement, AsmJit users should simply
+//! create their own structures if they need them or use the new repeated
+//! embed API in emitters, see \ref BaseEmitter::embedDataArray().
+//!
+//! Emitter changes:
+//!
+//! - \ref BaseEmitter::emit() function signature has been changed to accept
+//! 3 operands by reference and the rest 3 operands as a continuous array.
+//! This change is purely cosmetic and shouldn't affect users as emit()
+//! has many overloads that dispatch to the right function.
+//!
+//! - \ref x86::Emitter (Assembler, Builder, Compiler) deprecates embed
+//! utilities like `dint8()`, `duint8()`, `duint16()`, `dxmm()`, etc...
+//! in favor of a new and more powerful \ref BaseEmitter::embedDataArray().
+//! This function also allows emitting repeated values and/or patterns,
+//! which is used by helpers \ref BaseEmitter::embedUInt8(), and others...
+//!
+//! - Validation is now available through \ref BaseEmitter::ValidationOptions,
+//! which can be enabled/disabled through \ref BaseEmitter::addValidationOptions()
+//! and \ref BaseEmitter::clearValidationOptions(), respectively. Validation
+//! options now separate between encoding and Builder/Compiler so it's possible
+//! to choose the granularity required.
+//!
+//! Builder changes:
+//!
+//! - Internal functions for creating nodes were redesigned. They now accept
+//! a pointer to the node created as a first parameter. These changes should
+//! not affect AsmJit users as these functions were used internally.
+//!
+//! Compiler changes:
+//!
+//! - `FuncCallNode` has been renamed to \ref InvokeNode. Additionally, function
+//! calls should now use \ref x86::Compiler::invoke() instead of `call()`.
+//! The reason behind this is to remove the confusion between a `call`
+//! instruction and AsmJit's `call()` intrinsic, which is now `invoke()`.
+//!
+//! - Creating new nodes also changed. Now the preferred way of invoking a
+//! function is to call \ref x86::Compiler::invoke() where the first
+//! argument is `InvokeNode**`. The function now returns an error and would
+//! call \ref ErrorHandler in case of a failure. Error handling was
+//! unspecified in the past - the function was marked noexcept, but called
+//! error handler, which could throw.
+//!
+//! The reason behind this change is to make the API consistent with other
+//! changes and to also make it possible to inspect the possible error. In
+//! the previous API it returned a new node or `nullptr` in case of error,
+//! which the user couldn't inspect unless there was an attached \ref
+//! ErrorHandler.
+//!
+//! Samples:
+//!
+//! ```
+//! #include
+//! using namespace asmjit;
+//!
+//! // The basic setup of JitRuntime and CodeHolder changed, use environment()
+//! // instead of codeInfo().
+//! void basicSetup() {
+//! JitRuntime rt;
+//! CodeHolder code(rt.environment());
+//! }
+//!
+//! // Calling a function (Compiler) changed - use invoke() instead of call().
+//! void functionInvocation(x86::Compiler& cc) {
+//! InvokeNode* invokeNode;
+//! cc.invoke(&invokeNode, targetOperand, FuncSignatureT<...>(...));
+//! }
+//! ```
+
+// ============================================================================
+// [Documentation - asmjit_core]
+// ============================================================================
+
+//! \defgroup asmjit_core Core
+//! \brief Globals, code storage, and emitter interface.
+//!
+//! ### Overview
+//!
+//! AsmJit library uses \ref CodeHolder to hold code during code generation and
+//! emitters inheriting from \ref BaseEmitter to emit code. CodeHolder uses
+//! containers to manage its data:
+//!
+//! - \ref Section - stores information about a code or data section.
+//! - \ref CodeBuffer - stores actual code or data, part of \ref Section.
+//! - \ref LabelEntry - stores information about a label - its name, offset,
+//! section where it belongs to, and other bits.
+//! - \ref LabelLink - stores information about yet unbound label, which was
+//! already used by the assembler.
+//! - \ref RelocEntry - stores information about a relocation.
+//! - \ref AddressTableEntry - stores information about an address, which was
+//! used in a jump or call. Such address may need relocation.
+//!
+//! To generate code you would need to instantiate at least the following classes:
+//!
+//! - \ref CodeHolder - to hold code during code generation.
+//! - \ref BaseEmitter - to emit code into \ref CodeHolder.
+//! - \ref Target (optional) - most likely \ref JitRuntime to keep the generated
+//! code in executable memory. \ref Target can be customized by inheriting from
+//! it.
+//!
+//! There are also other core classes that are important:
+//!
+//! - \ref Environment - describes where the code will run. Environment brings
+//! the concept of target triples or tuples into AsmJit, which means that users
+//! can specify target architecture, platform, and ABI.
+//! - \ref Type - encapsulates lightweight type functionality that can be used
+//! to describe primitive and vector types. Types are used by higher level
+//! utilities, for example by \ref asmjit_function and \ref asmjit_compiler.
+//! - \ref CpuInfo - encapsulates CPU information - stores both CPU information
+//! and features described by \ref BaseFeatures.
+//!
+//! AsmJit also provides global constants:
+//!
+//! - \ref Globals - namespace that provides global constants.
+//! - \ref ByteOrder - byte-order constants and functionality.
+//!
+//! \note CodeHolder examples use \ref x86::Assembler as abstract interfaces cannot
+//! be used to generate code.
+//!
+//! ### CodeHolder & Emitters
+//!
+//! The example below shows how the mentioned classes interact to generate X86 code:
+//!
+//! ```
+//! #include
+//! #include
+//!
+//! using namespace asmjit;
+//!
+//! // Signature of the generated function.
+//! typedef int (*Func)(void);
+//!
+//! int main() {
+//! JitRuntime rt; // Runtime specialized for JIT code execution.
+//!
+//! CodeHolder code; // Holds code and relocation information.
+//! code.init(rt.environment()); // Initialize code to match the JIT environment.
+//!
+//! x86::Assembler a(&code); // Create and attach x86::Assembler to code.
+//! a.mov(x86::eax, 1); // Move one to eax register.
+//! a.ret(); // Return from function.
+//! // ===== x86::Assembler is no longer needed from here and can be destroyed =====
+//!
+//! Func fn; // Holds address to the generated function.
+//! Error err = rt.add(&fn, &code); // Add the generated code to the runtime.
+//! if (err) return 1; // Handle a possible error returned by AsmJit.
+//! // ===== CodeHolder is no longer needed from here and can be destroyed =====
+//!
+//! int result = fn(); // Execute the generated code.
+//! printf("%d\n", result); // Print the resulting "1".
+//!
+//! // All classes use RAII, all resources will be released before `main()` returns,
+//! // the generated function can be, however, released explicitly if you intend to
+//! // reuse or keep the runtime alive, which you should in a production-ready code.
+//! rt.release(fn);
+//!
+//! return 0;
+//! }
+//! ```
+//!
+//! The example above used \ref x86::Assembler as an emitter. AsmJit provides the
+//! following emitters that offer various levels of abstraction:
+//!
+//! - \ref asmjit_assembler - Low-level emitter that emits directly to \ref CodeBuffer.
+//! - \ref asmjit_builder - Low-level emitter that emits to a \ref BaseNode list.
+//! - \ref asmjit_compiler - High-level emitter that provides register allocation.
+//!
+//! ### Targets and JitRuntime
+//!
+//! AsmJit's \ref Target is an interface that provides basic target abstraction.
+//! At the moment AsmJit provides only one implementation called \ref JitRuntime,
+//! which as the name suggests provides JIT code target and execution runtime.
+//! \ref JitRuntime provides all the necessary stuff to implement a simple JIT
+//! compiler with basic memory management. It only provides \ref JitRuntime::add()
+//! and \ref JitRuntime::release() functions that are used to either add code
+//! to the runtime or release it. \ref JitRuntime doesn't do any decisions on
+//! when the code should be released, the decision is up to the developer.
+//!
+//! See more at \ref asmjit_virtual_memory group.
+//!
+//! ### More About Environment
+//!
+//! In the previous example the \ref Environment is retrieved from \ref JitRuntime.
+//! It's logical as \ref JitRuntime always returns an \ref Environment that is
+//! compatible with the host. For example if your application runs in 64-bit mode
+//! the \ref Environment returned will use \ref Environment::kArchX64 architecture
+//! in contrast to \ref Environment::kArchX86, which will be used in 32-bit mode on
+//! any X86 platform.
+//!
+//! AsmJit allows to setup the \ref Environment manually and to select a different
+//! architecture and ABI when necessary. So let's do something else this time, let's
+//! always generate a 32-bit code and print its binary representation. To do that, we
+//! can create our own \ref Environment and initialize it to \ref Environment::kArchX86.
+//!
+//! ```
+//! #include
+//! #include
+//!
+//! using namespace asmjit;
+//!
+//! int main(int argc, char* argv[]) {
+//! using namespace asmjit::x86;
+//!
+//! // Create a custom environment initialized to 32-bit X86 architecture.
+//! Environment env;
+//! env.setArch(Environment::kArchX86);
+//!
+//! CodeHolder code; // Create a CodeHolder.
+//! code.init(env); // Initialize CodeHolder with custom environment.
+//!
+//! // Generate a 32-bit function that sums 4 floats and looks like:
+//! // void func(float* dst, const float* a, const float* b)
+//! x86::Assembler a(&code); // Create and attach x86::Assembler to `code`.
+//!
+//! a.mov(eax, dword_ptr(esp, 4)); // Load the destination pointer.
+//! a.mov(ecx, dword_ptr(esp, 8)); // Load the first source pointer.
+//! a.mov(edx, dword_ptr(esp, 12)); // Load the second source pointer.
+//!
+//! a.movups(xmm0, ptr(ecx)); // Load 4 floats from [ecx] to XMM0.
+//! a.movups(xmm1, ptr(edx)); // Load 4 floats from [edx] to XMM1.
+//! a.addps(xmm0, xmm1); // Add 4 floats in XMM1 to XMM0.
+//! a.movups(ptr(eax), xmm0); // Store the result to [eax].
+//! a.ret(); // Return from function.
+//!
+//! // We have no Runtime this time, it's on us what we do with the code.
+//! // CodeHolder stores code in Section, which provides some basic properties
+//! // and CodeBuffer structure. We are interested in section's CodeBuffer.
+//! //
+//! // NOTE: The first section is always '.text', it can be retrieved by
+//! // code.sectionById(0) or simply by code.textSection().
+//! CodeBuffer& buffer = code.textSection()->buffer();
+//!
+//! // Print the machine-code generated or do something else with it...
+//! // 8B4424048B4C24048B5424040F28010F58010F2900C3
+//! for (size_t i = 0; i < buffer.length; i++)
+//! printf("%02X", buffer.data[i]);
+//!
+//! return 0;
+//! }
+//! ```
+//!
+//! ### Explicit Code Relocation
+//!
+//! In addition to \ref Environment, \ref CodeHolder can be configured to
+//! specify a base-address (or a virtual base-address in a linker terminology),
+//! which could be static (useful when you know the location where the target's
+//! machine code will be) or dynamic. AsmJit assumes dynamic base-address by
+//! default and relocates the code held by \ref CodeHolder to a user provided
+//! address on-demand. To be able to relocate to a user provided address it needs
+//! to store some information about relocations, which is represented by \ref
+//! RelocEntry. Relocation entries are only required if you call external functions
+//! from the generated code that cannot be encoded by using a 32-bit displacement
+//! (64-bit displacements are not provided by aby supported architecture).
+//!
+//! There is also a concept called \ref LabelLink - label link is a lightweight
+//! data structure that doesn't have any identifier and is stored in \ref LabelEntry
+//! as a single-linked list. Label link represents either unbound yet used label
+//! and cross-sections links (only relevant to code that uses multiple sections).
+//! Since crossing sections is something that cannot be resolved immediately these
+//! links persist until offsets of these sections are assigned and until
+//! \ref CodeHolder::resolveUnresolvedLinks() is called. It's an error if you end
+//! up with code that has unresolved label links after flattening. You can verify
+//! it by calling \ref CodeHolder::hasUnresolvedLinks(), which inspects the value
+//! returned by \ref CodeHolder::unresolvedLinkCount().
+//!
+//! AsmJit can flatten code that uses multiple sections by assigning each section
+//! an incrementing offset that respects its alignment. Use \ref CodeHolder::flatten()
+//! to do that. After the sections are flattened their offsets and virtual-sizes
+//! are adjusted to respect each section's buffer size and alignment. The \ref
+//! CodeHolder::resolveUnresolvedLinks() function must be called before relocating
+//! the code held by \ref CodeHolder. You can also flatten your code manually by
+//! iterating over all sections and calculating their offsets (relative to base)
+//! by your own algorithm. In that case \ref CodeHolder::flatten() should not be
+//! called, however, \ref CodeHolder::resolveUnresolvedLinks() should be.
+//!
+//! The example below shows how to use a built-in virtual memory allocator
+//! \ref JitAllocator instead of using \ref JitRuntime (just in case you want
+//! to use your own memory management) and how to relocate the generated code
+//! into your own memory block - you can use your own virtual memory allocator
+//! if you prefer that, but that's OS specific and not covered by the documentation.
+//!
+//! The following code is similar to the previous one, but implements a function
+//! working in both 32-bit and 64-bit environments:
+//!
+//! ```
+//! #include
+//! #include
+//!
+//! using namespace asmjit;
+//!
+//! typedef void (*SumIntsFunc)(int* dst, const int* a, const int* b);
+//!
+//! int main() {
+//! // Create a custom environment that matches the current host environment.
+//! Environment env = hostEnvironment();
+//!
+//! CodeHolder code; // Create a CodeHolder.
+//! code.init(env); // Initialize CodeHolder with environment.
+//!
+//! x86::Assembler a(&code); // Create and attach x86::Assembler to `code`.
+//!
+//! // Signature: 'void func(int* dst, const int* a, const int* b)'.
+//! x86::Gp dst;
+//! x86::Gp src_a;
+//! x86::Gp src_b;
+//!
+//! // Handle the difference between 32-bit and 64-bit calling conventions
+//! // (arguments passed through stack vs. arguments passed by registers).
+//! if (env.is32Bit()) {
+//! dst = x86::eax;
+//! src_a = x86::ecx;
+//! src_b = x86::edx;
+//! a.mov(dst , x86::dword_ptr(x86::esp, 4));
+//! a.mov(src_a, x86::dword_ptr(x86::esp, 8));
+//! a.mov(src_b, x86::dword_ptr(x86::esp, 12));
+//! }
+//! else {
+//! if (env.isPlatformWindows()) {
+//! dst = x86::rcx; // First argument (destination pointer).
+//! src_a = x86::rdx; // Second argument (source 'a' pointer).
+//! src_b = x86::r8; // Third argument (source 'b' pointer).
+//! }
+//! else {
+//! dst = x86::rdi; // First argument (destination pointer).
+//! src_a = x86::rsi; // Second argument (source 'a' pointer).
+//! src_b = x86::rdx; // Third argument (source 'b' pointer).
+//! }
+//! }
+//!
+//! a.movdqu(x86::xmm0, x86::ptr(src_a)); // Load 4 ints from [src_a] to XMM0.
+//! a.movdqu(x86::xmm1, x86::ptr(src_b)); // Load 4 ints from [src_b] to XMM1.
+//! a.paddd(x86::xmm0, x86::xmm1); // Add 4 ints in XMM1 to XMM0.
+//! a.movdqu(x86::ptr(dst), x86::xmm0); // Store the result to [dst].
+//! a.ret(); // Return from function.
+//!
+//! // Even when we didn't use multiple sections AsmJit could insert one section
+//! // called '.addrtab' (address table section), which would be filled by data
+//! // required by relocations (absolute jumps and calls). You can omit this code
+//! // if you are 100% sure your code doesn't contain multiple sections and
+//! // such relocations. You can use `CodeHolder::hasAddressTable()` to verify
+//! // whether the address table section does exist.
+//! code.flatten();
+//! code.resolveUnresolvedLinks();
+//!
+//! // After the code was generated it can be relocated manually to any memory
+//! // location, however, we need to know it's size before we perform memory
+//! // allocation. `CodeHolder::codeSize()` returns the worst estimated code
+//! // size in case that relocations are not possible without trampolines (in
+//! // that case some extra code at the end of the current code buffer is
+//! // generated during relocation).
+//! size_t estimatedSize = code.codeSize();
+//!
+//! // Instead of rolling up our own memory allocator we can use the one AsmJit
+//! // provides. It's decoupled so you don't need to use `JitRuntime` for that.
+//! JitAllocator allocator;
+//!
+//! // Allocate an executable virtual memory and handle a possible failure.
+//! void* p = allocator.alloc(estimatedSize);
+//! if (!p)
+//! return 0;
+//!
+//! // Now relocate the code to the address provided by the memory allocator.
+//! // Please note that this DOESN'T COPY anything to `p`. This function will
+//! // store the address in CodeHolder and use relocation entries to patch the
+//! // existing code in all sections to respect the base address provided.
+//! code.relocateToBase((uint64_t)p);
+//!
+//! // This is purely optional. There are cases in which the relocation can omit
+//! // unneeded data, which would shrink the size of address table. If that
+//! // happened the codeSize returned after relocateToBase() would be smaller
+//! // than the originally `estimatedSize`.
+//! size_t codeSize = code.codeSize();
+//!
+//! // This will copy code from all sections to `p`. Iterating over all sections
+//! // and calling `memcpy()` would work as well, however, this function supports
+//! // additional options that can be used to also zero pad sections' virtual
+//! // size, etc.
+//! //
+//! // With some additional features, copyFlattenData() does roughly this:
+//! // for (Section* section : code.sections())
+//! // memcpy((uint8_t*)p + section->offset(),
+//! // section->data(),
+//! // section->bufferSize());
+//! code.copyFlattenedData(p, codeSize, CodeHolder::kCopyPadSectionBuffer);
+//!
+//! // Execute the generated function.
+//! int inA[4] = { 4, 3, 2, 1 };
+//! int inB[4] = { 1, 5, 2, 8 };
+//! int out[4];
+//!
+//! // This code uses AsmJit's ptr_as_func<> to cast between void* and SumIntsFunc.
+//! ptr_as_func(p)(out, inA, inB);
+//!
+//! // Prints {5 8 4 9}
+//! printf("{%d %d %d %d}\n", out[0], out[1], out[2], out[3]);
+//!
+//! // Release 'p' is it's no longer needed. It will be destroyed with 'vm'
+//! // instance anyway, but it's a good practice to release it explicitly
+//! // when you know that the function will not be needed anymore.
+//! allocator.release(p);
+//!
+//! return 0;
+//! }
+//! ```
+//!
+//! If you know the base-address in advance (before the code generation) it can
+//! be passed as a second argument to \ref CodeHolder::init(). In that case the
+//! Assembler will know the absolute position of each instruction and would be
+//! able to use it during instruction encoding to prevent relocations where
+//! possible. The following example shows how to configure the base address:
+//!
+//! ```
+//! #include
+//! #include
+//!
+//! void initializeCodeHolder(CodeHolder& code) {
+//! Environment env = hostEnvironment();
+//! uint64_t baseAddress = uint64_t(0x1234);
+//!
+//! // initialize CodeHolder with environment and custom base address.
+//! code.init(env, baseAddress);
+//! }
+//! ```
+//!
+//! ### Label Offsets and Links
+//!
+//! When a label that is not yet bound is used by the Assembler, it creates a
+//! \ref LabelLink, which is then added to a \ref LabelEntry. These links are
+//! also created if a label is used in a different section than in which it
+//! was bound. Let's examine some functions that can be used to check whether
+//! there are any unresolved links.
+//!
+//! ```
+//! #include
+//! #include
+//!
+//! void labelLinksExample(CodeHolder& code, const Label& label) {
+//! // Tests whether the `label` is bound.
+//! bool isBound = code.isLabelBound(label);
+//! printf("Label %u is %s\n", label.id(), isBound ? "bound" : "not bound");
+//!
+//! // Returns true if the code contains either referenced, but unbound
+//! // labels, or cross-section label links that are not resolved yet.
+//! bool hasUnresolved = code.hasUnresolvedLinks(); // Boolean answer.
+//! size_t nUnresolved = code.unresolvedLinkCount(); // Count of unresolved links.
+//!
+//! printf("Number of unresolved links: %zu\n", nUnresolved);
+//! }
+//! ```
+//!
+//! There is no function that would return the number of unbound labels as this
+//! is completely unimportant from CodeHolder's perspective. If a label is not
+//! used then it doesn't matter whether it's bound or not, only actually used
+//! labels matter. After a Label is bound it's possible to query its offset
+//! offset relative to the start of the section where it was bound:
+//!
+//! ```
+//! #include
+//! #include
+//!
+//! void labelOffsetExample(CodeHolder& code, const Label& label) {
+//! // Label offset is known after it's bound. The offset provided is relative
+//! // to the start of the section, see below for alternative. If the given
+//! // label is not bound the offset returned will be zero. It's recommended
+//! // to always check whether the label is bound before using its offset.
+//! uint64_t sectionOffset = code.labelOffset(label);
+//! printf("Label offset relative to section: %llu\n", (unsigned long long)sectionOffset);
+//!
+//! // If you use multiple sections and want the offset relative to the base.
+//! // NOTE: This function expects that the section has already an offset and
+//! // the label-link was resolved (if this is not true you will still get an
+//! // offset relative to the start of the section).
+//! uint64_t baseOffset = code.labelOffsetFromBase(label);
+//! printf("Label offset relative to base: %llu\n", (unsigned long long)baseOffset);
+//! }
+//! ```
+//!
+//! ### Sections
+//!
+//! AsmJit allows to create multiple sections within the same \ref CodeHolder.
+//! A test-case [asmjit_test_x86_sections.cpp](https://github.com/asmjit/asmjit/blob/master/test/asmjit_test_x86_sections.cpp)
+//! can be used as a reference point although the following example should
+//! also provide a useful insight:
+//!
+//! ```
+//! #include
+//! #include
+//!
+//! void sectionsExample(CodeHolder& code) {
+//! // Text section is always provided as the first section.
+//! Section* text = code.textSection(); // or code.sectionById(0);
+//!
+//! // To create another section use CodeHolder::newSection().
+//! Section* data;
+//! Error err = code.newSection(&data,
+//! ".data", // Section name
+//! SIZE_MAX, // Name length if the name is not null terminated (or SIZE_MAX).
+//! 0, // Section flags, see Section::Flags.
+//! 8, // Section alignment, must be power of 2.
+//! 0); // Section order value (optional, default 0).
+//!
+//! // When you switch sections in Assembler, Builder, or Compiler the cursor
+//! // will always move to the end of that section. When you create an Assembler
+//! // the cursor would be placed at the end of the first (.text) section, which
+//! // is initially empty.
+//! x86::Assembler a(&code);
+//! Label L_Data = a.newLabel();
+//!
+//! a.mov(x86::eax, x86::ebx); // Emits in .text section.
+//!
+//! a.section(data); // Switches to the end of .data section.
+//! a.bind(L_Data); // Binds label in this .data section
+//! a.db(0x01); // Emits byte in .data section.
+//!
+//! a.section(text); // Switches to the end of .text section.
+//! a.add(x86::ebx, x86::eax); // Emits in .text section.
+//!
+//! // References a label in .text section, which was bound in .data section.
+//! // This would create a LabelLink even when the L_Data is already bound,
+//! // because the reference crosses sections. See below...
+//! a.lea(x86::rsi, x86::ptr(L_Data));
+//! }
+//! ```
+//!
+//! The last line in the example above shows that a LabelLink would be created
+//! even for bound labels that cross sections. In this case a referenced label
+//! was bound in another section, which means that the link couldn't be resolved
+//! at that moment. If your code uses sections, but you wish AsmJit to flatten
+//! these sections (you don't plan to flatten them manually) then there is an
+//! API for that.
+//!
+//! ```
+//! #include
+//! #include
+//!
+//! // ... (continuing the previous example) ...
+//! void sectionsExampleContinued(CodeHolder& code) {
+//! // Suppose we have some code that contains multiple sections and
+//! // we would like to flatten it by using AsmJit's built-in API:
+//! Error err = code.flatten();
+//! if (err) {
+//! // There are many reasons it can fail, so always handle a possible error.
+//! printf("Failed to flatten the code: %s\n", DebugUtils::errorAsString(err));
+//! exit(1);
+//! }
+//!
+//! // After flattening all sections would contain assigned offsets
+//! // relative to base. Offsets are 64-bit unsigned integers so we
+//! // cast them to `size_t` for simplicity. On 32-bit targets it's
+//! // guaranteed that the offset cannot be greater than `2^32 - 1`.
+//! printf("Data section offset %zu", size_t(data->offset()));
+//!
+//! // The flattening doesn't resolve unresolved label links, this
+//! // has to be done manually as flattening can be done separately.
+//! err = code.resolveUnresolvedLinks();
+//! if (err) {
+//! // This is the kind of error that should always be handled...
+//! printf("Failed to resolve label links: %s\n", DebugUtils::errorAsString(err));
+//! exit(1);
+//! }
+//!
+//! if (code.hasUnresolvedLinks()) {
+//! // This would mean either unbound label or some other issue.
+//! printf("The code has %zu unbound labels\n", code.unresovedLinkCount());
+//! exit(1);
+//! }
+//! }
+//! ```
+
+// ============================================================================
+// [Documentation - asmjit_assembler]
+// ============================================================================
+
+//! \defgroup asmjit_assembler Assembler
+//! \brief Assembler interface and operands.
+//!
+//! ### Overview
+//!
+//! AsmJit's Assembler is used to emit machine code directly into a \ref
+//! CodeBuffer. In general, code generation with assembler requires the knowledge
+//! of the following:
+//!
+//! - \ref BaseAssembler and architecture-specific assemblers:
+//! - \ref x86::Assembler - Assembler specific to X86 architecture
+//! - \ref Operand and its variations:
+//! - \ref BaseReg - Base class for a register operand, inherited by:
+//! - \ref x86::Reg - Register operand specific to X86 architecture.
+//! - \ref BaseMem - Base class for a memory operand, inherited by:
+//! - \ref x86::Mem - Memory operand specific to X86 architecture.
+//! - \ref Imm - Immediate (value) operand.
+//! - \ref Label - Label operand.
+//!
+//! \note Assembler examples use \ref x86::Assembler as abstract interfaces cannot
+//! be used to generate code.
+//!
+//! ### Operand Basics
+//!
+//! Let's start with operands. \ref Operand is a data structure that defines a
+//! data layout of any operand. It can be inherited, but any class inheriting
+//! it cannot add any members to it, only the existing layout can be reused.
+//! AsmJit allows to construct operands dynamically, to store them, and to query
+//! a complete information about them at run-time. Operands are small (always 16
+//! bytes per \ref Operand) and can be copied and passed by value. Please never
+//! allocate individual operands dynamically by using a `new` keyword - it would
+//! work, but then you would have to be responsible for deleting such operands.
+//! In AsmJit operands are always part of some other data structures like \ref
+//! InstNode, which is part of \ref asmjit_builder tool.
+//!
+//! Operands contain only identifiers, but not pointers to any code-generation data.
+//! For example \ref Label operand only provides label identifier, but not a pointer
+//! to \ref LabelEntry structure. In AsmJit such IDs are used to link stuff together
+//! without having to deal with pointers.
+//!
+//! AsmJit's operands all inherit from a base class called \ref Operand. Operands
+//! have the following properties that are commonly accessible by getters and setters:
+//!
+//! - \ref Operand - Base operand, which only provides accessors that are common
+//! to all operand types.
+//! - \ref BaseReg - Describes either physical or virtual register. Physical
+//! registers have id that matches the target's machine id directly whereas
+//! virtual registers must be allocated into physical registers by a register
+//! allocator pass. Register operand provides:
+//! - Register Type - Unique id that describes each possible register provided
+//! by the target architecture - for example X86 backend provides \ref
+//! x86::Reg::RegType, which defines all variations of general purpose registers
+//! (GPB-LO, GPB-HI, GPW, GPD, and GPQ) and all types of other registers like K,
+//! MM, BND, XMM, YMM, and ZMM.
+//! - Register Group - Groups multiple register types under a single group - for
+//! example all general-purpose registers (of all sizes) on X86 are part of
+//! \ref x86::Reg::kGroupGp and all SIMD registers (XMM, YMM, ZMM) are part
+//! of \ref x86::Reg::kGroupVec.
+//! - Register Size - Contains the size of the register in bytes. If the size
+//! depends on the mode (32-bit vs 64-bit) then generally the higher size is
+//! used (for example RIP register has size 8 by default).
+//! - Register Id - Contains physical or virtual id of the register.
+//! - \ref BaseMem - Used to reference a memory location. Memory operand provides:
+//! - Base Register - A base register type and id (physical or virtual).
+//! - Index Register - An index register type and id (physical or virtual).
+//! - Offset - Displacement or absolute address to be referenced (32-bit if base
+//! register is used and 64-bit if base register is not used).
+//! - Flags that can describe various architecture dependent information (like
+//! scale and segment-override on X86).
+//! - \ref Imm - Immediate values are usually part of instructions (encoded within
+//! the instruction itself) or data.
+//! - \ref Label - used to reference a location in code or data. Labels must be
+//! created by the \ref BaseEmitter or by \ref CodeHolder. Each label has its
+//! unique id per \ref CodeHolder instance.
+//!
+//! ### Operand Manipulation
+//!
+//! AsmJit allows to construct operands dynamically, to store them, and to query
+//! a complete information about them at run-time. Operands are small (always 16
+//! bytes per `Operand`) and should be always copied (by value) if you intend to
+//! store them (don't create operands by using `new` keyword, it's not recommended).
+//! Operands are safe to be passed to `memcpy()` and `memset()`, which becomes
+//! handy when working with arrays of operands. If you set all members of an \ref
+//! Operand to zero the operand would become NONE operand, which is the same as a
+//! default constructed Operand.
+//!
+//! The example below illustrates how operands can be used and modified even
+//! without using any other code generation classes. The example uses X86
+//! architecture-specific operands.
+//!
+//! ```
+//! #include
+//!
+//! using namespace asmjit;
+//!
+//! // Registers can be copied, it's a common practice.
+//! x86::Gp dstRegByValue() { return x86::ecx; }
+//!
+//! void usingOperandsExample(x86::Assembler& a) {
+//! // Gets `ecx` register returned by a function.
+//! x86::Gp dst = dstRegByValue();
+//! // Gets `rax` register directly from the provided `x86` namespace.
+//! x86::Gp src = x86::rax;
+//! // Constructs `r10` dynamically.
+//! x86::Gp idx = x86::gpq(10);
+//! // Constructs [src + idx] memory address - referencing [rax + r10].
+//! x86::Mem m = x86::ptr(src, idx);
+//!
+//! // Examine `m`: Returns `x86::Reg::kTypeGpq`.
+//! m.indexType();
+//! // Examine `m`: Returns 10 (`r10`).
+//! m.indexId();
+//!
+//! // Reconstruct `idx` stored in mem:
+//! x86::Gp idx_2 = x86::Gp::fromTypeAndId(m.indexType(), m.indexId());
+//!
+//! // True, `idx` and idx_2` are identical.
+//! idx == idx_2;
+//!
+//! // Possible - op will still be the same as `m`.
+//! Operand op = m;
+//! // True (can be casted to BaseMem or architecture-specific Mem).
+//! op.isMem();
+//!
+//! // True, `op` is just a copy of `m`.
+//! m == op;
+//!
+//! // Static cast is fine and valid here.
+//! static_cast(op).addOffset(1);
+//! // However, using `as()` to cast to a derived type is preferred.
+//! op.as().addOffset(1);
+//! // False, `op` now points to [rax + r10 + 2], which is not [rax + r10].
+//! m == op;
+//!
+//! // Emitting 'mov' - type safe way.
+//! a.mov(dst, m);
+//! // Not possible, `mov` doesn't provide mov(x86::Gp, Operand) overload.
+//! a.mov(dst, op);
+//!
+//! // Type-unsafe, but possible.
+//! a.emit(x86::Inst::kIdMov, dst, m);
+//! // Also possible, `emit()` is typeless and can be used with raw Operand.
+//! a.emit(x86::Inst::kIdMov, dst, op);
+//! }
+//! ```
+//!
+//! Some operands have to be created explicitly by emitters. For example labels
+//! must be created by \ref BaseEmitter::newLabel(), which creates a label entry
+//! and returns a \ref Label operand with the id that refers to it. Such label
+//! then can be used by emitters.
+//!
+//! ### Memory Operands
+//!
+//! Some architectures like X86 provide a complex memory addressing model that
+//! allows to encode addresses having a BASE register, INDEX register with a
+//! possible scale (left shift), and displacement (called offset in AsmJit).
+//! Memory address on X86 can also specify memory segment (segment-override in
+//! X86 terminology) and some instructions (gather / scatter) require INDEX to
+//! be a \ref x86::Vec register instead of a general-purpose register.
+//!
+//! AsmJit allows to encode and work with all forms of addresses mentioned and
+//! implemented by X86. In addition, it also allows to construct absolute 64-bit
+//! memory address operands, which is only allowed in one form of 'mov' instruction.
+//!
+//! ```
+//! #include
+//!
+//! using namespace asmjit;
+//!
+//! void testX86Mem() {
+//! // Makes it easier to access x86 stuff...
+//! using namespace asmjit::x86;
+//!
+//! // BASE + OFFSET.
+//! Mem a = ptr(rax); // a = [rax]
+//! Mem b = ptr(rax, 15); // b = [rax + 15]
+//!
+//! // BASE + INDEX << SHIFT - Shift is in BITS as used by X86!
+//! Mem c = ptr(rax, rbx); // c = [rax + rbx]
+//! Mem d = ptr(rax, rbx, 2); // d = [rax + rbx << 2]
+//! Mem e = ptr(rax, rbx, 2, 15); // e = [rax + rbx << 2 + 15]
+//!
+//! // BASE + VM (Vector Index) (encoded as MOD+VSIB).
+//! Mem f = ptr(rax, xmm1); // f = [rax + xmm1]
+//! Mem g = ptr(rax, xmm1, 2); // g = [rax + xmm1 << 2]
+//! Mem h = ptr(rax, xmm1, 2, 15); // h = [rax + xmm1 << 2 + 15]
+//!
+//! // Absolute adddress:
+//! uint64_t addr = (uint64_t)0x1234;
+//! Mem i = ptr(addr); // i = [0x1234]
+//! Mem j = ptr(addr, rbx); // j = [0x1234 + rbx]
+//! Mem k = ptr(addr, rbx, 2); // k = [0x1234 + rbx << 2]
+//!
+//! // LABEL - Will be encoded as RIP (64-bit) or absolute address (32-bit).
+//! Label L = ...;
+//! Mem m = ptr(L); // m = [L]
+//! Mem n = ptr(L, rbx); // n = [L + rbx]
+//! Mem o = ptr(L, rbx, 2); // o = [L + rbx << 2]
+//! Mem p = ptr(L, rbx, 2, 15); // p = [L + rbx << 2 + 15]
+//!
+//! // RIP - 64-bit only (RIP can't use INDEX).
+//! Mem q = ptr(rip, 24); // q = [rip + 24]
+//! }
+//! ```
+//!
+//! Memory operands can optionally contain memory size. This is required by
+//! instructions where the memory size cannot be deduced from other operands,
+//! like `inc` and `dec` on X86:
+//!
+//! ```
+//! #include
+//!
+//! using namespace asmjit;
+//!
+//! void testX86Mem() {
+//! // The same as: dword ptr [rax + rbx].
+//! x86::Mem a = x86::dword_ptr(rax, rbx);
+//!
+//! // The same as: qword ptr [rdx + rsi << 0 + 1].
+//! x86::Mem b = x86::qword_ptr(rdx, rsi, 0, 1);
+//! }
+//! ```
+//!
+//! Memory operands provide API that can be used to access its properties:
+//!
+//! ```
+//! #include
+//!
+//! using namespace asmjit;
+//!
+//! void testX86Mem() {
+//! // The same as: dword ptr [rax + 12].
+//! x86::Mem mem = x86::dword_ptr(rax, 12);
+//!
+//! mem.hasBase(); // true.
+//! mem.hasIndex(); // false.
+//! mem.size(); // 4.
+//! mem.offset(); // 12.
+//!
+//! mem.setSize(0); // Sets the size to 0 (makes it sizeless).
+//! mem.addOffset(-1); // Adds -1 to the offset and makes it 11.
+//! mem.setOffset(0); // Sets the offset to 0.
+//! mem.setBase(rcx); // Changes BASE to RCX.
+//! mem.setIndex(rax); // Changes INDEX to RAX.
+//! mem.hasIndex(); // true.
+//! }
+//! // ...
+//! ```
+//!
+//! Making changes to memory operand is very comfortable when emitting loads
+//! and stores:
+//!
+//! ```
+//! #include
+//!
+//! using namespace asmjit;
+//!
+//! void testX86Mem(CodeHolder& code) {
+//! x86::Assembler a(code); // Your initialized x86::Assembler.
+//! x86::Mem mSrc = x86::ptr(eax); // Construct [eax] memory operand.
+//!
+//! // One way of emitting bunch of loads is to use `mem.adjusted()`, which
+//! // returns a new memory operand and keeps the source operand unchanged.
+//! a.movaps(x86::xmm0, mSrc); // No adjustment needed to load [eax].
+//! a.movaps(x86::xmm1, mSrc.adjusted(16)); // Loads from [eax + 16].
+//! a.movaps(x86::xmm2, mSrc.adjusted(32)); // Loads from [eax + 32].
+//! a.movaps(x86::xmm3, mSrc.adjusted(48)); // Loads from [eax + 48].
+//!
+//! // ... do something with xmm0-3 ...
+//!
+//! // Another way of adjusting memory is to change the operand in-place.
+//! // If you want to keep the original operand you can simply clone it.
+//! x86::Mem mDst = mSrc.clone(); // Clone mSrc.
+//!
+//! a.movaps(mDst, x86::xmm0); // Stores xmm0 to [eax].
+//! mDst.addOffset(16); // Adds 16 to `mDst`.
+//!
+//! a.movaps(mDst, x86::xmm1); // Stores to [eax + 16] .
+//! mDst.addOffset(16); // Adds 16 to `mDst`.
+//!
+//! a.movaps(mDst, x86::xmm2); // Stores to [eax + 32].
+//! mDst.addOffset(16); // Adds 16 to `mDst`.
+//!
+//! a.movaps(mDst, x86::xmm3); // Stores to [eax + 48].
+//! }
+//! ```
+//!
+//! ### Assembler Examples
+//!
+//! - \ref x86::Assembler provides many X86/X64 examples.
+
+// ============================================================================
+// [Documentation - asmjit_builder]
+// ============================================================================
+
+//! \defgroup asmjit_builder Builder
+//! \brief Builder interface, nodes, and passes.
+//!
+//! ### Overview
+//!
+//! Both \ref BaseBuilder and \ref BaseCompiler interfaces describe emitters
+//! that emit into a representation that allows further processing. The code
+//! stored in such representation is completely safe to be patched, simplified,
+//! reordered, obfuscated, removed, injected, analyzed, or processed some other
+//! way. Each instruction, label, directive, or other building block is stored
+//! as \ref BaseNode (or derived class like \ref InstNode or \ref LabelNode)
+//! and contains all the information necessary to pass that node later to the
+//! assembler.
+//!
+//! \ref BaseBuilder is an emitter that inherits from \ref BaseEmitter interface.
+//! It was designed to provide a maximum compatibility with the existing \ref
+//! BaseAssembler emitter so users can move from assembler to builder when needed,
+//! for example to implement post-processing, which is not possible with Assembler.
+//!
+//! ### Builder Nodes
+//!
+//! \ref BaseBuilder doesn't generate machine code directly, it uses an intermediate
+//! representation based on nodes, however, it allows to serialize to \ref BaseAssembler
+//! when the code is ready to be encoded.
+//!
+//! There are multiple node types used by both \ref BaseBuilder and \ref BaseCompiler :
+//!
+//! - Basic nodes:
+//! - \ref BaseNode - Base class for all nodes.
+//! - \ref InstNode - Represents an instruction node.
+//! - \ref AlignNode - Represents an alignment directive (.align).
+//! - \ref LabelNode - Represents a location where to bound a \ref Label.
+//!
+//! - Data nodes:
+//! - \ref EmbedDataNode - Represents data.
+//! - \ref EmbedLabelNode - Represents \ref Label address embedded as data.
+//! - \ref EmbedLabelDeltaNode - Represents a difference of two labels
+//! embedded in data.
+//! - \ref ConstPoolNode - Represents a constant pool data embedded as data.
+//!
+//! - Informative nodes:
+//! - \ref CommentNode - Represents a comment string, doesn't affect code
+//! generation.
+//! - \ref SentinelNode - A marker that can be used to remember certain
+//! position in code or data, doesn't affect code generation. Used by
+//! \ref FuncNode to mark the end of a function.
+//!
+//! - Other nodes are provided by \ref asmjit_compiler infrastructure.
+//!
+//! ### Builder Examples
+//!
+//! - \ref x86::Builder provides many X86/X64 examples.
+
+// ============================================================================
+// [Documentation - asmjit_compiler]
+// ============================================================================
+
+//! \defgroup asmjit_compiler Compiler
+//! \brief Compiler interface.
+//!
+//! ### Overview
+//!
+//! \ref BaseCompiler is a high-level interface built on top of \ref BaseBuilder
+//! interface, which provides register allocation and support for defining and
+//! invoking functions. At the moment it's the easiest way of generating code
+//! in AsmJit as most architecture and OS specifics is properly abstracted and
+//! handled by AsmJit automatically. However, abstractions also mean restrictions,
+//! which means that \ref BaseCompiler has more limitations than \ref BaseAssembler
+//! or \ref BaseBuilder.
+//!
+//! Since \ref BaseCompiler provides register allocation it also establishes the
+//! concept of functions - a function in Compiler sense is a unit in which virtual
+//! registers are allocated into physical registers by the register allocator.
+//! In addition, it enables to use such virtual registers in function invocations.
+//!
+//! \ref BaseCompiler automatically handles function calling conventions. It's
+//! still architecture dependent, but makes the code generation much easies.
+//! Functions are essential; the first-step to generate some code is to define a
+//! signature of the function to be generated (before generating the function body
+//! itself). Function arguments and return value(s) are handled by assigning
+//! virtual registers to them. Similarly, function calls are handled the same way.
+//!
+//! ### Compiler Nodes
+//!
+//! \ref BaseCompiler adds some nodes that are required for function generation
+//! and invocation:
+//!
+//! - \ref FuncNode - Represents a function definition.
+//! - \ref FuncRetNode - Represents a function return.
+//! - \ref InvokeNode - Represents a function invocation.
+//!
+//! \ref BaseCompiler also makes the use of passes (\ref Pass) and automatically
+//! adds an architecture-dependent register allocator pass to the list of passes
+//! when attached to \ref CodeHolder.
+//!
+//! ### Compiler Examples
+//!
+//! - \ref x86::Compiler provides many X86/X64 examples.
+//!
+//! ### Compiler Tips
+//!
+//! Users of AsmJit have done mistakes in the past, this section should provide
+//! some useful tips for beginners:
+//!
+//! - Virtual registers in compiler are bound to a single function. At the
+//! moment the implementation doesn't care whether a single virtual register
+//! is used in multiple functions, but it sees it as two independent virtual
+//! registers in that case. This means that virtual registers cannot be used
+//! to implement global variables. Global variables are basically memory
+//! addresses which functions can read from and write to, and they have to
+//! be implemented in the same way.
+//!
+//! - Compiler provides a useful debugging functionality, which can be turned
+//! on through \ref FormatOptions::Flags. Use \ref Logger::addFlags() to
+//! turn on additional logging features when using Compiler.
+
+// ============================================================================
+// [Documentation - asmjit_function]
+// ============================================================================
+
+//! \defgroup asmjit_function Function
+//! \brief Function definitions.
+//!
+//! ### Overview
+//!
+//! AsmJit provides functionality that can be used to define function signatures
+//! and to calculate automatically optimal function frame that can be used directly
+//! by a prolog and epilog insertion. This feature was exclusive to AsmJit's Compiler
+//! for a very long time, but was abstracted out and is now available for all users
+//! regardless of the emitter they use. The following use cases are possible:
+//!
+//! - Calculate function frame before the function is generated - this is the
+//! only way available to \ref BaseAssembler users and it will be described
+//! in this section.
+//!
+//! - Calculate function frame after the function is generated - this way is
+//! generally used by \ref BaseBuilder and \ref BaseCompiler emitters and
+//! this way is generally described in \ref asmjit_compiler section.
+//!
+//! The following concepts are used to describe and create functions in AsmJit:
+//!
+//! - \ref Type::Id - Type-id is an 8-bit value that describes a platform
+//! independent type as we know from C/C++. It provides abstractions for
+//! most common types like `int8_t`, `uint32_t`, `uintptr_t`, `float`,
+//! `double`, and all possible vector types to match ISAs up to AVX512.
+//! \ref Type::Id was introduced originally for \ref asmjit_compiler, but
+//! it's now used by \ref FuncSignature as well.
+//!
+//! - \ref CallConv - Describes a calling convention - this class contains
+//! instructions to assign registers and stack addresses to function
+//! arguments and return value(s), but doesn't specify any function
+//! signature itself. Calling conventions are architecture and OS dependent.
+//!
+//! - \ref FuncSignature - Describes a function signature, for example
+//! `int func(int, int)`. FuncSignature contains a function calling convention
+//! id, return value type, and function arguments. The signature itself is
+//! platform independent and uses \ref Type::Id to describe types of function
+//! arguments and function return value(s).
+//!
+//! - \ref FuncDetail - Architecture and ABI dependent information that describes
+//! \ref CallConv and expanded \ref FuncSignature. Each function argument and
+//! return value is represented as \ref FuncValue that contains the original
+//! \ref Type::Id enriched with additional information that specifies whether
+//! the value is passed or returned by register (and which register) or by
+//! stack. Each value also contains some other metadata that provide additional
+//! information required to handle it properly (for example whether a vector is
+//! passed indirectly by a pointer as required by WIN64 calling convention).
+//!
+//! - \ref FuncFrame - Contains information about the function frame that can
+//! be used by prolog/epilog inserter (PEI). Holds call stack size size and
+//! alignment, local stack size and alignment, and various attributes that
+//! describe how prolog and epilog should be constructed. `FuncFrame` doesn't
+//! know anything about function's arguments or return values, it hold only
+//! information necessary to create a valid and ABI conforming function prologs
+//! and epilogs.
+//!
+//! - \ref FuncArgsAssignment - A helper class that can be used to reassign
+//! function arguments into user specified registers. It's architecture and
+//! ABI dependent mapping from function arguments described by \ref CallConv
+//! and \ref FuncDetail into registers specified by the user.
+//!
+//! It's a lot of concepts where each represents one step in a function frame
+//! calculation. It can be used to create function prologs, epilogs, and also
+//! to calculate information necessary to perform function calls.
+
+// ============================================================================
+// [Documentation - asmjit_logging]
+// ============================================================================
+
+//! \defgroup asmjit_logging Logging
+//! \brief Logging and formatting.
+//!
+//! ### Overview
+//!
+//! The initial phase of a project that generates machine code is not always smooth.
+//! Failure cases are common not just at the beginning phase, but also during the
+//! development or refactoring. AsmJit provides logging functionality to address
+//! this issue. AsmJit does already a good job with function overloading to prevent
+//! from emitting unencodable instructions, but it can't prevent from emitting machine
+//! code that is correct at instruction level, but doesn't work when it's executed as
+//! a whole. Logging has always been an important part of AsmJit's infrastructure and
+//! looking at logs can sometimes reveal code generation issues quickly.
+//!
+//! AsmJit provides API for logging and formatting:
+//! - \ref Logger - A logger that you can pass to \ref CodeHolder and all emitters
+//! that inherit from \ref BaseEmitter.
+//! - \ref FormatOptions - Formatting options that can change how instructions and
+//! operands are formatted.
+//! - \ref Formatter - A namespace that provides functions that can format input
+//! data like \ref Operand, \ref BaseReg, \ref Label, and \ref BaseNode into
+//! \ref String.
+//!
+//! AsmJit's \ref Logger serves the following purposes:
+//! - Provides a basic foundation for logging.
+//! - Abstract class leaving the implementation on users. The following built-in
+//! inplementations are provided for simplicty:
+//! - \ref FileLogger implements logging into a standard `FILE` stream.
+//! - \ref StringLogger serializes all logs into a \ref String instance.
+//!
+//! AsmJit's \ref FormatOptions provides the following to customize the formatting of
+//! instructions and operands through:
+//! - \ref FormatOptions::Flags
+//! - \ref FormatOptions::IndentationType
+//!
+//! ### Logging
+//!
+//! A \ref Logger is typically attached to a \ref CodeHolder, which propagates it
+//! to all attached emitters automatically. The example below illustrates how to
+//! use \ref FileLogger that outputs to standard output:
+//!
+//! ```
+//! #include
+//! #include
+//!
+//! using namespace asmjit;
+//!
+//! int main() {
+//! JitRuntime rt; // Runtime specialized for JIT code execution.
+//! FileLogger logger(stdout); // Logger should always survive CodeHolder.
+//!
+//! CodeHolder code; // Holds code and relocation information.
+//! code.init(rt.environment()); // Initialize to the same arch as JIT runtime.
+//! code.setLogger(&logger); // Attach the `logger` to `code` holder.
+//!
+//! // ... code as usual, everything emitted will be logged to `stdout` ...
+//! return 0;
+//! }
+//! ```
+//!
+//! If output to FILE stream is not desired it's possible to use \ref StringLogger,
+//! which concatenates everything into a multi-line string:
+//!
+//! ```
+//! #include
+//! #include
+//! #include
+//!
+//! using namespace asmjit;
+//!
+//! int main() {
+//! JitRuntime rt; // Runtime specialized for JIT code execution.
+//! StringLogger logger; // Logger should always survive CodeHolder.
+//!
+//! CodeHolder code; // Holds code and relocation information.
+//! code.init(rt.environment()); // Initialize to the same arch as JIT runtime.
+//! code.setLogger(&logger); // Attach the `logger` to `code` holder.
+//!
+//! // ... code as usual, logging will be concatenated to logger string ...
+//!
+//! // You can either use the string from StringLogger directly or you can
+//! // move it. Logger::data() returns its content as null terminated char[].
+//! printf("Logger content: %s\n", logger.data());
+//!
+//! // It can be moved into your own string like this:
+//! String content = std::move(logger.content());
+//! printf("The same content: %s\n", content.data());
+//!
+//! return 0;
+//! }
+//! ```
+//!
+//! ### Formatting
+//!
+//! AsmJit uses \ref Formatter to format inputs that are then passed to \ref
+//! Logger. Formatting is public and can be used by AsmJit users as well. The
+//! most important thing to know regarding formatting is that \ref Formatter
+//! always appends to the output string, so it can be used to build complex
+//! strings without having to concatenate intermediate strings.
+//!
+//! The first example illustrates how to format operands:
+//!
+//! ```
+//! #include
+//! #include
+//!
+//! using namespace asmjit;
+//!
+//! void logOperand(uint32_t arch, const Operand_& op) {
+//! // The emitter is optional (named labels and virtual registers need it).
+//! BaseEmitter* emitter = nullptr;
+//!
+//! // No flags by default.
+//! uint32_t formatFlags = FormatOptions::kNoFlags;
+//!
+//! StringTmp<128> sb;
+//! Formatter::formatOperand(sb, formatFlags, emitter, arch, op);
+//! printf("%s\n", sb.data());
+//! }
+//!
+//! void formattingExample() {
+//! using namespace x86;
+//!
+//! // Architecture is not part of operand, it must be passed explicitly.
+//! // Format flags. We pass it explicitly also to 'logOperand' to make
+//! // compatible with what AsmJit normally does.
+//! uint32_t arch = Environment::kArchX64;
+//!
+//! log(arch, rax); // Prints 'rax'.
+//! log(arch, ptr(rax, rbx, 2)); // Prints '[rax + rbx * 4]`.
+//! log(arch, dword_ptr(rax, rbx, 2)); // Prints 'dword [rax + rbx * 4]`.
+//! log(arch, imm(42)); // Prints '42'.
+//! }
+//! ```
+//!
+//! Next example illustrates how to format whole instructions:
+//!
+//! ```
+//! #include
+//! #include
+//! #include
+//!
+//! using namespace asmjit;
+//!
+//! template
+//! void logInstruction(uint32_t arch, const BaseInst& inst, Args&&... args) {
+//! // The emitter is optional (named labels and virtual registers need it).
+//! BaseEmitter* emitter = nullptr;
+//!
+//! // No flags by default.
+//! uint32_t formatFlags = FormatOptions::kNoFlags;
+//!
+//! // The formatter expects operands in an array.
+//! Operand_ operands { std::forward(args)... };
+//!
+//! StringTmp<128> sb;
+//! Formatter::formatInstruction(
+//! sb, formatFlags, emitter, arch, inst, operands, sizeof...(args));
+//! printf("%s\n", sb.data());
+//! }
+//!
+//! void formattingExample() {
+//! using namespace x86;
+//!
+//! // Architecture is not part of operand, it must be passed explicitly.
+//! // Format flags. We pass it explicitly also to 'logOperand' to make
+//! // compatible with what AsmJit normally does.
+//! uint32_t arch = Environment::kArchX64;
+//!
+//! // Prints 'mov rax, rcx'.
+//! logInstruction(arch, BaseInst(Inst::kIdMov), rax, rcx);
+//!
+//! // Prints 'vaddpd zmm0, zmm1, [rax] {1to8}'.
+//! logInstruction(arch,
+//! BaseInst(Inst::kIdVaddpd),
+//! zmm0, zmm1, ptr(rax)._1toN());
+//!
+//! // BaseInst abstracts instruction id, instruction options, and extraReg.
+//! // Prints 'lock add [rax], rcx'.
+//! logInstruction(arch,
+//! BaseInst(Inst::kIdAdd, Inst::kOptionLock),
+//! x86::ptr(rax), rcx);
+//!
+//! // Similarly an extra register (like AVX-512 selector) can be used.
+//! // Prints 'vaddpd zmm0 {k2} {z}, zmm1, [rax]'.
+//! logInstruction(arch,
+//! BaseInst(Inst::kIdAdd, Inst::kOptionZMask, k2),
+//! zmm0, zmm1, ptr(rax));
+//! }
+//! ```
+//!
+//! And finally, the example below illustrates how to use a built-in function
+//! to format the content of \ref BaseBuilder, which consists of nodes:
+//!
+//! ```
+//! #include
+//! #include
+//!
+//! using namespace asmjit;
+//!
+//! void formattingExample(BaseBuilder* builder) {
+//! uint32_t formatFlags = FormatOptions::kNoFlags;
+//!
+//! // This also shows how temporary strings can be used.
+//! StringTmp<512> sb;
+//!
+//! // FormatNodeList requires the String for output, formatting flags, which
+//! // were zero (no extra flags), and the builder instance, which we have
+//! // provided. An overloaded version also exists, which accepts begin and
+//! // and end nodes, which can be used to only format a range of nodes.
+//! Formatter::formatNodeList(sb, formatFlags, builder);
+//!
+//! // You can do whatever else with the string, it's always null terminated,
+//! // so it can be passed to C functions like printf().
+//! printf("%s\n", sb.data());
+//! }
+//! ```
+
+// ============================================================================
+// [Documentation - asmjit_error_handling]
+// ============================================================================
+
+//! \defgroup asmjit_error_handling Error Handling
+//! \brief Error handling.
+//!
+//! ### Overview
+//!
+//! AsmJit uses error codes to represent and return errors. Every function that
+//! can fail returns an \ref Error code. Exceptions are never thrown by AsmJit
+//! itself even in extreme conditions like out-of-memory, but it's possible to
+//! override \ref ErrorHandler::handleError() to throw, in that case no error
+//! will be returned and exception will be thrown instead. All functions where
+//! this can happen are not marked `noexcept`.
+//!
+//! Errors should never be ignored, however, checking errors after each AsmJit
+//! API call would simply overcomplicate the whole code generation experience.
+//! \ref ErrorHandler exists to make the use of AsmJit API simpler as it allows
+//! to customize how errors can be handled:
+//!
+//! - Record the error and continue (the way how the error is user-implemented).
+//! - Throw an exception. AsmJit doesn't use exceptions and is completely
+//! exception-safe, but it's perfectly legal to throw an exception from
+//! the error handler.
+//! - Use plain old C's `setjmp()` and `longjmp()`. Asmjit always puts Assembler,
+//! Builder and Compiler to a consistent state before calling \ref
+//! ErrorHandler::handleError(), so `longjmp()` can be used without issues to
+//! cancel the code-generation if an error occurred. This method can be used if
+//! exception handling in your project is turned off and you still want some
+//! comfort. In most cases it should be safe as AsmJit uses \ref Zone memory
+//! and the ownership of memory it allocates always ends with the instance that
+//! allocated it. If using this approach please never jump outside the life-time
+//! of \ref CodeHolder and \ref BaseEmitter.
+//!
+//! ### Using ErrorHandler
+//!
+//! An example of attaching \ref ErrorHandler to \ref CodeHolder.
+//!
+//! ```
+//! #include
+//! #include
+//!
+//! using namespace asmjit;
+//!
+//! // A simple error handler implementation, extend according to your needs.
+//! class MyErrorHandler : public ErrorHandler {
+//! public:
+//! void handleError(Error err, const char* message, BaseEmitter* origin) override {
+//! printf("AsmJit error: %s\n", message);
+//! }
+//! };
+//!
+//! int main() {
+//! JitRuntime rt;
+//!
+//! MyErrorHandler myErrorHandler;
+//! CodeHolder code;
+//!
+//! code.init(rt.environment());
+//! code.setErrorHandler(&myErrorHandler);
+//!
+//! x86::Assembler a(&code);
+//! // ... code generation ...
+//!
+//! return 0;
+//! }
+//! ```
+//!
+//! Useful classes in error handling group:
+//!
+//! - See \ref DebugUtils that provides utilities useful for debugging.
+//! - See \ref Error that lists error codes that AsmJit uses.
+//! - See \ref ErrorHandler for more details about error handling.
+
+// ============================================================================
+// [Documentation - asmjit_instruction_db]
+// ============================================================================
+
+//! \defgroup asmjit_instruction_db Instruction DB
+//! \brief Instruction database (introspection, read/write, validation, ...).
+//!
+//! ### Overview
+//!
+//! AsmJit provides a public instruction database that can be used to query
+//! information about a complete instruction. The instruction database requires
+//! the knowledge of the following:
+//!
+//! - \ref BaseInst - Base instruction that contains instruction id, options,
+//! and a possible extra-register that represents either REP prefix counter
+//! or AVX-512 selector (mask).
+//! - \ref Operand - Represents operands of an instruction.
+//!
+//! Each instruction can be then queried for the following information:
+//!
+//! - \ref InstRWInfo - Read/write information of instruction and its oprands.
+//! - \ref OpRWInfo - Read/write information of a single operand, part of
+//! \ref InstRWInfo data structure.
+//! - \ref BaseFeatures - CPU features required to execute the instruction.
+//!
+//! In addition to query functionality AsmJit is also able to validate whether
+//! an instruction and its operands are valid. This is useful for making sure
+//! that what user tries to emit is correct and it can be also used by other
+//! projects that parse user input, like AsmTK project.
+//!
+//! ### Query API
+//!
+//! The instruction query API is provided by \ref InstAPI namespace. The
+//! following queries are possible:
+//!
+//! - \ref InstAPI::queryRWInfo() - queries read/write information of the
+//! given instruction and its operands. Includes also CPU flags read/written.
+//!
+//! - \ref InstAPI::queryFeatures() - queries CPU features that are required
+//! to execute the given instruction. A full instruction with operands must
+//! be given as some architectures like X86 may require different features
+//! for the same instruction based on its operands.
+//!
+//! - asmjit_test_x86_instinfo.cpp
+//! can be also used as a reference about accessing instruction information.
+//!
+//! ### Validation API
+//!
+//! The instruction validation API is provided by \ref InstAPI namespace in the
+//! similar fashion like the Query API, however, validation can also be turned
+//! on at \ref BaseEmitter level. The following is possible:
+//!
+//! - \ref InstAPI::validate() - low-level instruction validation function
+//! that is used internally by emitters if strict validation is enabled.
+//!
+//! - \ref BaseEmitter::addValidationOptions() - can be used to enable
+//! validation at emitter level, see \ref BaseEmitter::ValidationOptions.
+
+
+// ============================================================================
+// [Documentation - asmjit_virtual_memory]
+// ============================================================================
+
+//! \defgroup asmjit_virtual_memory Virtual Memory
+//! \brief Virtual memory management.
+//!
+//! ### Overview
+//!
+//! AsmJit's virtual memory management is divided into two main categories:
+//!
+//! - Low level API that provides cross-platform abstractions for virtual
+//! memory allocation. Implemented in \ref VirtMem namespace.
+//! - High level API that makes it very easy to store generated code for
+//! execution. See \ref JitRuntime, which is used by many examples for its
+//! simplicity and easy integration with \ref CodeHolder. There is also
+//! \ref JitAllocator, which lays somewhere between RAW memory allocation
+//! and \ref JitRuntime.
+
+// ============================================================================
+// [Documentation - asmjit_zone_memory]
+// ============================================================================
+
+//! \defgroup asmjit_zone Zone Memory
+//! \brief Zone memory allocator and containers.
+//!
+//! ### Overview
+//!
+//! AsmJit uses zone memory allocation (also known as Arena allocation) to allocate
+//! most of the data it uses. It's a fast allocator that allows AsmJit to allocate
+//! a lot of small data structures fast and without `malloc()` overhead. Since
+//! code generators and all related classes are usually short-lived this approach
+//! decreases memory usage and fragmentation as arena-based allocators always
+//! allocate larger blocks of memory, which are then split into smaller chunks.
+//!
+//! Another advantage of zone memory allocation is that since the whole library
+//! uses this strategy it's very easy to deallocate everything that a particular
+//! instance is holding by simply releasing the memory the allocator holds. This
+//! improves destruction time of such objects as there is no destruction at all.
+//! Long-lived objects just reset its data in destructor or in their reset()
+//! member function for a future reuse. For this purpose all containers in AsmJit
+//! are also zone allocated.
+//!
+//! ### Zone Allocation
+//!
+//! - \ref Zone - Incremental zone memory allocator with minimum features. It
+//! can only allocate memory without the possibility to return it back to
+//! the allocator.
+//!
+//! - \ref ZoneTmp - A temporary \ref Zone with some initial static storage.
+//! If the allocation requests fit the static storage allocated then there
+//! will be no dynamic memory allocation during the lifetime of \ref ZoneTmp,
+//! otherwise it would act as \ref Zone with one preallocated block on the
+//! stack.
+//!
+//! - \ref ZoneAllocator - A wrapper of \ref Zone that provides the capability
+//! of returning memory to the allocator. Such memory is stored in a pool for
+//! later reuse.
+//!
+//! ### Zone Allocated Containers
+//!
+//! - \ref ZoneString - Zone allocated string.
+//! - \ref ZoneHash - Zone allocated hash table.
+//! - \ref ZoneTree - Zone allocated red-black tree.
+//! - \ref ZoneList - Zone allocated double-linked list.
+//! - \ref ZoneStack - Zone allocated stack.
+//! - \ref ZoneVector - Zone allocated vector.
+//! - \ref ZoneBitVector - Zone allocated vector of bits.
+//!
+//! ### Using Zone Allocated Containers
+//!
+//! The most common data structure exposed by AsmJit is \ref ZoneVector. It's very
+//! similar to `std::vector`, but the implementation doesn't use exceptions and
+//! uses the mentioned \ref ZoneAllocator for performance reasons. You don't have
+//! to worry about allocations as you should not need to add items to AsmJit's
+//! data structures directly as there should be API for all required operations.
+//!
+//! The following APIs in \ref CodeHolder returns \ref ZoneVector reference:
+//!
+//! ```
+//! using namespace asmjit;
+//!
+//! void example(CodeHolder& code) {
+//! // Contains all emitters attached to CodeHolder.
+//! const ZoneVector& emitters = code.emitters();
+//!
+//! // Contains all section entries managed by CodeHolder.
+//! const ZoneVector& sections = code.sections();
+//!
+//! // Contains all label entries managed by CodeHolder.
+//! const ZoneVector& labelEntries = code.labelEntries();
+//!
+//! // Contains all relocation entries managed by CodeHolder.
+//! const ZoneVector& relocEntries = code.relocEntries();
+//! }
+//! ```
+//!
+//! \ref ZoneVector has overloaded array access operator to make it possible
+//! to access its elements through operator[]. Some standard functions like
+//! \ref ZoneVector::empty(), \ref ZoneVector::size(), and \ref ZoneVector::data()
+//! are provided as well. Vectors are also iterable through a range-based for loop:
+//!
+//! ```
+//! using namespace asmjit;
+//!
+//! void example(CodeHolder& code) {
+//! for (LabelEntry* le : code.labelEntries()) {
+//! printf("Label #%u {Bound=%s Offset=%llu}",
+//! le->id(),
+//! le->isBound() ? "true" : "false",
+//! (unsigned long long)le->offset());
+//! }
+//! }
+//! ```
+//!
+//! ### Design Considerations
+//!
+//! Zone-allocated containers do not store the allocator within the container.
+//! This decision was made to reduce the footprint of such containers as AsmJit
+//! tooling, especially Compiler's register allocation, may use many instances
+//! of such containers to perform code analysis and register allocation.
+//!
+//! For example to append an item into a \ref ZoneVector it's required to pass
+//! the allocator as the first argument, so it can be used in case that the
+//! vector needs a reallocation. Such function also returns an error, which
+//! must be propagated to the caller.
+//!
+//! ```
+//! using namespace asmjit
+//!
+//! Error example(ZoneAllocator* allocator) {
+//! ZoneVector vector;
+//!
+//! // Unfortunately, allocator must be provided to all functions that mutate
+//! // the vector. However, AsmJit users should never need to do this as all
+//! // manipulation should be done through public API, which takes care of
+//! // that.
+//! for (int i = 0; i < 100; i++) {
+//! ASMJIT_PROPAGATE(vector.append(allocator, i));
+//! }
+//!
+//! // By default vector's destructor doesn't release anything as it knows
+//! // that its content is zone allocated. However, \ref ZoneVector::release
+//! // can be used to explicitly release the vector data to the allocator if
+//! // necessary
+//! vector.release(allocator);
+//! }
+//! ```
+//!
+//! Containers like \ref ZoneVector also provide a functionality to reserve a
+//! certain number of items before any items are added to it. This approach is
+//! used internally in most places as it allows to prepare space for data that
+//! will be added to some container before the data itself was created.
+//!
+//! ```
+//! using namespace asmjit
+//!
+//! Error example(ZoneAllocator* allocator) {
+//! ZoneVector vector;
+//!
+//! ASMJIT_PROPAGATE(vector.willGrow(100));
+//! for (int i = 0; i < 100; i++) {
+//! // Cannot fail.
+//! vector.appendUnsafe(allocator, i);
+//! }
+//!
+//! vector.release(allocator);
+//! }
+//! ```
+
+// ============================================================================
+// [Documentation - asmjit_utilities]
+// ============================================================================
+
+//! \defgroup asmjit_utilities Utilities
+//! \brief Utility classes and functions.
+//!
+//! ### Overview
+//!
+//! AsmJit uses and provides utility classes and functions, that can be used
+//! with AsmJit. The functionality can be divided into the following topics:
+//!
+//! ### String Functionality
+//!
+//! - \ref String - AsmJit's string container, which is used internally
+//! and which doesn't use exceptions and has a stable layout, which is
+//! not dependent on C++ standard library.
+//! - \ref StringTmp - String that can have base storage allocated on
+//! stack. The amount of storage on stack can be specified as a template
+//! parameter.
+//! - \ref FixedString - Fixed string container limited up to N characters.
+//!
+//! ### Code Generation Utilities
+//!
+//! - \ref ConstPool - Constant pool used by \ref BaseCompiler, but also
+//! available to users that may find use of it.
+//!
+//! ### Support Functionality Used by AsmJit
+//!
+//! - \ref Support namespace provides many other utility functions and
+//! classes that are used by AsmJit, and made public.
+
+// ============================================================================
+// [Documentation - asmjit_ backends]
+// ============================================================================
+
+//! \defgroup asmjit_x86 X86 Backend
+//! \brief X86/X64 backend.
+
+// ============================================================================
+// [Documentation - asmjit_ra]
+// ============================================================================
+
+//! \cond INTERNAL
+//! \defgroup asmjit_ra RA
+//! \brief Register allocator internals.
+//! \endcond
+
+} // {asmjit}
+
+// ============================================================================
+// [Core Headers]
+// ============================================================================
+
+#include "asmjit-scope-begin.h"
+#include "core/archtraits.h"
+#include "core/assembler.h"
+#include "core/builder.h"
+#include "core/codeholder.h"
+#include "core/compiler.h"
+#include "core/constpool.h"
+#include "core/cpuinfo.h"
+#include "core/datatypes.h"
+#include "core/emitter.h"
+#include "core/environment.h"
+#include "core/errorhandler.h"
+#include "core/features.h"
+#include "core/formatter.h"
+#include "core/func.h"
+#include "core/globals.h"
+#include "core/inst.h"
+#include "core/jitallocator.h"
+#include "core/jitruntime.h"
+#include "core/logger.h"
+#include "core/operand.h"
+#include "core/osutils.h"
+#include "core/string.h"
+#include "core/support.h"
+#include "core/target.h"
+#include "core/type.h"
+#include "core/virtmem.h"
+#include "core/zone.h"
+#include "core/zonehash.h"
+#include "core/zonelist.h"
+#include "core/zonetree.h"
+#include "core/zonestack.h"
+#include "core/zonestring.h"
+#include "core/zonevector.h"
+#include "asmjit-scope-end.h"
+
+// ============================================================================
+// [Deprecated]
+// ============================================================================
+
+#ifndef ASMJIT_NO_DEPRECATED
+namespace asmjit {
+
+#ifndef ASMJIT_NO_COMPILER
+ASMJIT_DEPRECATED("Use InvokeNode instead of FuncCallNode")
+typedef InvokeNode FuncCallNode;
+#endif // !ASMJIT_NO_COMPILER
+
+#ifndef ASMJIT_NO_LOGGING
+namespace Logging { using namespace Formatter; }
+#endif //! ASMJIT_NO_LOGGING
+
+} // {asmjit}
+#endif // !ASMJIT_NO_DEPRECATED
+
+#endif // ASMJIT_CORE_H_INCLUDED
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/api-build_p.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/api-build_p.h
new file mode 100644
index 0000000..db37ca7
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/api-build_p.h
@@ -0,0 +1,77 @@
+// AsmJit - Machine code generation for C++
+//
+// * Official AsmJit Home Page: https://asmjit.com
+// * Official Github Repository: https://github.com/asmjit/asmjit
+//
+// Copyright (c) 2008-2020 The AsmJit Authors
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+#ifndef ASMJIT_CORE_API_BUILD_P_H_INCLUDED
+#define ASMJIT_CORE_API_BUILD_P_H_INCLUDED
+
+#define ASMJIT_EXPORTS
+
+// Only turn-off these warnings when building asmjit itself.
+#ifdef _MSC_VER
+ #ifndef _CRT_SECURE_NO_DEPRECATE
+ #define _CRT_SECURE_NO_DEPRECATE
+ #endif
+ #ifndef _CRT_SECURE_NO_WARNINGS
+ #define _CRT_SECURE_NO_WARNINGS
+ #endif
+#endif
+
+// Dependencies only required for asmjit build, but never exposed through public headers.
+#ifdef _WIN32
+ #ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+ #endif
+ #ifndef NOMINMAX
+ #define NOMINMAX
+ #endif
+ #include
+#endif
+
+// ============================================================================
+// [asmjit::Build - Globals - Build-Only]
+// ============================================================================
+
+#include "./api-config.h"
+
+#if !defined(ASMJIT_BUILD_DEBUG) && defined(__GNUC__) && !defined(__clang__)
+ #define ASMJIT_FAVOR_SIZE __attribute__((__optimize__("Os")))
+ #define ASMJIT_FAVOR_SPEED __attribute__((__optimize__("O3")))
+#elif ASMJIT_CXX_HAS_ATTRIBUTE(__minsize__, 0)
+ #define ASMJIT_FAVOR_SIZE __attribute__((__minsize__))
+ #define ASMJIT_FAVOR_SPEED
+#else
+ #define ASMJIT_FAVOR_SIZE
+ #define ASMJIT_FAVOR_SPEED
+#endif
+
+// Make sure '#ifdef'ed unit tests are properly highlighted in IDE.
+#if !defined(ASMJIT_TEST) && defined(__INTELLISENSE__)
+ #define ASMJIT_TEST
+#endif
+
+// Include a unit testing package if this is a `asmjit_test_unit` build.
+#if defined(ASMJIT_TEST)
+ #include "../../../test/broken.h"
+#endif
+
+#endif // ASMJIT_CORE_API_BUILD_P_H_INCLUDED
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/api-config.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/api-config.h
new file mode 100644
index 0000000..aab3473
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/api-config.h
@@ -0,0 +1,552 @@
+// AsmJit - Machine code generation for C++
+//
+// * Official AsmJit Home Page: https://asmjit.com
+// * Official Github Repository: https://github.com/asmjit/asmjit
+//
+// Copyright (c) 2008-2020 The AsmJit Authors
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+#ifndef ASMJIT_CORE_API_CONFIG_H_INCLUDED
+#define ASMJIT_CORE_API_CONFIG_H_INCLUDED
+
+// ============================================================================
+// [asmjit::Version]
+// ============================================================================
+
+//! \addtogroup asmjit_core
+//! \{
+
+//! AsmJit library version in `(Major << 16) | (Minor << 8) | (Patch)` format.
+#define ASMJIT_LIBRARY_VERSION 0x010400 /* 1.4.0 */
+
+//! \}
+
+// ============================================================================
+// [asmjit::Build - Documentation]
+// ============================================================================
+
+// NOTE: Doxygen cannot document macros that are not defined, that's why we have
+// to define them and then undefine them, so it won't use the macros with its
+// own preprocessor.
+#ifdef _DOXYGEN
+namespace asmjit {
+
+//! \addtogroup asmjit_build
+//! \{
+
+//! Asmjit is embedded, implies \ref ASMJIT_STATIC.
+#define ASMJIT_EMBED
+
+//! Enables static-library build.
+#define ASMJIT_STATIC
+
+//! Defined when AsmJit's build configuration is 'Debug'.
+//!
+//! \note Can be defined explicitly to bypass autodetection.
+#define ASMJIT_BUILD_DEBUG
+
+//! Defined when AsmJit's build configuration is 'Release'.
+//!
+//! \note Can be defined explicitly to bypass autodetection.
+#define ASMJIT_BUILD_RELEASE
+
+//! Defined to build X86/X64 backend.
+#define ASMJIT_BUILD_X86
+
+//! Defined to build host backend autodetected at compile-time.
+#define ASMJIT_BUILD_HOST
+
+//! Disables deprecated API at compile time.
+#define ASMJIT_NO_DEPRECATED
+
+//! Disable non-host architectures entirely.
+#define ASMJIT_NO_FOREIGN
+
+//! Disables \ref asmjit_builder functionality completely.
+#define ASMJIT_NO_BUILDER
+
+//! Disables \ref asmjit_compiler functionality completely.
+#define ASMJIT_NO_COMPILER
+
+//! Disables JIT memory management and \ref JitRuntime.
+#define ASMJIT_NO_JIT
+
+//! Disables \ref Logger and \ref Formatter.
+#define ASMJIT_NO_LOGGING
+
+//! Disables everything that contains text.
+#define ASMJIT_NO_TEXT
+
+//! Disables instruction validation API.
+#define ASMJIT_NO_VALIDATION
+
+//! Disables instruction introspection API.
+#define ASMJIT_NO_INTROSPECTION
+
+// Avoid doxygen preprocessor using feature-selection definitions.
+#undef ASMJIT_NO_BUILDER
+#undef ASMJIT_NO_COMPILER
+#undef ASMJIT_NO_JIT
+#undef ASMJIT_NO_LOGGING
+#undef ASMJIT_NO_TEXT
+#undef ASMJIT_NO_VALIDATION
+#undef ASMJIT_NO_INTROSPECTION
+
+//! \}
+
+} // {asmjit}
+#endif // _DOXYGEN
+
+// Enable all features at IDE level, so it's properly highlighted and indexed.
+#ifdef __INTELLISENSE__
+ #ifndef ASMJIT_BUILD_X86
+ #define ASMJIT_BUILD_X86
+ #endif
+#endif
+
+// ============================================================================
+// [asmjit::Dependencies]
+// ============================================================================
+
+// We really want std-types as globals.
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#if !defined(_WIN32) && !defined(__EMSCRIPTEN__)
+ #include
+#endif
+
+
+// ============================================================================
+// [asmjit::Options]
+// ============================================================================
+
+// ASMJIT_NO_BUILDER implies ASMJIT_NO_COMPILER.
+#if defined(ASMJIT_NO_BUILDER) && !defined(ASMJIT_NO_COMPILER)
+ #define ASMJIT_NO_COMPILER
+#endif
+
+// Prevent compile-time errors caused by misconfiguration.
+#if defined(ASMJIT_NO_TEXT) && !defined(ASMJIT_NO_LOGGING)
+ #pragma "ASMJIT_NO_TEXT can only be defined when ASMJIT_NO_LOGGING is defined."
+ #undef ASMJIT_NO_TEXT
+#endif
+
+#if defined(ASMJIT_NO_INTROSPECTION) && !defined(ASMJIT_NO_COMPILER)
+ #pragma message("ASMJIT_NO_INTROSPECTION can only be defined when ASMJIT_NO_COMPILER is defined")
+ #undef ASMJIT_NO_INTROSPECTION
+#endif
+
+// ============================================================================
+// [asmjit::Build - Globals - Deprecated]
+// ============================================================================
+
+#ifndef ASMJIT_NO_DEPRECATED
+ #if defined(ASMJIT_BUILD_EMBED) || defined(ASMJIT_BUILD_STATIC)
+ #if defined(ASMJIT_BUILD_EMBED)
+ #pragma message("'ASMJIT_BUILD_EMBED' is deprecated, use 'ASMJIT_STATIC'")
+ #endif
+ #if defined(ASMJIT_BUILD_STATIC)
+ #pragma message("'ASMJIT_BUILD_STATIC' is deprecated, use 'ASMJIT_STATIC'")
+ #endif
+
+ #if !defined(ASMJIT_STATIC)
+ #define ASMJIT_STATIC
+ #endif
+ #endif
+#endif // !ASMJIT_NO_DEPRECATED
+
+// ============================================================================
+// [asmjit::Build - Globals - Build Mode]
+// ============================================================================
+
+// Detect ASMJIT_BUILD_DEBUG and ASMJIT_BUILD_RELEASE if not defined.
+#if !defined(ASMJIT_BUILD_DEBUG) && !defined(ASMJIT_BUILD_RELEASE)
+ #if !defined(NDEBUG)
+ #define ASMJIT_BUILD_DEBUG
+ #else
+ #define ASMJIT_BUILD_RELEASE
+ #endif
+#endif
+
+// ============================================================================
+// [asmjit::Build - Globals - Target Architecture Information]
+// ============================================================================
+
+#if defined(_M_X64) || defined(__x86_64__)
+ #define ASMJIT_ARCH_X86 64
+#elif defined(_M_IX86) || defined(__X86__) || defined(__i386__)
+ #define ASMJIT_ARCH_X86 32
+#else
+ #define ASMJIT_ARCH_X86 0
+#endif
+
+#if defined(__arm64__) || defined(__aarch64__)
+# define ASMJIT_ARCH_ARM 64
+#elif defined(_M_ARM) || defined(_M_ARMT) || defined(__arm__) || defined(__thumb__) || defined(__thumb2__)
+ #define ASMJIT_ARCH_ARM 32
+#else
+ #define ASMJIT_ARCH_ARM 0
+#endif
+
+#if defined(_MIPS_ARCH_MIPS64) || defined(__mips64)
+ #define ASMJIT_ARCH_MIPS 64
+#elif defined(_MIPS_ARCH_MIPS32) || defined(_M_MRX000) || defined(__mips__)
+ #define ASMJIT_ARCH_MIPS 32
+#else
+ #define ASMJIT_ARCH_MIPS 0
+#endif
+
+#define ASMJIT_ARCH_BITS (ASMJIT_ARCH_X86 | ASMJIT_ARCH_ARM | ASMJIT_ARCH_MIPS)
+#if ASMJIT_ARCH_BITS == 0
+ #undef ASMJIT_ARCH_BITS
+ #if defined (__LP64__) || defined(_LP64)
+ #define ASMJIT_ARCH_BITS 64
+ #else
+ #define ASMJIT_ARCH_BITS 32
+ #endif
+#endif
+
+#if (defined(__ARMEB__)) || \
+ (defined(__MIPSEB__)) || \
+ (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
+ #define ASMJIT_ARCH_LE 0
+ #define ASMJIT_ARCH_BE 1
+#else
+ #define ASMJIT_ARCH_LE 1
+ #define ASMJIT_ARCH_BE 0
+#endif
+
+// ============================================================================
+// [asmjit::Build - Globals - Build Architectures Definitions]
+// ============================================================================
+
+#if !defined(ASMJIT_NO_FOREIGN)
+ // If 'ASMJIT_NO_FOREIGN' is not defined then all architectures will be built.
+ #if !defined(ASMJIT_BUILD_X86)
+ #define ASMJIT_BUILD_X86
+ #endif
+#else
+ // Detect architectures to build if building only for the host architecture.
+ #if ASMJIT_ARCH_X86 && !defined(ASMJIT_BUILD_X86)
+ #define ASMJIT_BUILD_X86
+ #endif
+#endif
+
+// Define 'ASMJIT_BUILD_HOST' if we know that host architecture will be built.
+#if !defined(ASMJIT_BUILD_HOST) && ASMJIT_ARCH_X86 && defined(ASMJIT_BUILD_X86)
+ #define ASMJIT_BUILD_HOST
+#endif
+
+// ============================================================================
+// [asmjit::Build - Globals - C++ Compiler and Features Detection]
+// ============================================================================
+
+#define ASMJIT_CXX_GNU 0
+#define ASMJIT_CXX_MAKE_VER(MAJOR, MINOR) ((MAJOR) * 1000 + (MINOR))
+
+// Intel Compiler [pretends to be GNU or MSC, so it must be checked first]:
+// - https://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler
+// - https://software.intel.com/en-us/articles/c14-features-supported-by-intel-c-compiler
+// - https://software.intel.com/en-us/articles/c17-features-supported-by-intel-c-compiler
+#if defined(__INTEL_COMPILER)
+
+// MSC Compiler:
+// - https://msdn.microsoft.com/en-us/library/hh567368.aspx
+//
+// Version List:
+// - 16.00.0 == VS2010
+// - 17.00.0 == VS2012
+// - 18.00.0 == VS2013
+// - 19.00.0 == VS2015
+// - 19.10.0 == VS2017
+#elif defined(_MSC_VER) && defined(_MSC_FULL_VER)
+
+// Clang Compiler [Pretends to be GNU, so it must be checked before]:
+// - https://clang.llvm.org/cxx_status.html
+#elif defined(__clang_major__) && defined(__clang_minor__) && defined(__clang_patchlevel__)
+
+// GNU Compiler:
+// - https://gcc.gnu.org/projects/cxx-status.html
+#elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
+
+ #undef ASMJIT_CXX_GNU
+ #define ASMJIT_CXX_GNU ASMJIT_CXX_MAKE_VER(__GNUC__, __GNUC_MINOR__)
+
+#endif
+
+// Compiler features detection macros.
+#if defined(__clang__) && defined(__has_attribute)
+ #define ASMJIT_CXX_HAS_ATTRIBUTE(NAME, CHECK) (__has_attribute(NAME))
+#else
+ #define ASMJIT_CXX_HAS_ATTRIBUTE(NAME, CHECK) (!(!(CHECK)))
+#endif
+
+// ============================================================================
+// [asmjit::Build - Globals - API Decorators & Language Extensions]
+// ============================================================================
+
+// API (Export / Import).
+#if !defined(ASMJIT_STATIC)
+ #if defined(_WIN32) && (defined(_MSC_VER) || defined(__MINGW32__))
+ #ifdef ASMJIT_EXPORTS
+ #define ASMJIT_API __declspec(dllexport)
+ #else
+ #define ASMJIT_API __declspec(dllimport)
+ #endif
+ #elif defined(_WIN32) && defined(__GNUC__)
+ #ifdef ASMJIT_EXPORTS
+ #define ASMJIT_API __attribute__((__dllexport__))
+ #else
+ #define ASMJIT_API __attribute__((__dllimport__))
+ #endif
+ #elif defined(__GNUC__)
+ #define ASMJIT_API __attribute__((__visibility__("default")))
+ #endif
+#endif
+
+#if !defined(ASMJIT_API)
+ #define ASMJIT_API
+#endif
+
+#if !defined(ASMJIT_VARAPI)
+ #define ASMJIT_VARAPI extern ASMJIT_API
+#endif
+
+// This is basically a workaround. When using MSVC and marking class as DLL
+// export everything gets exported, which is unwanted in most projects. MSVC
+// automatically exports typeinfo and vtable if at least one symbol of the
+// class is exported. However, GCC has some strange behavior that even if
+// one or more symbol is exported it doesn't export typeinfo unless the
+// class itself is decorated with "visibility(default)" (i.e. ASMJIT_API).
+#if !defined(_WIN32) && defined(__GNUC__)
+ #define ASMJIT_VIRTAPI ASMJIT_API
+#else
+ #define ASMJIT_VIRTAPI
+#endif
+
+// Function attributes.
+#if !defined(ASMJIT_BUILD_DEBUG) && defined(__GNUC__)
+ #define ASMJIT_INLINE inline __attribute__((__always_inline__))
+#elif !defined(ASMJIT_BUILD_DEBUG) && defined(_MSC_VER)
+ #define ASMJIT_INLINE __forceinline
+#else
+ #define ASMJIT_INLINE inline
+#endif
+
+#if defined(__GNUC__)
+ #define ASMJIT_NOINLINE __attribute__((__noinline__))
+ #define ASMJIT_NORETURN __attribute__((__noreturn__))
+#elif defined(_MSC_VER)
+ #define ASMJIT_NOINLINE __declspec(noinline)
+ #define ASMJIT_NORETURN __declspec(noreturn)
+#else
+ #define ASMJIT_NOINLINE
+ #define ASMJIT_NORETURN
+#endif
+
+// Calling conventions.
+#if ASMJIT_ARCH_X86 == 32 && defined(__GNUC__)
+ #define ASMJIT_CDECL __attribute__((__cdecl__))
+ #define ASMJIT_STDCALL __attribute__((__stdcall__))
+ #define ASMJIT_FASTCALL __attribute__((__fastcall__))
+ #define ASMJIT_REGPARM(N) __attribute__((__regparm__(N)))
+#elif ASMJIT_ARCH_X86 == 32 && defined(_MSC_VER)
+ #define ASMJIT_CDECL __cdecl
+ #define ASMJIT_STDCALL __stdcall
+ #define ASMJIT_FASTCALL __fastcall
+ #define ASMJIT_REGPARM(N)
+#else
+ #define ASMJIT_CDECL
+ #define ASMJIT_STDCALL
+ #define ASMJIT_FASTCALL
+ #define ASMJIT_REGPARM(N)
+#endif
+
+#if ASMJIT_ARCH_X86 && defined(_WIN32) && defined(_MSC_VER)
+ #define ASMJIT_VECTORCALL __vectorcall
+#elif ASMJIT_ARCH_X86 && defined(_WIN32)
+ #define ASMJIT_VECTORCALL __attribute__((__vectorcall__))
+#else
+ #define ASMJIT_VECTORCALL
+#endif
+
+
+// Type alignment (not allowed by C++11 'alignas' keyword).
+#if defined(__GNUC__)
+ #define ASMJIT_ALIGN_TYPE(TYPE, N) __attribute__((__aligned__(N))) TYPE
+#elif defined(_MSC_VER)
+ #define ASMJIT_ALIGN_TYPE(TYPE, N) __declspec(align(N)) TYPE
+#else
+ #define ASMJIT_ALIGN_TYPE(TYPE, N) TYPE
+#endif
+
+//! \def ASMJIT_MAY_ALIAS
+//!
+//! Expands to `__attribute__((__may_alias__))` if supported.
+#if defined(__GNUC__)
+ #define ASMJIT_MAY_ALIAS __attribute__((__may_alias__))
+#else
+ #define ASMJIT_MAY_ALIAS
+#endif
+
+//! \def ASMJIT_LIKELY(...)
+//!
+//! Condition is likely to be taken (mostly error handling and edge cases).
+
+//! \def ASMJIT_UNLIKELY(...)
+//!
+//! Condition is unlikely to be taken (mostly error handling and edge cases).
+#if defined(__GNUC__)
+ #define ASMJIT_LIKELY(...) __builtin_expect(!!(__VA_ARGS__), 1)
+ #define ASMJIT_UNLIKELY(...) __builtin_expect(!!(__VA_ARGS__), 0)
+#else
+ #define ASMJIT_LIKELY(...) (__VA_ARGS__)
+ #define ASMJIT_UNLIKELY(...) (__VA_ARGS__)
+#endif
+
+//! \def ASMJIT_FALLTHROUGH
+//!
+//! Portable [[fallthrough]] attribute.
+#if defined(__clang__) && __cplusplus >= 201103L
+ #define ASMJIT_FALLTHROUGH [[clang::fallthrough]]
+#elif defined(__GNUC__) && __GNUC__ >= 7
+ #define ASMJIT_FALLTHROUGH __attribute__((__fallthrough__))
+#else
+ #define ASMJIT_FALLTHROUGH ((void)0) /* fallthrough */
+#endif
+
+//! \def ASMJIT_DEPRECATED
+//!
+//! Marks function, class, struct, enum, or anything else as deprecated.
+#if defined(__GNUC__)
+ #define ASMJIT_DEPRECATED(MESSAGE) __attribute__((__deprecated__(MESSAGE)))
+ #if defined(__clang__)
+ #define ASMJIT_DEPRECATED_STRUCT(MESSAGE) __attribute__((__deprecated__(MESSAGE)))
+ #else
+ #define ASMJIT_DEPRECATED_STRUCT(MESSAGE) /* not usable if a deprecated function uses it */
+ #endif
+#elif defined(_MSC_VER)
+ #define ASMJIT_DEPRECATED(MESSAGE) __declspec(deprecated(MESSAGE))
+ #define ASMJIT_DEPRECATED_STRUCT(MESSAGE) /* not usable if a deprecated function uses it */
+#else
+ #define ASMJIT_DEPRECATED(MESSAGE)
+ #define ASMJIT_DEPRECATED_STRUCT(MESSAGE)
+#endif
+
+// Utilities.
+#define ASMJIT_OFFSET_OF(STRUCT, MEMBER) ((int)(intptr_t)((const char*)&((const STRUCT*)0x100)->MEMBER) - 0x100)
+#define ASMJIT_ARRAY_SIZE(X) uint32_t(sizeof(X) / sizeof(X[0]))
+
+#if ASMJIT_CXX_HAS_ATTRIBUTE(no_sanitize, 0)
+ #define ASMJIT_ATTRIBUTE_NO_SANITIZE_UNDEF __attribute__((__no_sanitize__("undefined")))
+#elif ASMJIT_CXX_GNU >= ASMJIT_CXX_MAKE_VER(4, 9)
+ #define ASMJIT_ATTRIBUTE_NO_SANITIZE_UNDEF __attribute__((__no_sanitize_undefined__))
+#else
+ #define ASMJIT_ATTRIBUTE_NO_SANITIZE_UNDEF
+#endif
+
+// ============================================================================
+// [asmjit::Build - Globals - Begin-Namespace / End-Namespace]
+// ============================================================================
+
+#if defined(__clang__)
+ #define ASMJIT_BEGIN_NAMESPACE \
+ namespace asmjit { \
+ _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Wconstant-logical-operand\"") \
+ _Pragma("clang diagnostic ignored \"-Wunnamed-type-template-args\"")
+ #define ASMJIT_END_NAMESPACE \
+ _Pragma("clang diagnostic pop") \
+ }
+#elif defined(__GNUC__) && __GNUC__ == 4
+ #define ASMJIT_BEGIN_NAMESPACE \
+ namespace asmjit { \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"")
+ #define ASMJIT_END_NAMESPACE \
+ _Pragma("GCC diagnostic pop") \
+ }
+#elif defined(__GNUC__) && __GNUC__ >= 8
+ #define ASMJIT_BEGIN_NAMESPACE \
+ namespace asmjit { \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wclass-memaccess\"")
+ #define ASMJIT_END_NAMESPACE \
+ _Pragma("GCC diagnostic pop") \
+ }
+#elif defined(_MSC_VER) && !defined(__INTEL_COMPILER)
+ #define ASMJIT_BEGIN_NAMESPACE \
+ namespace asmjit { \
+ __pragma(warning(push)) \
+ __pragma(warning(disable: 4127)) /* conditional expression is const */ \
+ __pragma(warning(disable: 4201)) /* nameless struct/union */
+ #define ASMJIT_END_NAMESPACE \
+ __pragma(warning(pop)) \
+ }
+#endif
+
+#if !defined(ASMJIT_BEGIN_NAMESPACE) && !defined(ASMJIT_END_NAMESPACE)
+ #define ASMJIT_BEGIN_NAMESPACE namespace asmjit {
+ #define ASMJIT_END_NAMESPACE }
+#endif
+
+#define ASMJIT_BEGIN_SUB_NAMESPACE(NAMESPACE) \
+ ASMJIT_BEGIN_NAMESPACE \
+ namespace NAMESPACE {
+
+#define ASMJIT_END_SUB_NAMESPACE \
+ } \
+ ASMJIT_END_NAMESPACE
+
+// ============================================================================
+// [asmjit::Build - Globals - Utilities]
+// ============================================================================
+
+#define ASMJIT_NONCOPYABLE(...) \
+ private: \
+ __VA_ARGS__(const __VA_ARGS__& other) = delete; \
+ __VA_ARGS__& operator=(const __VA_ARGS__& other) = delete; \
+ public:
+
+#define ASMJIT_NONCONSTRUCTIBLE(...) \
+ private: \
+ __VA_ARGS__() = delete; \
+ __VA_ARGS__(const __VA_ARGS__& other) = delete; \
+ __VA_ARGS__& operator=(const __VA_ARGS__& other) = delete; \
+ public:
+
+// ============================================================================
+// [asmjit::Build - Globals - Cleanup]
+// ============================================================================
+
+// Cleanup definitions that are only used within this header file.
+#undef ASMJIT_CXX_GNU
+#undef ASMJIT_CXX_MAKE_VER
+
+#endif // ASMJIT_CORE_API_CONFIG_H_INCLUDED
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/archcommons.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/archcommons.h
new file mode 100644
index 0000000..fda2451
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/archcommons.h
@@ -0,0 +1,164 @@
+// AsmJit - Machine code generation for C++
+//
+// * Official AsmJit Home Page: https://asmjit.com
+// * Official Github Repository: https://github.com/asmjit/asmjit
+//
+// Copyright (c) 2008-2020 The AsmJit Authors
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+#ifndef ASMJIT_CORE_ARCHCOMMONS_H_INCLUDED
+#define ASMJIT_CORE_ARCHCOMMONS_H_INCLUDED
+
+// This file provides architecture-specific classes that are required in the
+// core library. For example Imm operand allows to be created from arm::Shift
+// in a const-expr way, so the arm::Shift must be provided. So this header
+// file provides everything architecture-specific that is used by the Core API.
+
+#include "../core/globals.h"
+
+// ============================================================================
+// [asmjit::arm]
+// ============================================================================
+
+ASMJIT_BEGIN_SUB_NAMESPACE(arm)
+
+//! \addtogroup asmjit_arm
+//! \{
+
+//! Represents ARM immediate shift operation type and value.
+class Shift {
+public:
+ //! Operation predicate (ARM) describes either SHIFT or EXTEND operation.
+ //!
+ //! \note The constants are AsmJit specific. The first 5 values describe real
+ //! constants on ARM32 and AArch64 hardware, however, the addition constants
+ //! that describe extend modes are specific to AsmJit and would be translated
+ //! to the AArch64 specific constants by the assembler.
+ enum Op : uint32_t {
+ //! Shift left logical operation (default).
+ //!
+ //! Available to all ARM architectures.
+ kOpLSL = 0x00u,
+
+ //! Shift right logical operation.
+ //!
+ //! Available to all ARM architectures.
+ kOpLSR = 0x01u,
+
+ //! Shift right arithmetic operation.
+ //!
+ //! Available to all ARM architectures.
+ kOpASR = 0x02u,
+
+ //! Rotate right operation.
+ //!
+ //! \note Not available in AArch64 mode.
+ kOpROR = 0x03u,
+
+ //! Rotate right with carry operation (encoded as `kShiftROR` with zero).
+ //!
+ //! \note Not available in AArch64 mode.
+ kOpRRX = 0x04u,
+
+ //! Shift left by filling low order bits with ones.
+ kOpMSL = 0x05u,
+
+ //! UXTN extend register operation (AArch64 only).
+ kOpUXTB = 0x06u,
+ //! UXTH extend register operation (AArch64 only).
+ kOpUXTH = 0x07u,
+ //! UXTW extend register operation (AArch64 only).
+ kOpUXTW = 0x08u,
+ //! UXTX extend register operation (AArch64 only).
+ kOpUXTX = 0x09u,
+
+ //! SXTB extend register operation (AArch64 only).
+ kOpSXTB = 0x0Au,
+ //! SXTH extend register operation (AArch64 only).
+ kOpSXTH = 0x0Bu,
+ //! SXTW extend register operation (AArch64 only).
+ kOpSXTW = 0x0Cu,
+ //! SXTX extend register operation (AArch64 only).
+ kOpSXTX = 0x0Du
+
+ // NOTE: 0xE and 0xF are used by memory operand to specify POST|PRE offset mode.
+ };
+
+ //! Shift operation.
+ uint32_t _op;
+ //! Shift Value.
+ uint32_t _value;
+
+ //! Default constructed Shift is not initialized.
+ inline Shift() noexcept = default;
+
+ //! Copy constructor (default)
+ constexpr Shift(const Shift& other) noexcept = default;
+
+ //! Constructs Shift from operation `op` and shift `value`.
+ constexpr Shift(uint32_t op, uint32_t value) noexcept
+ : _op(op),
+ _value(value) {}
+
+ //! Returns the shift operation.
+ constexpr uint32_t op() const noexcept { return _op; }
+ //! Returns the shift smount.
+ constexpr uint32_t value() const noexcept { return _value; }
+
+ //! Sets shift operation to `op`.
+ inline void setOp(uint32_t op) noexcept { _op = op; }
+ //! Sets shift amount to `value`.
+ inline void setValue(uint32_t value) noexcept { _value = value; }
+};
+
+//! Constructs a `LSL #value` shift (logical shift left).
+static constexpr Shift lsl(uint32_t value) noexcept { return Shift(Shift::kOpLSL, value); }
+//! Constructs a `LSR #value` shift (logical shift right).
+static constexpr Shift lsr(uint32_t value) noexcept { return Shift(Shift::kOpLSR, value); }
+//! Constructs a `ASR #value` shift (arithmetic shift right).
+static constexpr Shift asr(uint32_t value) noexcept { return Shift(Shift::kOpASR, value); }
+//! Constructs a `ROR #value` shift (rotate right).
+static constexpr Shift ror(uint32_t value) noexcept { return Shift(Shift::kOpROR, value); }
+//! Constructs a `RRX` shift (rotate with carry by 1).
+static constexpr Shift rrx() noexcept { return Shift(Shift::kOpRRX, 0); }
+//! Constructs a `MSL #value` shift (logical shift left filling ones).
+static constexpr Shift msl(uint32_t value) noexcept { return Shift(Shift::kOpMSL, value); }
+
+//! Constructs a `UXTB #value` extend and shift (unsigned byte extend).
+static constexpr Shift uxtb(uint32_t value) noexcept { return Shift(Shift::kOpUXTB, value); }
+//! Constructs a `UXTH #value` extend and shift (unsigned hword extend).
+static constexpr Shift uxth(uint32_t value) noexcept { return Shift(Shift::kOpUXTH, value); }
+//! Constructs a `UXTW #value` extend and shift (unsigned word extend).
+static constexpr Shift uxtw(uint32_t value) noexcept { return Shift(Shift::kOpUXTW, value); }
+//! Constructs a `UXTX #value` extend and shift (unsigned dword extend).
+static constexpr Shift uxtx(uint32_t value) noexcept { return Shift(Shift::kOpUXTX, value); }
+
+//! Constructs a `SXTB #value` extend and shift (signed byte extend).
+static constexpr Shift sxtb(uint32_t value) noexcept { return Shift(Shift::kOpSXTB, value); }
+//! Constructs a `SXTH #value` extend and shift (signed hword extend).
+static constexpr Shift sxth(uint32_t value) noexcept { return Shift(Shift::kOpSXTH, value); }
+//! Constructs a `SXTW #value` extend and shift (signed word extend).
+static constexpr Shift sxtw(uint32_t value) noexcept { return Shift(Shift::kOpSXTW, value); }
+//! Constructs a `SXTX #value` extend and shift (signed dword extend).
+static constexpr Shift sxtx(uint32_t value) noexcept { return Shift(Shift::kOpSXTX, value); }
+
+//! \}
+
+ASMJIT_END_SUB_NAMESPACE
+
+#endif // ASMJIT_CORE_ARCHCOMMONS_H_INCLUDED
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/archtraits.cpp b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/archtraits.cpp
new file mode 100644
index 0000000..f069354
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/archtraits.cpp
@@ -0,0 +1,155 @@
+// AsmJit - Machine code generation for C++
+//
+// * Official AsmJit Home Page: https://asmjit.com
+// * Official Github Repository: https://github.com/asmjit/asmjit
+//
+// Copyright (c) 2008-2020 The AsmJit Authors
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+#include "../core/api-build_p.h"
+#include "../core/archtraits.h"
+#include "../core/misc_p.h"
+
+#ifdef ASMJIT_BUILD_X86
+ #include "../x86/x86archtraits_p.h"
+#endif
+
+#ifdef ASMJIT_BUILD_ARM
+ #include "../arm/armarchtraits_p.h"
+#endif
+
+ASMJIT_BEGIN_NAMESPACE
+
+// ============================================================================
+// [asmjit::ArchTraits]
+// ============================================================================
+
+static const constexpr ArchTraits noArchTraits = {
+ 0xFF, // SP.
+ 0xFF, // FP.
+ 0xFF, // LR.
+ 0xFF, // PC.
+ { 0, 0, 0 }, // Reserved.
+ 0, // HW stack alignment.
+ 0, // Min stack offset.
+ 0, // Max stack offset.
+ { 0, 0, 0, 0}, // ISA features [Gp, Vec, Other0, Other1].
+ { { 0 } }, // RegTypeToSignature.
+ { 0 }, // RegTypeToTypeId.
+ { 0 } // TypeIdToRegType.
+};
+
+ASMJIT_VARAPI const ArchTraits _archTraits[Environment::kArchCount] = {
+ // No architecture.
+ noArchTraits,
+
+ // X86/X86 architectures.
+#ifdef ASMJIT_BUILD_X86
+ x86::x86ArchTraits,
+ x86::x64ArchTraits,
+#else
+ noArchTraits,
+ noArchTraits,
+#endif
+
+ // RISCV32/RISCV64 architectures.
+ noArchTraits,
+ noArchTraits,
+
+ // ARM architecture
+ noArchTraits,
+
+ // AArch64 architecture.
+#ifdef ASMJIT_BUILD_ARM
+ arm::a64ArchTraits,
+#else
+ noArchTraits,
+#endif
+
+ // ARM/Thumb architecture.
+ noArchTraits,
+
+ // Reserved.
+ noArchTraits,
+
+ // MIPS32/MIPS64
+ noArchTraits,
+ noArchTraits
+};
+
+// ============================================================================
+// [asmjit::ArchUtils]
+// ============================================================================
+
+ASMJIT_FAVOR_SIZE Error ArchUtils::typeIdToRegInfo(uint32_t arch, uint32_t typeId, uint32_t* typeIdOut, RegInfo* regInfoOut) noexcept {
+ const ArchTraits& archTraits = ArchTraits::byArch(arch);
+
+ // Passed RegType instead of TypeId?
+ if (typeId <= BaseReg::kTypeMax)
+ typeId = archTraits.regTypeToTypeId(typeId);
+
+ if (ASMJIT_UNLIKELY(!Type::isValid(typeId)))
+ return DebugUtils::errored(kErrorInvalidTypeId);
+
+ // First normalize architecture dependent types.
+ if (Type::isAbstract(typeId)) {
+ bool is32Bit = Environment::is32Bit(arch);
+ if (typeId == Type::kIdIntPtr)
+ typeId = is32Bit ? Type::kIdI32 : Type::kIdI64;
+ else
+ typeId = is32Bit ? Type::kIdU32 : Type::kIdU64;
+ }
+
+ // Type size helps to construct all groups of registers.
+ // TypeId is invalid if the size is zero.
+ uint32_t size = Type::sizeOf(typeId);
+ if (ASMJIT_UNLIKELY(!size))
+ return DebugUtils::errored(kErrorInvalidTypeId);
+
+ if (ASMJIT_UNLIKELY(typeId == Type::kIdF80))
+ return DebugUtils::errored(kErrorInvalidUseOfF80);
+
+ uint32_t regType = 0;
+ if (typeId >= Type::_kIdBaseStart && typeId < Type::_kIdVec32Start) {
+ regType = archTraits._typeIdToRegType[typeId - Type::_kIdBaseStart];
+ if (!regType) {
+ if (typeId == Type::kIdI64 || typeId == Type::kIdU64)
+ return DebugUtils::errored(kErrorInvalidUseOfGpq);
+ else
+ return DebugUtils::errored(kErrorInvalidTypeId);
+ }
+ }
+ else {
+ if (size <= 8 && archTraits._regInfo[BaseReg::kTypeVec64].isValid())
+ regType = BaseReg::kTypeVec64;
+ else if (size <= 16 && archTraits._regInfo[BaseReg::kTypeVec128].isValid())
+ regType = BaseReg::kTypeVec128;
+ else if (size == 32 && archTraits._regInfo[BaseReg::kTypeVec256].isValid())
+ regType = BaseReg::kTypeVec256;
+ else if (archTraits._regInfo[BaseReg::kTypeVec512].isValid())
+ regType = BaseReg::kTypeVec512;
+ else
+ return DebugUtils::errored(kErrorInvalidTypeId);
+ }
+
+ *typeIdOut = typeId;
+ regInfoOut->reset(archTraits.regTypeToSignature(regType));
+ return kErrorOk;
+}
+
+ASMJIT_END_NAMESPACE
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/archtraits.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/archtraits.h
new file mode 100644
index 0000000..5af6c7e
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/archtraits.h
@@ -0,0 +1,174 @@
+// AsmJit - Machine code generation for C++
+//
+// * Official AsmJit Home Page: https://asmjit.com
+// * Official Github Repository: https://github.com/asmjit/asmjit
+//
+// Copyright (c) 2008-2020 The AsmJit Authors
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+#ifndef ASMJIT_CORE_ARCHTRAITS_H_INCLUDED
+#define ASMJIT_CORE_ARCHTRAITS_H_INCLUDED
+
+#include "../core/environment.h"
+#include "../core/operand.h"
+#include "../core/type.h"
+
+ASMJIT_BEGIN_NAMESPACE
+
+//! \addtogroup asmjit_core
+//! \{
+
+// ============================================================================
+// [asmjit::ArchTraits]
+// ============================================================================
+
+//! Architecture traits used by Function API and Compiler's register allocator.
+struct ArchTraits {
+ //! ISA features for each register group.
+ enum IsaFeatures : uint32_t {
+ //! ISA features a register swap by using a single instruction.
+ kIsaFeatureSwap = 0x01u,
+ //! ISA features a push/pop like instruction for this register group.
+ kIsaFeaturePushPop = 0x02u,
+ };
+
+ //! Stack pointer register id.
+ uint8_t _spRegId;
+ //! Frame pointer register id.
+ uint8_t _fpRegId;
+ //! Link register id.
+ uint8_t _linkRegId;
+ //! Instruction pointer (or program counter) register id, if accessible.
+ uint8_t _ipRegId;
+
+ // Reserved.
+ uint8_t _reserved[3];
+ //! Hardware stack alignment requirement.
+ uint8_t _hwStackAlignment;
+ //! Minimum addressable offset on stack guaranteed for all instructions.
+ uint32_t _minStackOffset;
+ //! Maximum addressable offset on stack depending on specific instruction.
+ uint32_t _maxStackOffset;
+
+ //! Flags for each virtual register group (always covers GP and Vec groups).
+ uint8_t _isaFlags[BaseReg::kGroupVirt];
+
+ //! Maps register type into a signature, that provides group, size and can
+ //! be used to construct register operands.
+ RegInfo _regInfo[BaseReg::kTypeMax + 1];
+ //! Maps a register to type-id, see \ref Type::Id.
+ uint8_t _regTypeToTypeId[BaseReg::kTypeMax + 1];
+ //! Maps base TypeId values (from TypeId::_kIdBaseStart) to register types, see \ref Type::Id.
+ uint8_t _typeIdToRegType[32];
+
+ //! Resets all members to zeros.
+ inline void reset() noexcept { memset(this, 0, sizeof(*this)); }
+
+ //! \name Accessors
+ //! \{
+
+ //! Returns stack pointer register id.
+ inline constexpr uint32_t spRegId() const noexcept { return _spRegId; }
+ //! Returns stack frame register id.
+ inline constexpr uint32_t fpRegId() const noexcept { return _fpRegId; }
+ //! Returns link register id, if the architecture provides it.
+ inline constexpr uint32_t linkRegId() const noexcept { return _linkRegId; }
+ //! Returns instruction pointer register id, if the architecture provides it.
+ inline constexpr uint32_t ipRegId() const noexcept { return _ipRegId; }
+
+ //! Returns a hardware stack alignment requirement.
+ //!
+ //! \note This is a hardware constraint. Architectures that don't constrain
+ //! it would return the lowest alignment (1), however, some architectures may
+ //! constrain the alignment, for example AArch64 requires 16-byte alignment.
+ inline constexpr uint32_t hwStackAlignment() const noexcept { return _hwStackAlignment; }
+
+ //! Tests whether the architecture provides link register, which is used across
+ //! function calls. If the link register is not provided then a function call
+ //! pushes the return address on stack (X86/X64).
+ inline constexpr bool hasLinkReg() const noexcept { return _linkRegId != BaseReg::kIdBad; }
+
+ //! Returns minimum addressable offset on stack guaranteed for all instructions.
+ inline constexpr uint32_t minStackOffset() const noexcept { return _minStackOffset; }
+ //! Returns maximum addressable offset on stack depending on specific instruction.
+ inline constexpr uint32_t maxStackOffset() const noexcept { return _maxStackOffset; }
+
+ //! Returns ISA flags of the given register `group`.
+ inline constexpr uint32_t isaFlags(uint32_t group) const noexcept { return _isaFlags[group]; }
+ //! Tests whether the given register `group` has the given `flag` set.
+ inline constexpr bool hasIsaFlag(uint32_t group, uint32_t flag) const noexcept { return (_isaFlags[group] & flag) != 0; }
+ //! Tests whether the ISA provides register swap instruction for the given register `group`.
+ inline constexpr bool hasSwap(uint32_t group) const noexcept { return hasIsaFlag(group, kIsaFeatureSwap); }
+ //! Tests whether the ISA provides push/pop instructions for the given register `group`.
+ inline constexpr bool hasPushPop(uint32_t group) const noexcept { return hasIsaFlag(group, kIsaFeaturePushPop); }
+
+ inline uint32_t hasRegType(uint32_t rType) const noexcept {
+ return rType <= BaseReg::kTypeMax && _regInfo[rType].signature() != 0;
+ }
+
+ inline uint32_t regTypeToSignature(uint32_t rType) const noexcept {
+ ASMJIT_ASSERT(rType <= BaseReg::kTypeMax);
+ return _regInfo[rType].signature();
+ }
+
+ inline uint32_t regTypeToGroup(uint32_t rType) const noexcept {
+ ASMJIT_ASSERT(rType <= BaseReg::kTypeMax);
+ return _regInfo[rType].group();
+ }
+
+ inline uint32_t regTypeToSize(uint32_t rType) const noexcept {
+ ASMJIT_ASSERT(rType <= BaseReg::kTypeMax);
+ return _regInfo[rType].size();
+ }
+
+ inline uint32_t regTypeToTypeId(uint32_t rType) const noexcept {
+ ASMJIT_ASSERT(rType <= BaseReg::kTypeMax);
+ return _regTypeToTypeId[rType];
+ }
+
+ //! \}
+
+ //! \name Statics
+ //! \{
+
+ //! Returns a const reference to `ArchTraits` for the given architecture `arch`.
+ static inline const ArchTraits& byArch(uint32_t arch) noexcept;
+
+ //! \}
+};
+
+ASMJIT_VARAPI const ArchTraits _archTraits[Environment::kArchCount];
+
+inline const ArchTraits& ArchTraits::byArch(uint32_t arch) noexcept { return _archTraits[arch & ~Environment::kArchBigEndianMask]; }
+
+// ============================================================================
+// [asmjit::ArchUtils]
+// ============================================================================
+
+//! Architecture utilities.
+namespace ArchUtils {
+
+ASMJIT_API Error typeIdToRegInfo(uint32_t arch, uint32_t typeId, uint32_t* typeIdOut, RegInfo* regInfo) noexcept;
+
+} // {ArchUtils}
+
+//! \}
+
+ASMJIT_END_NAMESPACE
+
+#endif // ASMJIT_CORE_ARCHTRAITS_H_INCLUDED
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/assembler.cpp b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/assembler.cpp
new file mode 100644
index 0000000..c0cbf0f
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/assembler.cpp
@@ -0,0 +1,409 @@
+// AsmJit - Machine code generation for C++
+//
+// * Official AsmJit Home Page: https://asmjit.com
+// * Official Github Repository: https://github.com/asmjit/asmjit
+//
+// Copyright (c) 2008-2020 The AsmJit Authors
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+#include "../core/api-build_p.h"
+#include "../core/assembler.h"
+#include "../core/codewriter_p.h"
+#include "../core/constpool.h"
+#include "../core/emitterutils_p.h"
+#include "../core/formatter.h"
+#include "../core/logger.h"
+#include "../core/support.h"
+
+ASMJIT_BEGIN_NAMESPACE
+
+// ============================================================================
+// [asmjit::BaseAssembler - Construction / Destruction]
+// ============================================================================
+
+BaseAssembler::BaseAssembler() noexcept
+ : BaseEmitter(kTypeAssembler) {}
+
+BaseAssembler::~BaseAssembler() noexcept {}
+
+// ============================================================================
+// [asmjit::BaseAssembler - Buffer Management]
+// ============================================================================
+
+Error BaseAssembler::setOffset(size_t offset) {
+ if (ASMJIT_UNLIKELY(!_code))
+ return reportError(DebugUtils::errored(kErrorNotInitialized));
+
+ size_t size = Support::max(_section->bufferSize(), this->offset());
+ if (ASMJIT_UNLIKELY(offset > size))
+ return reportError(DebugUtils::errored(kErrorInvalidArgument));
+
+ _bufferPtr = _bufferData + offset;
+ return kErrorOk;
+}
+
+// ============================================================================
+// [asmjit::BaseAssembler - Section Management]
+// ============================================================================
+
+static void BaseAssembler_initSection(BaseAssembler* self, Section* section) noexcept {
+ uint8_t* p = section->_buffer._data;
+
+ self->_section = section;
+ self->_bufferData = p;
+ self->_bufferPtr = p + section->_buffer._size;
+ self->_bufferEnd = p + section->_buffer._capacity;
+}
+
+Error BaseAssembler::section(Section* section) {
+ if (ASMJIT_UNLIKELY(!_code))
+ return reportError(DebugUtils::errored(kErrorNotInitialized));
+
+ if (!_code->isSectionValid(section->id()) || _code->_sections[section->id()] != section)
+ return reportError(DebugUtils::errored(kErrorInvalidSection));
+
+#ifndef ASMJIT_NO_LOGGING
+ if (_logger)
+ _logger->logf(".section %s {#%u}\n", section->name(), section->id());
+#endif
+
+ BaseAssembler_initSection(this, section);
+ return kErrorOk;
+}
+
+// ============================================================================
+// [asmjit::BaseAssembler - Label Management]
+// ============================================================================
+
+Label BaseAssembler::newLabel() {
+ uint32_t labelId = Globals::kInvalidId;
+ if (ASMJIT_LIKELY(_code)) {
+ LabelEntry* le;
+ Error err = _code->newLabelEntry(&le);
+ if (ASMJIT_UNLIKELY(err))
+ reportError(err);
+ else
+ labelId = le->id();
+ }
+ return Label(labelId);
+}
+
+Label BaseAssembler::newNamedLabel(const char* name, size_t nameSize, uint32_t type, uint32_t parentId) {
+ uint32_t labelId = Globals::kInvalidId;
+ if (ASMJIT_LIKELY(_code)) {
+ LabelEntry* le;
+ Error err = _code->newNamedLabelEntry(&le, name, nameSize, type, parentId);
+ if (ASMJIT_UNLIKELY(err))
+ reportError(err);
+ else
+ labelId = le->id();
+ }
+ return Label(labelId);
+}
+
+Error BaseAssembler::bind(const Label& label) {
+ if (ASMJIT_UNLIKELY(!_code))
+ return reportError(DebugUtils::errored(kErrorNotInitialized));
+
+ Error err = _code->bindLabel(label, _section->id(), offset());
+
+#ifndef ASMJIT_NO_LOGGING
+ if (_logger)
+ EmitterUtils::logLabelBound(this, label);
+#endif
+
+ resetInlineComment();
+ if (err)
+ return reportError(err);
+
+ return kErrorOk;
+}
+
+// ============================================================================
+// [asmjit::BaseAssembler - Embed]
+// ============================================================================
+
+#ifndef ASMJIT_NO_LOGGING
+struct DataSizeByPower {
+ char str[4];
+};
+
+static const DataSizeByPower dataSizeByPowerTable[] = {
+ { "db" },
+ { "dw" },
+ { "dd" },
+ { "dq" }
+};
+#endif
+
+Error BaseAssembler::embed(const void* data, size_t dataSize) {
+ if (ASMJIT_UNLIKELY(!_code))
+ return reportError(DebugUtils::errored(kErrorNotInitialized));
+
+ if (dataSize == 0)
+ return kErrorOk;
+
+ CodeWriter writer(this);
+ ASMJIT_PROPAGATE(writer.ensureSpace(this, dataSize));
+
+ writer.emitData(data, dataSize);
+
+#ifndef ASMJIT_NO_LOGGING
+ if (_logger)
+ _logger->logBinary(data, dataSize);
+#endif
+
+ writer.done(this);
+ return kErrorOk;
+}
+
+Error BaseAssembler::embedDataArray(uint32_t typeId, const void* data, size_t itemCcount, size_t repeatCount) {
+ uint32_t deabstractDelta = Type::deabstractDeltaOfSize(registerSize());
+ uint32_t finalTypeId = Type::deabstract(typeId, deabstractDelta);
+
+ if (ASMJIT_UNLIKELY(!Type::isValid(finalTypeId)))
+ return reportError(DebugUtils::errored(kErrorInvalidArgument));
+
+ if (itemCcount == 0 || repeatCount == 0)
+ return kErrorOk;
+
+ uint32_t typeSize = Type::sizeOf(finalTypeId);
+ Support::FastUInt8 of = 0;
+
+ size_t dataSize = Support::mulOverflow(itemCcount, size_t(typeSize), &of);
+ size_t totalSize = Support::mulOverflow(dataSize, repeatCount, &of);
+
+ if (ASMJIT_UNLIKELY(of))
+ return reportError(DebugUtils::errored(kErrorOutOfMemory));
+
+ CodeWriter writer(this);
+ ASMJIT_PROPAGATE(writer.ensureSpace(this, totalSize));
+
+#ifndef ASMJIT_NO_LOGGING
+ const uint8_t* start = writer.cursor();
+#endif
+
+ for (size_t i = 0; i < repeatCount; i++) {
+ writer.emitData(data, dataSize);
+ }
+
+#ifndef ASMJIT_NO_LOGGING
+ if (_logger)
+ _logger->logBinary(start, totalSize);
+#endif
+
+ writer.done(this);
+ return kErrorOk;
+}
+
+Error BaseAssembler::embedConstPool(const Label& label, const ConstPool& pool) {
+ if (ASMJIT_UNLIKELY(!_code))
+ return reportError(DebugUtils::errored(kErrorNotInitialized));
+
+ if (ASMJIT_UNLIKELY(!isLabelValid(label)))
+ return reportError(DebugUtils::errored(kErrorInvalidLabel));
+
+ ASMJIT_PROPAGATE(align(kAlignData, uint32_t(pool.alignment())));
+ ASMJIT_PROPAGATE(bind(label));
+
+ size_t size = pool.size();
+ CodeWriter writer(this);
+ ASMJIT_PROPAGATE(writer.ensureSpace(this, size));
+
+ pool.fill(writer.cursor());
+
+#ifndef ASMJIT_NO_LOGGING
+ if (_logger)
+ _logger->logBinary(writer.cursor(), size);
+#endif
+
+ writer.advance(size);
+ writer.done(this);
+
+ return kErrorOk;
+}
+
+Error BaseAssembler::embedLabel(const Label& label, size_t dataSize) {
+ if (ASMJIT_UNLIKELY(!_code))
+ return reportError(DebugUtils::errored(kErrorNotInitialized));
+
+ ASMJIT_ASSERT(_code != nullptr);
+ RelocEntry* re;
+ LabelEntry* le = _code->labelEntry(label);
+
+ if (ASMJIT_UNLIKELY(!le))
+ return reportError(DebugUtils::errored(kErrorInvalidLabel));
+
+ if (dataSize == 0)
+ dataSize = registerSize();
+
+ if (ASMJIT_UNLIKELY(!Support::isPowerOf2(dataSize) || dataSize > 8))
+ return reportError(DebugUtils::errored(kErrorInvalidOperandSize));
+
+ CodeWriter writer(this);
+ ASMJIT_PROPAGATE(writer.ensureSpace(this, dataSize));
+
+#ifndef ASMJIT_NO_LOGGING
+ if (_logger) {
+ StringTmp<256> sb;
+ sb.appendFormat("%s ", dataSizeByPowerTable[Support::ctz(dataSize)].str);
+ Formatter::formatLabel(sb, 0, this, label.id());
+ sb.append('\n');
+ _logger->log(sb);
+ }
+#endif
+
+ Error err = _code->newRelocEntry(&re, RelocEntry::kTypeRelToAbs);
+ if (ASMJIT_UNLIKELY(err))
+ return reportError(err);
+
+ re->_sourceSectionId = _section->id();
+ re->_sourceOffset = offset();
+ re->_format.resetToDataValue(uint32_t(dataSize));
+
+ if (le->isBound()) {
+ re->_targetSectionId = le->section()->id();
+ re->_payload = le->offset();
+ }
+ else {
+ OffsetFormat of;
+ of.resetToDataValue(uint32_t(dataSize));
+
+ LabelLink* link = _code->newLabelLink(le, _section->id(), offset(), 0, of);
+ if (ASMJIT_UNLIKELY(!link))
+ return reportError(DebugUtils::errored(kErrorOutOfMemory));
+
+ link->relocId = re->id();
+ }
+
+ // Emit dummy DWORD/QWORD depending on the data size.
+ writer.emitZeros(dataSize);
+ writer.done(this);
+
+ return kErrorOk;
+}
+
+Error BaseAssembler::embedLabelDelta(const Label& label, const Label& base, size_t dataSize) {
+ if (ASMJIT_UNLIKELY(!_code))
+ return reportError(DebugUtils::errored(kErrorNotInitialized));
+
+ LabelEntry* labelEntry = _code->labelEntry(label);
+ LabelEntry* baseEntry = _code->labelEntry(base);
+
+ if (ASMJIT_UNLIKELY(!labelEntry || !baseEntry))
+ return reportError(DebugUtils::errored(kErrorInvalidLabel));
+
+ if (dataSize == 0)
+ dataSize = registerSize();
+
+ if (ASMJIT_UNLIKELY(!Support::isPowerOf2(dataSize) || dataSize > 8))
+ return reportError(DebugUtils::errored(kErrorInvalidOperandSize));
+
+ CodeWriter writer(this);
+ ASMJIT_PROPAGATE(writer.ensureSpace(this, dataSize));
+
+#ifndef ASMJIT_NO_LOGGING
+ if (_logger) {
+ StringTmp<256> sb;
+ sb.appendFormat(".%s (", dataSizeByPowerTable[Support::ctz(dataSize)].str);
+ Formatter::formatLabel(sb, 0, this, label.id());
+ sb.append(" - ");
+ Formatter::formatLabel(sb, 0, this, base.id());
+ sb.append(")\n");
+ _logger->log(sb);
+ }
+#endif
+
+ // If both labels are bound within the same section it means the delta can be calculated now.
+ if (labelEntry->isBound() && baseEntry->isBound() && labelEntry->section() == baseEntry->section()) {
+ uint64_t delta = labelEntry->offset() - baseEntry->offset();
+ writer.emitValueLE(delta, dataSize);
+ }
+ else {
+ RelocEntry* re;
+ Error err = _code->newRelocEntry(&re, RelocEntry::kTypeExpression);
+ if (ASMJIT_UNLIKELY(err))
+ return reportError(err);
+
+ Expression* exp = _code->_zone.newT();
+ if (ASMJIT_UNLIKELY(!exp))
+ return reportError(DebugUtils::errored(kErrorOutOfMemory));
+
+ exp->reset();
+ exp->opType = Expression::kOpSub;
+ exp->setValueAsLabel(0, labelEntry);
+ exp->setValueAsLabel(1, baseEntry);
+
+ re->_format.resetToDataValue(dataSize);
+ re->_sourceSectionId = _section->id();
+ re->_sourceOffset = offset();
+ re->_payload = (uint64_t)(uintptr_t)exp;
+
+ writer.emitZeros(dataSize);
+ }
+
+ writer.done(this);
+ return kErrorOk;
+}
+
+// ============================================================================
+// [asmjit::BaseAssembler - Comment]
+// ============================================================================
+
+Error BaseAssembler::comment(const char* data, size_t size) {
+ if (!hasEmitterFlag(kFlagLogComments)) {
+ if (!hasEmitterFlag(kFlagAttached))
+ return reportError(DebugUtils::errored(kErrorNotInitialized));
+ return kErrorOk;
+ }
+
+#ifndef ASMJIT_NO_LOGGING
+ // Logger cannot be NULL if `kFlagLogComments` is set.
+ ASMJIT_ASSERT(_logger != nullptr);
+
+ _logger->log(data, size);
+ _logger->log("\n", 1);
+ return kErrorOk;
+#else
+ DebugUtils::unused(data, size);
+ return kErrorOk;
+#endif
+}
+
+// ============================================================================
+// [asmjit::BaseAssembler - Events]
+// ============================================================================
+
+Error BaseAssembler::onAttach(CodeHolder* code) noexcept {
+ ASMJIT_PROPAGATE(Base::onAttach(code));
+
+ // Attach to the end of the .text section.
+ BaseAssembler_initSection(this, code->_sections[0]);
+
+ return kErrorOk;
+}
+
+Error BaseAssembler::onDetach(CodeHolder* code) noexcept {
+ _section = nullptr;
+ _bufferData = nullptr;
+ _bufferEnd = nullptr;
+ _bufferPtr = nullptr;
+ return Base::onDetach(code);
+}
+
+ASMJIT_END_NAMESPACE
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/assembler.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/assembler.h
new file mode 100644
index 0000000..6e38bc5
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/assembler.h
@@ -0,0 +1,152 @@
+// AsmJit - Machine code generation for C++
+//
+// * Official AsmJit Home Page: https://asmjit.com
+// * Official Github Repository: https://github.com/asmjit/asmjit
+//
+// Copyright (c) 2008-2020 The AsmJit Authors
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+#ifndef ASMJIT_CORE_ASSEMBLER_H_INCLUDED
+#define ASMJIT_CORE_ASSEMBLER_H_INCLUDED
+
+#include "../core/codeholder.h"
+#include "../core/datatypes.h"
+#include "../core/emitter.h"
+#include "../core/operand.h"
+
+ASMJIT_BEGIN_NAMESPACE
+
+//! \addtogroup asmjit_assembler
+//! \{
+
+// ============================================================================
+// [asmjit::BaseAssembler]
+// ============================================================================
+
+//! Base assembler.
+//!
+//! This is a base class that provides interface used by architecture specific
+//! assembler implementations. Assembler doesn't hold any data, instead it's
+//! attached to \ref CodeHolder, which provides all the data that Assembler
+//! needs and which can be altered by it.
+//!
+//! Check out architecture specific assemblers for more details and examples:
+//!
+//! - \ref x86::Assembler - X86/X64 assembler implementation.
+class ASMJIT_VIRTAPI BaseAssembler : public BaseEmitter {
+public:
+ ASMJIT_NONCOPYABLE(BaseAssembler)
+ typedef BaseEmitter Base;
+
+ //! Current section where the assembling happens.
+ Section* _section = nullptr;
+ //! Start of the CodeBuffer of the current section.
+ uint8_t* _bufferData = nullptr;
+ //! End (first invalid byte) of the current section.
+ uint8_t* _bufferEnd = nullptr;
+ //! Pointer in the CodeBuffer of the current section.
+ uint8_t* _bufferPtr = nullptr;
+
+ //! \name Construction & Destruction
+ //! \{
+
+ //! Creates a new `BaseAssembler` instance.
+ ASMJIT_API BaseAssembler() noexcept;
+ //! Destroys the `BaseAssembler` instance.
+ ASMJIT_API virtual ~BaseAssembler() noexcept;
+
+ //! \}
+
+ //! \name Code-Buffer Management
+ //! \{
+
+ //! Returns the capacity of the current CodeBuffer.
+ inline size_t bufferCapacity() const noexcept { return (size_t)(_bufferEnd - _bufferData); }
+ //! Returns the number of remaining bytes in the current CodeBuffer.
+ inline size_t remainingSpace() const noexcept { return (size_t)(_bufferEnd - _bufferPtr); }
+
+ //! Returns the current position in the CodeBuffer.
+ inline size_t offset() const noexcept { return (size_t)(_bufferPtr - _bufferData); }
+
+ //! Sets the current position in the CodeBuffer to `offset`.
+ //!
+ //! \note The `offset` cannot be greater than buffer size even if it's
+ //! within the buffer's capacity.
+ ASMJIT_API Error setOffset(size_t offset);
+
+ //! Returns the start of the CodeBuffer in the current section.
+ inline uint8_t* bufferData() const noexcept { return _bufferData; }
+ //! Returns the end (first invalid byte) in the current section.
+ inline uint8_t* bufferEnd() const noexcept { return _bufferEnd; }
+ //! Returns the current pointer in the CodeBuffer in the current section.
+ inline uint8_t* bufferPtr() const noexcept { return _bufferPtr; }
+
+ //! \}
+
+ //! \name Section Management
+ //! \{
+
+ //! Returns the current section.
+ inline Section* currentSection() const noexcept { return _section; }
+
+ ASMJIT_API Error section(Section* section) override;
+
+ //! \}
+
+ //! \name Label Management
+ //! \{
+
+ ASMJIT_API Label newLabel() override;
+ ASMJIT_API Label newNamedLabel(const char* name, size_t nameSize = SIZE_MAX, uint32_t type = Label::kTypeGlobal, uint32_t parentId = Globals::kInvalidId) override;
+ ASMJIT_API Error bind(const Label& label) override;
+
+ //! \}
+
+ //! \name Embed
+ //! \{
+
+ ASMJIT_API Error embed(const void* data, size_t dataSize) override;
+ ASMJIT_API Error embedDataArray(uint32_t typeId, const void* data, size_t itemCcount, size_t repeatCount = 1) override;
+ ASMJIT_API Error embedConstPool(const Label& label, const ConstPool& pool) override;
+
+ ASMJIT_API Error embedLabel(const Label& label, size_t dataSize = 0) override;
+ ASMJIT_API Error embedLabelDelta(const Label& label, const Label& base, size_t dataSize = 0) override;
+
+ //! \}
+
+ //! \name Comment
+ //! \{
+
+ ASMJIT_API Error comment(const char* data, size_t size = SIZE_MAX) override;
+
+ //! \}
+
+ //! \name Events
+ //! \{
+
+ ASMJIT_API Error onAttach(CodeHolder* code) noexcept override;
+ ASMJIT_API Error onDetach(CodeHolder* code) noexcept override;
+
+ //! \}
+};
+
+//! \}
+
+ASMJIT_END_NAMESPACE
+
+#endif // ASMJIT_CORE_ASSEMBLER_H_INCLUDED
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/builder.cpp b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/builder.cpp
new file mode 100644
index 0000000..ad89f1d
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/builder.cpp
@@ -0,0 +1,920 @@
+// AsmJit - Machine code generation for C++
+//
+// * Official AsmJit Home Page: https://asmjit.com
+// * Official Github Repository: https://github.com/asmjit/asmjit
+//
+// Copyright (c) 2008-2020 The AsmJit Authors
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+#include "../core/api-build_p.h"
+#ifndef ASMJIT_NO_BUILDER
+
+#include "../core/builder.h"
+#include "../core/emitterutils_p.h"
+#include "../core/errorhandler.h"
+#include "../core/formatter.h"
+#include "../core/logger.h"
+#include "../core/support.h"
+
+ASMJIT_BEGIN_NAMESPACE
+
+// ============================================================================
+// [asmjit::PostponedErrorHandler (Internal)]
+// ============================================================================
+
+//! Postponed error handler that never throws. Used as a temporal error handler
+//! to run passes. If error occurs, the caller is notified and will call the
+//! real error handler, that can throw.
+class PostponedErrorHandler : public ErrorHandler {
+public:
+ void handleError(Error err, const char* message, BaseEmitter* origin) override {
+ DebugUtils::unused(err, origin);
+ _message.assign(message);
+ }
+
+ StringTmp<128> _message;
+};
+
+// ============================================================================
+// [asmjit::BaseBuilder - Utilities]
+// ============================================================================
+
+static void BaseBuilder_deletePasses(BaseBuilder* self) noexcept {
+ for (Pass* pass : self->_passes)
+ pass->~Pass();
+ self->_passes.reset();
+}
+
+// ============================================================================
+// [asmjit::BaseBuilder - Construction / Destruction]
+// ============================================================================
+
+BaseBuilder::BaseBuilder() noexcept
+ : BaseEmitter(kTypeBuilder),
+ _codeZone(32768 - Zone::kBlockOverhead),
+ _dataZone(16384 - Zone::kBlockOverhead),
+ _passZone(65536 - Zone::kBlockOverhead),
+ _allocator(&_codeZone) {}
+
+BaseBuilder::~BaseBuilder() noexcept {
+ BaseBuilder_deletePasses(this);
+}
+
+// ============================================================================
+// [asmjit::BaseBuilder - Node Management]
+// ============================================================================
+
+Error BaseBuilder::_newInstNode(InstNode** out, uint32_t instId, uint32_t instOptions, uint32_t opCount) {
+ uint32_t opCapacity = InstNode::capacityOfOpCount(opCount);
+ ASMJIT_ASSERT(opCapacity >= InstNode::kBaseOpCapacity);
+
+ InstNode* node = _allocator.allocT(InstNode::nodeSizeOfOpCapacity(opCapacity));
+ if (ASMJIT_UNLIKELY(!node))
+ return reportError(DebugUtils::errored(kErrorOutOfMemory));
+
+ *out = new(node) InstNode(this, instId, instOptions, opCount, opCapacity);
+ return kErrorOk;
+}
+
+
+Error BaseBuilder::_newLabelNode(LabelNode** out) {
+ *out = nullptr;
+
+ ASMJIT_PROPAGATE(_newNodeT(out));
+ return registerLabelNode(*out);
+}
+
+Error BaseBuilder::_newAlignNode(AlignNode** out, uint32_t alignMode, uint32_t alignment) {
+ *out = nullptr;
+ return _newNodeT(out, alignMode, alignment);
+}
+
+Error BaseBuilder::_newEmbedDataNode(EmbedDataNode** out, uint32_t typeId, const void* data, size_t itemCount, size_t repeatCount) {
+ *out = nullptr;
+
+ uint32_t deabstractDelta = Type::deabstractDeltaOfSize(registerSize());
+ uint32_t finalTypeId = Type::deabstract(typeId, deabstractDelta);
+
+ if (ASMJIT_UNLIKELY(!Type::isValid(finalTypeId)))
+ return reportError(DebugUtils::errored(kErrorInvalidArgument));
+
+ uint32_t typeSize = Type::sizeOf(finalTypeId);
+ Support::FastUInt8 of = 0;
+
+ size_t dataSize = Support::mulOverflow(itemCount, size_t(typeSize), &of);
+ if (ASMJIT_UNLIKELY(of))
+ return reportError(DebugUtils::errored(kErrorOutOfMemory));
+
+ EmbedDataNode* node;
+ ASMJIT_PROPAGATE(_newNodeT(&node));
+
+ node->_embed._typeId = uint8_t(typeId);
+ node->_embed._typeSize = uint8_t(typeSize);
+ node->_itemCount = itemCount;
+ node->_repeatCount = repeatCount;
+
+ uint8_t* dstData = node->_inlineData;
+ if (dataSize > EmbedDataNode::kInlineBufferSize) {
+ dstData = static_cast(_dataZone.alloc(dataSize, 8));
+ if (ASMJIT_UNLIKELY(!dstData))
+ return reportError(DebugUtils::errored(kErrorOutOfMemory));
+ node->_externalData = dstData;
+ }
+
+ if (data)
+ memcpy(dstData, data, dataSize);
+
+ *out = node;
+ return kErrorOk;
+}
+
+Error BaseBuilder::_newConstPoolNode(ConstPoolNode** out) {
+ *out = nullptr;
+
+ ASMJIT_PROPAGATE(_newNodeT(out));
+ return registerLabelNode(*out);
+}
+
+Error BaseBuilder::_newCommentNode(CommentNode** out, const char* data, size_t size) {
+ *out = nullptr;
+
+ if (data) {
+ if (size == SIZE_MAX)
+ size = strlen(data);
+
+ if (size > 0) {
+ data = static_cast(_dataZone.dup(data, size, true));
+ if (ASMJIT_UNLIKELY(!data))
+ return reportError(DebugUtils::errored(kErrorOutOfMemory));
+ }
+ }
+
+ return _newNodeT(out, data);
+}
+
+BaseNode* BaseBuilder::addNode(BaseNode* node) noexcept {
+ ASMJIT_ASSERT(node);
+ ASMJIT_ASSERT(!node->_prev);
+ ASMJIT_ASSERT(!node->_next);
+ ASMJIT_ASSERT(!node->isActive());
+
+ if (!_cursor) {
+ if (!_firstNode) {
+ _firstNode = node;
+ _lastNode = node;
+ }
+ else {
+ node->_next = _firstNode;
+ _firstNode->_prev = node;
+ _firstNode = node;
+ }
+ }
+ else {
+ BaseNode* prev = _cursor;
+ BaseNode* next = _cursor->next();
+
+ node->_prev = prev;
+ node->_next = next;
+
+ prev->_next = node;
+ if (next)
+ next->_prev = node;
+ else
+ _lastNode = node;
+ }
+
+ node->addFlags(BaseNode::kFlagIsActive);
+ if (node->isSection())
+ _dirtySectionLinks = true;
+
+ _cursor = node;
+ return node;
+}
+
+BaseNode* BaseBuilder::addAfter(BaseNode* node, BaseNode* ref) noexcept {
+ ASMJIT_ASSERT(node);
+ ASMJIT_ASSERT(ref);
+
+ ASMJIT_ASSERT(!node->_prev);
+ ASMJIT_ASSERT(!node->_next);
+
+ BaseNode* prev = ref;
+ BaseNode* next = ref->next();
+
+ node->_prev = prev;
+ node->_next = next;
+
+ node->addFlags(BaseNode::kFlagIsActive);
+ if (node->isSection())
+ _dirtySectionLinks = true;
+
+ prev->_next = node;
+ if (next)
+ next->_prev = node;
+ else
+ _lastNode = node;
+
+ return node;
+}
+
+BaseNode* BaseBuilder::addBefore(BaseNode* node, BaseNode* ref) noexcept {
+ ASMJIT_ASSERT(node != nullptr);
+ ASMJIT_ASSERT(!node->_prev);
+ ASMJIT_ASSERT(!node->_next);
+ ASMJIT_ASSERT(!node->isActive());
+ ASMJIT_ASSERT(ref != nullptr);
+ ASMJIT_ASSERT(ref->isActive());
+
+ BaseNode* prev = ref->prev();
+ BaseNode* next = ref;
+
+ node->_prev = prev;
+ node->_next = next;
+
+ node->addFlags(BaseNode::kFlagIsActive);
+ if (node->isSection())
+ _dirtySectionLinks = true;
+
+ next->_prev = node;
+ if (prev)
+ prev->_next = node;
+ else
+ _firstNode = node;
+
+ return node;
+}
+
+BaseNode* BaseBuilder::removeNode(BaseNode* node) noexcept {
+ if (!node->isActive())
+ return node;
+
+ BaseNode* prev = node->prev();
+ BaseNode* next = node->next();
+
+ if (_firstNode == node)
+ _firstNode = next;
+ else
+ prev->_next = next;
+
+ if (_lastNode == node)
+ _lastNode = prev;
+ else
+ next->_prev = prev;
+
+ node->_prev = nullptr;
+ node->_next = nullptr;
+ node->clearFlags(BaseNode::kFlagIsActive);
+ if (node->isSection())
+ _dirtySectionLinks = true;
+
+ if (_cursor == node)
+ _cursor = prev;
+
+ return node;
+}
+
+void BaseBuilder::removeNodes(BaseNode* first, BaseNode* last) noexcept {
+ if (first == last) {
+ removeNode(first);
+ return;
+ }
+
+ if (!first->isActive())
+ return;
+
+ BaseNode* prev = first->prev();
+ BaseNode* next = last->next();
+
+ if (_firstNode == first)
+ _firstNode = next;
+ else
+ prev->_next = next;
+
+ if (_lastNode == last)
+ _lastNode = prev;
+ else
+ next->_prev = prev;
+
+ BaseNode* node = first;
+ uint32_t didRemoveSection = false;
+
+ for (;;) {
+ next = node->next();
+ ASMJIT_ASSERT(next != nullptr);
+
+ node->_prev = nullptr;
+ node->_next = nullptr;
+ node->clearFlags(BaseNode::kFlagIsActive);
+ didRemoveSection |= uint32_t(node->isSection());
+
+ if (_cursor == node)
+ _cursor = prev;
+
+ if (node == last)
+ break;
+ node = next;
+ }
+
+ if (didRemoveSection)
+ _dirtySectionLinks = true;
+}
+
+BaseNode* BaseBuilder::setCursor(BaseNode* node) noexcept {
+ BaseNode* old = _cursor;
+ _cursor = node;
+ return old;
+}
+
+// ============================================================================
+// [asmjit::BaseBuilder - Section]
+// ============================================================================
+
+Error BaseBuilder::sectionNodeOf(SectionNode** out, uint32_t sectionId) {
+ *out = nullptr;
+
+ if (ASMJIT_UNLIKELY(!_code))
+ return DebugUtils::errored(kErrorNotInitialized);
+
+ if (ASMJIT_UNLIKELY(!_code->isSectionValid(sectionId)))
+ return reportError(DebugUtils::errored(kErrorInvalidSection));
+
+ if (sectionId >= _sectionNodes.size()) {
+ Error err = _sectionNodes.reserve(&_allocator, sectionId + 1);
+ if (ASMJIT_UNLIKELY(err != kErrorOk))
+ return reportError(err);
+ }
+
+ SectionNode* node = nullptr;
+ if (sectionId < _sectionNodes.size())
+ node = _sectionNodes[sectionId];
+
+ if (!node) {
+ ASMJIT_PROPAGATE(_newNodeT(&node, sectionId));
+
+ // We have already reserved enough space, this cannot fail now.
+ if (sectionId >= _sectionNodes.size())
+ _sectionNodes.resize(&_allocator, sectionId + 1);
+
+ _sectionNodes[sectionId] = node;
+ }
+
+ *out = node;
+ return kErrorOk;
+}
+
+Error BaseBuilder::section(Section* section) {
+ SectionNode* node;
+ ASMJIT_PROPAGATE(sectionNodeOf(&node, section->id()));
+
+ if (!node->isActive()) {
+ // Insert the section at the end if it was not part of the code.
+ addAfter(node, lastNode());
+ _cursor = node;
+ }
+ else {
+ // This is a bit tricky. We cache section links to make sure that
+ // switching sections doesn't involve traversal in linked-list unless
+ // the position of the section has changed.
+ if (hasDirtySectionLinks())
+ updateSectionLinks();
+
+ if (node->_nextSection)
+ _cursor = node->_nextSection->_prev;
+ else
+ _cursor = _lastNode;
+ }
+
+ return kErrorOk;
+}
+
+void BaseBuilder::updateSectionLinks() noexcept {
+ if (!_dirtySectionLinks)
+ return;
+
+ BaseNode* node_ = _firstNode;
+ SectionNode* currentSection = nullptr;
+
+ while (node_) {
+ if (node_->isSection()) {
+ if (currentSection)
+ currentSection->_nextSection = node_->as();
+ currentSection = node_->as();
+ }
+ node_ = node_->next();
+ }
+
+ if (currentSection)
+ currentSection->_nextSection = nullptr;
+
+ _dirtySectionLinks = false;
+}
+
+// ============================================================================
+// [asmjit::BaseBuilder - Labels]
+// ============================================================================
+
+Error BaseBuilder::labelNodeOf(LabelNode** out, uint32_t labelId) {
+ *out = nullptr;
+
+ if (ASMJIT_UNLIKELY(!_code))
+ return DebugUtils::errored(kErrorNotInitialized);
+
+ uint32_t index = labelId;
+ if (ASMJIT_UNLIKELY(index >= _code->labelCount()))
+ return DebugUtils::errored(kErrorInvalidLabel);
+
+ if (index >= _labelNodes.size())
+ ASMJIT_PROPAGATE(_labelNodes.resize(&_allocator, index + 1));
+
+ LabelNode* node = _labelNodes[index];
+ if (!node) {
+ ASMJIT_PROPAGATE(_newNodeT(&node, labelId));
+ _labelNodes[index] = node;
+ }
+
+ *out = node;
+ return kErrorOk;
+}
+
+Error BaseBuilder::registerLabelNode(LabelNode* node) {
+ if (ASMJIT_UNLIKELY(!_code))
+ return DebugUtils::errored(kErrorNotInitialized);
+
+ LabelEntry* le;
+ ASMJIT_PROPAGATE(_code->newLabelEntry(&le));
+ uint32_t labelId = le->id();
+
+ // We just added one label so it must be true.
+ ASMJIT_ASSERT(_labelNodes.size() < labelId + 1);
+ ASMJIT_PROPAGATE(_labelNodes.resize(&_allocator, labelId + 1));
+
+ _labelNodes[labelId] = node;
+ node->_labelId = labelId;
+
+ return kErrorOk;
+}
+
+static Error BaseBuilder_newLabelInternal(BaseBuilder* self, uint32_t labelId) {
+ ASMJIT_ASSERT(self->_labelNodes.size() < labelId + 1);
+
+ uint32_t growBy = labelId - self->_labelNodes.size();
+ Error err = self->_labelNodes.willGrow(&self->_allocator, growBy);
+
+ if (ASMJIT_UNLIKELY(err))
+ return self->reportError(err);
+
+ LabelNode* node;
+ ASMJIT_PROPAGATE(self->_newNodeT(&node, labelId));
+
+ self->_labelNodes.resize(&self->_allocator, labelId + 1);
+ self->_labelNodes[labelId] = node;
+ node->_labelId = labelId;
+ return kErrorOk;
+}
+
+Label BaseBuilder::newLabel() {
+ uint32_t labelId = Globals::kInvalidId;
+ LabelEntry* le;
+
+ if (_code &&
+ _code->newLabelEntry(&le) == kErrorOk &&
+ BaseBuilder_newLabelInternal(this, le->id()) == kErrorOk) {
+ labelId = le->id();
+ }
+
+ return Label(labelId);
+}
+
+Label BaseBuilder::newNamedLabel(const char* name, size_t nameSize, uint32_t type, uint32_t parentId) {
+ uint32_t labelId = Globals::kInvalidId;
+ LabelEntry* le;
+
+ if (_code &&
+ _code->newNamedLabelEntry(&le, name, nameSize, type, parentId) == kErrorOk &&
+ BaseBuilder_newLabelInternal(this, le->id()) == kErrorOk) {
+ labelId = le->id();
+ }
+
+ return Label(labelId);
+}
+
+Error BaseBuilder::bind(const Label& label) {
+ LabelNode* node;
+ ASMJIT_PROPAGATE(labelNodeOf(&node, label));
+
+ addNode(node);
+ return kErrorOk;
+}
+
+// ============================================================================
+// [asmjit::BaseBuilder - Passes]
+// ============================================================================
+
+ASMJIT_FAVOR_SIZE Pass* BaseBuilder::passByName(const char* name) const noexcept {
+ for (Pass* pass : _passes)
+ if (strcmp(pass->name(), name) == 0)
+ return pass;
+ return nullptr;
+}
+
+ASMJIT_FAVOR_SIZE Error BaseBuilder::addPass(Pass* pass) noexcept {
+ if (ASMJIT_UNLIKELY(!_code))
+ return DebugUtils::errored(kErrorNotInitialized);
+
+ if (ASMJIT_UNLIKELY(pass == nullptr)) {
+ // Since this is directly called by `addPassT()` we treat `null` argument
+ // as out-of-memory condition. Otherwise it would be API misuse.
+ return DebugUtils::errored(kErrorOutOfMemory);
+ }
+ else if (ASMJIT_UNLIKELY(pass->_cb)) {
+ // Kinda weird, but okay...
+ if (pass->_cb == this)
+ return kErrorOk;
+ return DebugUtils::errored(kErrorInvalidState);
+ }
+
+ ASMJIT_PROPAGATE(_passes.append(&_allocator, pass));
+ pass->_cb = this;
+ return kErrorOk;
+}
+
+ASMJIT_FAVOR_SIZE Error BaseBuilder::deletePass(Pass* pass) noexcept {
+ if (ASMJIT_UNLIKELY(!_code))
+ return DebugUtils::errored(kErrorNotInitialized);
+
+ if (ASMJIT_UNLIKELY(pass == nullptr))
+ return DebugUtils::errored(kErrorInvalidArgument);
+
+ if (pass->_cb != nullptr) {
+ if (pass->_cb != this)
+ return DebugUtils::errored(kErrorInvalidState);
+
+ uint32_t index = _passes.indexOf(pass);
+ ASMJIT_ASSERT(index != Globals::kNotFound);
+
+ pass->_cb = nullptr;
+ _passes.removeAt(index);
+ }
+
+ pass->~Pass();
+ return kErrorOk;
+}
+
+Error BaseBuilder::runPasses() {
+ if (ASMJIT_UNLIKELY(!_code))
+ return DebugUtils::errored(kErrorNotInitialized);
+
+ if (_passes.empty())
+ return kErrorOk;
+
+ ErrorHandler* prev = errorHandler();
+ PostponedErrorHandler postponed;
+
+ Error err = kErrorOk;
+ setErrorHandler(&postponed);
+
+ for (Pass* pass : _passes) {
+ _passZone.reset();
+ err = pass->run(&_passZone, _logger);
+ if (err)
+ break;
+ }
+ _passZone.reset();
+ setErrorHandler(prev);
+
+ if (ASMJIT_UNLIKELY(err))
+ return reportError(err, !postponed._message.empty() ? postponed._message.data() : nullptr);
+
+ return kErrorOk;
+}
+
+// ============================================================================
+// [asmjit::BaseBuilder - Emit]
+// ============================================================================
+
+Error BaseBuilder::_emit(uint32_t instId, const Operand_& o0, const Operand_& o1, const Operand_& o2, const Operand_* opExt) {
+ uint32_t opCount = EmitterUtils::opCountFromEmitArgs(o0, o1, o2, opExt);
+ uint32_t options = instOptions() | forcedInstOptions();
+
+ if (options & BaseInst::kOptionReserved) {
+ if (ASMJIT_UNLIKELY(!_code))
+ return DebugUtils::errored(kErrorNotInitialized);
+
+#ifndef ASMJIT_NO_VALIDATION
+ // Strict validation.
+ if (hasValidationOption(kValidationOptionIntermediate)) {
+ Operand_ opArray[Globals::kMaxOpCount];
+ EmitterUtils::opArrayFromEmitArgs(opArray, o0, o1, o2, opExt);
+
+ Error err = InstAPI::validate(arch(), BaseInst(instId, options, _extraReg), opArray, opCount);
+ if (ASMJIT_UNLIKELY(err)) {
+ resetInstOptions();
+ resetExtraReg();
+ resetInlineComment();
+ return reportError(err);
+ }
+ }
+#endif
+
+ // Clear options that should never be part of `InstNode`.
+ options &= ~BaseInst::kOptionReserved;
+ }
+
+ uint32_t opCapacity = InstNode::capacityOfOpCount(opCount);
+ ASMJIT_ASSERT(opCapacity >= InstNode::kBaseOpCapacity);
+
+ InstNode* node = _allocator.allocT(InstNode::nodeSizeOfOpCapacity(opCapacity));
+ const char* comment = inlineComment();
+
+ resetInstOptions();
+ resetInlineComment();
+
+ if (ASMJIT_UNLIKELY(!node)) {
+ resetExtraReg();
+ return reportError(DebugUtils::errored(kErrorOutOfMemory));
+ }
+
+ node = new(node) InstNode(this, instId, options, opCount, opCapacity);
+ node->setExtraReg(extraReg());
+ node->setOp(0, o0);
+ node->setOp(1, o1);
+ node->setOp(2, o2);
+ for (uint32_t i = 3; i < opCount; i++)
+ node->setOp(i, opExt[i - 3]);
+ node->resetOpRange(opCount, opCapacity);
+
+ if (comment)
+ node->setInlineComment(static_cast(_dataZone.dup(comment, strlen(comment), true)));
+
+ addNode(node);
+ resetExtraReg();
+ return kErrorOk;
+}
+
+// ============================================================================
+// [asmjit::BaseBuilder - Align]
+// ============================================================================
+
+Error BaseBuilder::align(uint32_t alignMode, uint32_t alignment) {
+ if (ASMJIT_UNLIKELY(!_code))
+ return DebugUtils::errored(kErrorNotInitialized);
+
+ AlignNode* node;
+ ASMJIT_PROPAGATE(_newAlignNode(&node, alignMode, alignment));
+
+ addNode(node);
+ return kErrorOk;
+}
+
+// ============================================================================
+// [asmjit::BaseBuilder - Embed]
+// ============================================================================
+
+Error BaseBuilder::embed(const void* data, size_t dataSize) {
+ if (ASMJIT_UNLIKELY(!_code))
+ return DebugUtils::errored(kErrorNotInitialized);
+
+ EmbedDataNode* node;
+ ASMJIT_PROPAGATE(_newEmbedDataNode(&node, Type::kIdU8, data, dataSize));
+
+ addNode(node);
+ return kErrorOk;
+}
+
+Error BaseBuilder::embedDataArray(uint32_t typeId, const void* data, size_t itemCount, size_t itemRepeat) {
+ if (ASMJIT_UNLIKELY(!_code))
+ return DebugUtils::errored(kErrorNotInitialized);
+
+ EmbedDataNode* node;
+ ASMJIT_PROPAGATE(_newEmbedDataNode(&node, typeId, data, itemCount, itemRepeat));
+
+ addNode(node);
+ return kErrorOk;
+}
+
+Error BaseBuilder::embedConstPool(const Label& label, const ConstPool& pool) {
+ if (ASMJIT_UNLIKELY(!_code))
+ return DebugUtils::errored(kErrorNotInitialized);
+
+ if (!isLabelValid(label))
+ return reportError(DebugUtils::errored(kErrorInvalidLabel));
+
+ ASMJIT_PROPAGATE(align(kAlignData, uint32_t(pool.alignment())));
+ ASMJIT_PROPAGATE(bind(label));
+
+ EmbedDataNode* node;
+ ASMJIT_PROPAGATE(_newEmbedDataNode(&node, Type::kIdU8, nullptr, pool.size()));
+
+ pool.fill(node->data());
+ addNode(node);
+ return kErrorOk;
+}
+
+// EmbedLabel / EmbedLabelDelta
+// ----------------------------
+//
+// If dataSize is zero it means that the size is the same as target register
+// width, however, if it's provided we really want to validate whether it's
+// within the possible range.
+
+static inline bool BaseBuilder_checkDataSize(size_t dataSize) noexcept {
+ return !dataSize || (Support::isPowerOf2(dataSize) && dataSize <= 8);
+}
+
+Error BaseBuilder::embedLabel(const Label& label, size_t dataSize) {
+ if (ASMJIT_UNLIKELY(!_code))
+ return DebugUtils::errored(kErrorNotInitialized);
+
+ if (!BaseBuilder_checkDataSize(dataSize))
+ return reportError(DebugUtils::errored(kErrorInvalidArgument));
+
+ EmbedLabelNode* node;
+ ASMJIT_PROPAGATE(_newNodeT(&node, label.id(), uint32_t(dataSize)));
+
+ addNode(node);
+ return kErrorOk;
+}
+
+Error BaseBuilder::embedLabelDelta(const Label& label, const Label& base, size_t dataSize) {
+ if (ASMJIT_UNLIKELY(!_code))
+ return DebugUtils::errored(kErrorNotInitialized);
+
+ if (!BaseBuilder_checkDataSize(dataSize))
+ return reportError(DebugUtils::errored(kErrorInvalidArgument));
+
+ EmbedLabelDeltaNode* node;
+ ASMJIT_PROPAGATE(_newNodeT(&node, label.id(), base.id(), uint32_t(dataSize)));
+
+ addNode(node);
+ return kErrorOk;
+}
+
+// ============================================================================
+// [asmjit::BaseBuilder - Comment]
+// ============================================================================
+
+Error BaseBuilder::comment(const char* data, size_t size) {
+ if (ASMJIT_UNLIKELY(!_code))
+ return DebugUtils::errored(kErrorNotInitialized);
+
+ CommentNode* node;
+ ASMJIT_PROPAGATE(_newCommentNode(&node, data, size));
+
+ addNode(node);
+ return kErrorOk;
+}
+
+// ============================================================================
+// [asmjit::BaseBuilder - Serialize]
+// ============================================================================
+
+Error BaseBuilder::serializeTo(BaseEmitter* dst) {
+ Error err = kErrorOk;
+ BaseNode* node_ = _firstNode;
+
+ Operand_ opArray[Globals::kMaxOpCount];
+
+ do {
+ dst->setInlineComment(node_->inlineComment());
+
+ if (node_->isInst()) {
+ InstNode* node = node_->as();
+
+ // NOTE: Inlined to remove one additional call per instruction.
+ dst->setInstOptions(node->instOptions());
+ dst->setExtraReg(node->extraReg());
+
+ const Operand_* op = node->operands();
+ const Operand_* opExt = EmitterUtils::noExt;
+
+ uint32_t opCount = node->opCount();
+ if (opCount > 3) {
+ uint32_t i = 4;
+ opArray[3] = op[3];
+
+ while (i < opCount) {
+ opArray[i].copyFrom(op[i]);
+ i++;
+ }
+ while (i < Globals::kMaxOpCount) {
+ opArray[i].reset();
+ i++;
+ }
+ opExt = opArray + 3;
+ }
+
+ err = dst->_emit(node->id(), op[0], op[1], op[2], opExt);
+ }
+ else if (node_->isLabel()) {
+ if (node_->isConstPool()) {
+ ConstPoolNode* node = node_->as();
+ err = dst->embedConstPool(node->label(), node->constPool());
+ }
+ else {
+ LabelNode* node = node_->as();
+ err = dst->bind(node->label());
+ }
+ }
+ else if (node_->isAlign()) {
+ AlignNode* node = node_->as();
+ err = dst->align(node->alignMode(), node->alignment());
+ }
+ else if (node_->isEmbedData()) {
+ EmbedDataNode* node = node_->as();
+ err = dst->embedDataArray(node->typeId(), node->data(), node->itemCount(), node->repeatCount());
+ }
+ else if (node_->isEmbedLabel()) {
+ EmbedLabelNode* node = node_->as();
+ err = dst->embedLabel(node->label(), node->dataSize());
+ }
+ else if (node_->isEmbedLabelDelta()) {
+ EmbedLabelDeltaNode* node = node_->as();
+ err = dst->embedLabelDelta(node->label(), node->baseLabel(), node->dataSize());
+ }
+ else if (node_->isSection()) {
+ SectionNode* node = node_->as();
+ err = dst->section(_code->sectionById(node->id()));
+ }
+ else if (node_->isComment()) {
+ CommentNode* node = node_->as();
+ err = dst->comment(node->inlineComment());
+ }
+
+ if (err) break;
+ node_ = node_->next();
+ } while (node_);
+
+ return err;
+}
+
+// ============================================================================
+// [asmjit::BaseBuilder - Events]
+// ============================================================================
+
+Error BaseBuilder::onAttach(CodeHolder* code) noexcept {
+ ASMJIT_PROPAGATE(Base::onAttach(code));
+
+ SectionNode* initialSection;
+ Error err = sectionNodeOf(&initialSection, 0);
+
+ if (!err)
+ err = _passes.willGrow(&_allocator, 8);
+
+ if (ASMJIT_UNLIKELY(err)) {
+ onDetach(code);
+ return err;
+ }
+
+ _cursor = initialSection;
+ _firstNode = initialSection;
+ _lastNode = initialSection;
+ initialSection->setFlags(BaseNode::kFlagIsActive);
+
+ return kErrorOk;
+}
+
+Error BaseBuilder::onDetach(CodeHolder* code) noexcept {
+ BaseBuilder_deletePasses(this);
+ _sectionNodes.reset();
+ _labelNodes.reset();
+
+ _allocator.reset(&_codeZone);
+ _codeZone.reset();
+ _dataZone.reset();
+ _passZone.reset();
+
+ _nodeFlags = 0;
+
+ _cursor = nullptr;
+ _firstNode = nullptr;
+ _lastNode = nullptr;
+
+ return Base::onDetach(code);
+}
+
+// ============================================================================
+// [asmjit::Pass - Construction / Destruction]
+// ============================================================================
+
+Pass::Pass(const char* name) noexcept
+ : _name(name) {}
+Pass::~Pass() noexcept {}
+
+ASMJIT_END_NAMESPACE
+
+#endif // !ASMJIT_NO_BUILDER
diff --git a/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/builder.h b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/builder.h
new file mode 100644
index 0000000..317bda1
--- /dev/null
+++ b/Examples/Theodosius-Kernel/Theodosius-MSREXEC/asmjit/core/builder.h
@@ -0,0 +1,1435 @@
+// AsmJit - Machine code generation for C++
+//
+// * Official AsmJit Home Page: https://asmjit.com
+// * Official Github Repository: https://github.com/asmjit/asmjit
+//
+// Copyright (c) 2008-2020 The AsmJit Authors
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+
+#ifndef ASMJIT_CORE_BUILDER_H_INCLUDED
+#define ASMJIT_CORE_BUILDER_H_INCLUDED
+
+#include "../core/api-config.h"
+#ifndef ASMJIT_NO_BUILDER
+
+#include "../core/assembler.h"
+#include "../core/codeholder.h"
+#include "../core/constpool.h"
+#include "../core/formatter.h"
+#include "../core/inst.h"
+#include "../core/operand.h"
+#include "../core/string.h"
+#include "../core/support.h"
+#include "../core/type.h"
+#include "../core/zone.h"
+#include "../core/zonevector.h"
+
+ASMJIT_BEGIN_NAMESPACE
+
+//! \addtogroup asmjit_builder
+//! \{
+
+// ============================================================================
+// [Forward Declarations]
+// ============================================================================
+
+class BaseBuilder;
+class Pass;
+
+class BaseNode;
+class InstNode;
+class SectionNode;
+class LabelNode;
+class AlignNode;
+class EmbedDataNode;
+class EmbedLabelNode;
+class ConstPoolNode;
+class CommentNode;
+class SentinelNode;
+class LabelDeltaNode;
+
+// Only used by Compiler infrastructure.
+class JumpAnnotation;
+
+// ============================================================================
+// [asmjit::BaseBuilder]
+// ============================================================================
+
+//! Builder interface.
+//!
+//! `BaseBuilder` interface was designed to be used as a \ref BaseAssembler
+//! replacement in case pre-processing or post-processing of the generated code
+//! is required. The code can be modified during or after code generation. Pre
+//! or post processing can be done manually or through a \ref Pass object. \ref
+//! BaseBuilder stores the emitted code as a double-linked list of nodes, which
+//! allows O(1) insertion and removal during processing.
+//!
+//! Check out architecture specific builders for more details and examples:
+//!
+//! - \ref x86::Builder - X86/X64 builder implementation.
+class ASMJIT_VIRTAPI BaseBuilder : public BaseEmitter {
+public:
+ ASMJIT_NONCOPYABLE(BaseBuilder)
+ typedef BaseEmitter Base;
+
+ //! Base zone used to allocate nodes and passes.
+ Zone _codeZone;
+ //! Data zone used to allocate data and names.
+ Zone _dataZone;
+ //! Pass zone, passed to `Pass::run()`.
+ Zone _passZone;
+ //! Allocator that uses `_codeZone`.
+ ZoneAllocator _allocator;
+
+ //! Array of `Pass` objects.
+ ZoneVector _passes {};
+ //! Maps section indexes to `LabelNode` nodes.
+ ZoneVector _sectionNodes {};
+ //! Maps label indexes to `LabelNode` nodes.
+ ZoneVector _labelNodes {};
+
+ //! Current node (cursor).
+ BaseNode* _cursor = nullptr;
+ //! First node of the current section.
+ BaseNode* _firstNode = nullptr;
+ //! Last node of the current section.
+ BaseNode* _lastNode = nullptr;
+
+ //! Flags assigned to each new node.
+ uint32_t _nodeFlags = 0;
+ //! The sections links are dirty (used internally).
+ bool _dirtySectionLinks = false;
+
+ //! \name Construction & Destruction
+ //! \{
+
+ //! Creates a new `BaseBuilder` instance.
+ ASMJIT_API BaseBuilder() noexcept;
+ //! Destroys the `BaseBuilder` instance.
+ ASMJIT_API virtual ~BaseBuilder() noexcept;
+
+ //! \}
+
+ //! \name Node Management
+ //! \{
+
+ //! Returns the first node.
+ inline BaseNode* firstNode() const noexcept { return _firstNode; }
+ //! Returns the last node.
+ inline BaseNode* lastNode() const noexcept { return _lastNode; }
+
+ //! Allocates and instantiates a new node of type `T` and returns its instance.
+ //! If the allocation fails `nullptr` is returned.
+ //!
+ //! The template argument `T` must be a type that is extends \ref BaseNode.
+ //!
+ //! \remarks The pointer returned (if non-null) is owned by the Builder or
+ //! Compiler. When the Builder/Compiler is destroyed it destroys all nodes
+ //! it created so no manual memory management is required.
+ template
+ inline Error _newNodeT(T** out, Args&&... args) {
+ *out = _allocator.newT(this, std::forward(args)...);
+ if (ASMJIT_UNLIKELY(!*out))
+ return reportError(DebugUtils::errored(kErrorOutOfMemory));
+ return kErrorOk;
+ }
+
+ //! Creates a new \ref InstNode.
+ ASMJIT_API Error _newInstNode(InstNode** out, uint32_t instId, uint32_t instOptions, uint32_t opCount);
+ //! Creates a new \ref LabelNode.
+ ASMJIT_API Error _newLabelNode(LabelNode** out);
+ //! Creates a new \ref AlignNode.
+ ASMJIT_API Error _newAlignNode(AlignNode** out, uint32_t alignMode, uint32_t alignment);
+ //! Creates a new \ref EmbedDataNode.
+ ASMJIT_API Error _newEmbedDataNode(EmbedDataNode** out, uint32_t typeId, const void* data, size_t itemCount, size_t repeatCount = 1);
+ //! Creates a new \ref ConstPoolNode.
+ ASMJIT_API Error _newConstPoolNode(ConstPoolNode** out);
+ //! Creates a new \ref CommentNode.
+ ASMJIT_API Error _newCommentNode(CommentNode** out, const char* data, size_t size);
+
+ //! Adds `node` after the current and sets the current node to the given `node`.
+ ASMJIT_API BaseNode* addNode(BaseNode* node) noexcept;
+ //! Inserts the given `node` after `ref`.
+ ASMJIT_API BaseNode* addAfter(BaseNode* node, BaseNode* ref) noexcept;
+ //! Inserts the given `node` before `ref`.
+ ASMJIT_API BaseNode* addBefore(BaseNode* node, BaseNode* ref) noexcept;
+ //! Removes the given `node`.
+ ASMJIT_API BaseNode* removeNode(BaseNode* node) noexcept;
+ //! Removes multiple nodes.
+ ASMJIT_API void removeNodes(BaseNode* first, BaseNode* last) noexcept;
+
+ //! Returns the cursor.
+ //!
+ //! When the Builder/Compiler is created it automatically creates a '.text'
+ //! \ref SectionNode, which will be the initial one. When instructions are
+ //! added they are always added after the cursor and the cursor is changed
+ //! to be that newly added node. Use `setCursor()` to change where new nodes
+ //! are inserted.
+ inline BaseNode* cursor() const noexcept {
+ return _cursor;
+ }
+
+ //! Sets the current node to `node` and return the previous one.
+ ASMJIT_API BaseNode* setCursor(BaseNode* node) noexcept;
+
+ //! Sets the current node without returning the previous node.
+ //!
+ //! Only use this function if you are concerned about performance and want
+ //! this inlined (for example if you set the cursor in a loop, etc...).
+ inline void _setCursor(BaseNode* node) noexcept {
+ _cursor = node;
+ }
+
+ //! \}
+
+ //! \name Section Management
+ //! \{
+
+ //! Returns a vector of SectionNode objects.
+ //!
+ //! \note If a section of some id is not associated with the Builder/Compiler
+ //! it would be null, so always check for nulls if you iterate over the vector.
+ inline const ZoneVector& sectionNodes() const noexcept {
+ return _sectionNodes;
+ }
+
+ //! Tests whether the `SectionNode` of the given `sectionId` was registered.
+ inline bool hasRegisteredSectionNode(uint32_t sectionId) const noexcept {
+ return sectionId < _sectionNodes.size() && _sectionNodes[sectionId] != nullptr;
+ }
+
+ //! Returns or creates a `SectionNode` that matches the given `sectionId`.
+ //!
+ //! \remarks This function will either get the existing `SectionNode` or create
+ //! it in case it wasn't created before. You can check whether a section has a
+ //! registered `SectionNode` by using `BaseBuilder::hasRegisteredSectionNode()`.
+ ASMJIT_API Error sectionNodeOf(SectionNode** out, uint32_t sectionId);
+
+ ASMJIT_API Error section(Section* section) override;
+
+ //! Returns whether the section links of active section nodes are dirty. You can
+ //! update these links by calling `updateSectionLinks()` in such case.
+ inline bool hasDirtySectionLinks() const noexcept { return _dirtySectionLinks; }
+
+ //! Updates links of all active section nodes.
+ ASMJIT_API void updateSectionLinks() noexcept;
+
+ //! \}
+
+ //! \name Label Management
+ //! \{
+
+ //! Returns a vector of \ref LabelNode nodes.
+ //!
+ //! \note If a label of some id is not associated with the Builder/Compiler
+ //! it would be null, so always check for nulls if you iterate over the vector.
+ inline const ZoneVector& labelNodes() const noexcept { return _labelNodes; }
+
+ //! Tests whether the `LabelNode` of the given `labelId` was registered.
+ inline bool hasRegisteredLabelNode(uint32_t labelId) const noexcept {
+ return labelId < _labelNodes.size() && _labelNodes[labelId] != nullptr;
+ }
+
+ //! \overload
+ inline bool hasRegisteredLabelNode(const Label& label) const noexcept {
+ return hasRegisteredLabelNode(label.id());
+ }
+
+ //! Gets or creates a \ref LabelNode that matches the given `labelId`.
+ //!
+ //! \remarks This function will either get the existing `LabelNode` or create
+ //! it in case it wasn't created before. You can check whether a label has a
+ //! registered `LabelNode` by calling \ref BaseBuilder::hasRegisteredLabelNode().
+ ASMJIT_API Error labelNodeOf(LabelNode** out, uint32_t labelId);
+
+ //! \overload
+ inline Error labelNodeOf(LabelNode** out, const Label& label) {
+ return labelNodeOf(out, label.id());
+ }
+
+ //! Registers this \ref LabelNode (internal).
+ //!
+ //! This function is used internally to register a newly created `LabelNode`
+ //! with this instance of Builder/Compiler. Use \ref labelNodeOf() functions
+ //! to get back \ref LabelNode from a label or its identifier.
+ ASMJIT_API Error registerLabelNode(LabelNode* node);
+
+ ASMJIT_API Label newLabel() override;
+ ASMJIT_API Label newNamedLabel(const char* name, size_t nameSize = SIZE_MAX, uint32_t type = Label::kTypeGlobal, uint32_t parentId = Globals::kInvalidId) override;
+ ASMJIT_API Error bind(const Label& label) override;
+
+ //! \}
+
+ //! \name Passes
+ //! \{
+
+ //! Returns a vector of `Pass` instances that will be executed by `runPasses()`.
+ inline const ZoneVector& passes() const noexcept { return _passes; }
+
+ //! Allocates and instantiates a new pass of type `T` and returns its instance.
+ //! If the allocation fails `nullptr` is returned.
+ //!
+ //! The template argument `T` must be a type that is extends \ref Pass.
+ //!
+ //! \remarks The pointer returned (if non-null) is owned by the Builder or
+ //! Compiler. When the Builder/Compiler is destroyed it destroys all passes
+ //! it created so no manual memory management is required.
+ template
+ inline T* newPassT() noexcept { return _codeZone.newT(); }
+
+ //! \overload
+ template
+ inline T* newPassT(Args&&... args) noexcept { return _codeZone.newT(std::forward(args)...); }
+
+ template
+ inline Error addPassT() { return addPass(newPassT