diff --git a/CMakeLists.txt b/CMakeLists.txt index 21c5831a..16c802c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,8 +52,8 @@ endif() set(CMAKE_C_STANDARD 11) set(UNICORN_VERSION_MAJOR 2) -set(UNICORN_VERSION_MINOR 0) -set(UNICORN_VERSION_PATCH 2) +set(UNICORN_VERSION_MINOR 1) +set(UNICORN_VERSION_PATCH 0) include(cmake/bundle_static.cmake) diff --git a/Cargo.toml b/Cargo.toml index 64ab69b2..99cda4a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "unicorn-engine" -version = "2.0.2" +version = "2.1.0" authors = ["Ziqiao Kong", "Lukas Seidel"] documentation = "https://github.com/unicorn-engine/unicorn/wiki" edition = "2021" diff --git a/bindings/dotnet/UnicornEngine/Const/Common.fs b/bindings/dotnet/UnicornEngine/Const/Common.fs index f44d1149..76f1ce11 100644 --- a/bindings/dotnet/UnicornEngine/Const/Common.fs +++ b/bindings/dotnet/UnicornEngine/Const/Common.fs @@ -7,15 +7,15 @@ open System [] module Common = let UC_API_MAJOR = 2 + let UC_API_MINOR = 1 - let UC_API_MINOR = 0 - let UC_API_PATCH = 2 - let UC_API_EXTRA = 1 + let UC_API_PATCH = 0 + let UC_API_EXTRA = 255 let UC_VERSION_MAJOR = 2 + let UC_VERSION_MINOR = 1 - let UC_VERSION_MINOR = 0 - let UC_VERSION_PATCH = 2 - let UC_VERSION_EXTRA = 1 + let UC_VERSION_PATCH = 0 + let UC_VERSION_EXTRA = 255 let UC_SECOND_SCALE = 1000000 let UC_MILISECOND_SCALE = 1000 let UC_ARCH_ARM = 1 @@ -80,6 +80,7 @@ module Common = let UC_ERR_HOOK_EXIST = 19 let UC_ERR_RESOURCE = 20 let UC_ERR_EXCEPTION = 21 + let UC_ERR_OVERFLOW = 22 let UC_MEM_READ = 16 let UC_MEM_WRITE = 17 let UC_MEM_FETCH = 18 @@ -145,10 +146,14 @@ module Common = let UC_CTL_TB_FLUSH = 10 let UC_CTL_TLB_FLUSH = 11 let UC_CTL_TLB_TYPE = 12 + let UC_CTL_TCG_BUFFER_SIZE = 13 + let UC_CTL_CONTEXT_MODE = 14 let UC_PROT_NONE = 0 let UC_PROT_READ = 1 let UC_PROT_WRITE = 2 let UC_PROT_EXEC = 4 let UC_PROT_ALL = 7 + let UC_CTL_CONTEXT_CPU = 1 + let UC_CTL_CONTEXT_MEMORY = 2 diff --git a/bindings/dotnet/UnicornEngine/UnicornEngine.fsproj b/bindings/dotnet/UnicornEngine/UnicornEngine.fsproj index 8fd0d790..3689dea9 100644 --- a/bindings/dotnet/UnicornEngine/UnicornEngine.fsproj +++ b/bindings/dotnet/UnicornEngine/UnicornEngine.fsproj @@ -6,7 +6,7 @@ Copyright © Antonio Parata 2016 https://github.com/unicorn-engine/unicorn .NET bindings for unicorn - 2.0.2-rc1 + 2.1.0 $(VersionSuffix) 0c21f1c1-2725-4a46-9022-1905f85822a5 true diff --git a/bindings/dotnet/UnicornSamples/UnicornSamples.csproj b/bindings/dotnet/UnicornSamples/UnicornSamples.csproj index 9aea0c7d..7311f12a 100644 --- a/bindings/dotnet/UnicornSamples/UnicornSamples.csproj +++ b/bindings/dotnet/UnicornSamples/UnicornSamples.csproj @@ -6,7 +6,7 @@ UnicornSamples Copyright © Antonio Parata 2016 https://github.com/unicorn-engine/unicorn - 2.0.2-rc1 + 2.1.0 {B80B5987-1E24-4309-8BF9-C4F91270F21C} true diff --git a/bindings/go/unicorn/unicorn_const.go b/bindings/go/unicorn/unicorn_const.go index f82cf916..16b03619 100644 --- a/bindings/go/unicorn/unicorn_const.go +++ b/bindings/go/unicorn/unicorn_const.go @@ -2,15 +2,15 @@ package unicorn // For Unicorn Engine. AUTO-GENERATED FILE, DO NOT EDIT [unicorn_const.go] const ( API_MAJOR = 2 + API_MINOR = 1 - API_MINOR = 0 - API_PATCH = 2 - API_EXTRA = 1 + API_PATCH = 0 + API_EXTRA = 255 VERSION_MAJOR = 2 + VERSION_MINOR = 1 - VERSION_MINOR = 0 - VERSION_PATCH = 2 - VERSION_EXTRA = 1 + VERSION_PATCH = 0 + VERSION_EXTRA = 255 SECOND_SCALE = 1000000 MILISECOND_SCALE = 1000 ARCH_ARM = 1 @@ -75,6 +75,7 @@ const ( ERR_HOOK_EXIST = 19 ERR_RESOURCE = 20 ERR_EXCEPTION = 21 + ERR_OVERFLOW = 22 MEM_READ = 16 MEM_WRITE = 17 MEM_FETCH = 18 @@ -140,10 +141,14 @@ const ( CTL_TB_FLUSH = 10 CTL_TLB_FLUSH = 11 CTL_TLB_TYPE = 12 + CTL_TCG_BUFFER_SIZE = 13 + CTL_CONTEXT_MODE = 14 PROT_NONE = 0 PROT_READ = 1 PROT_WRITE = 2 PROT_EXEC = 4 PROT_ALL = 7 + CTL_CONTEXT_CPU = 1 + CTL_CONTEXT_MEMORY = 2 ) \ No newline at end of file diff --git a/bindings/java/CMakeLists.txt b/bindings/java/CMakeLists.txt new file mode 100644 index 00000000..a37f26c6 --- /dev/null +++ b/bindings/java/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.1) + +find_package(JNI) + +if (JNI_FOUND) + message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}") + message (STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}") +else() +message(FATAL_ERROR "JNI not found, please try to update JAVA_HOME accordingly") +endif() + +add_library(unicorn_java SHARED unicorn_Unicorn.c) + +message("${CMAKE_CURRENT_SOURCE_DIR}/bindings/java/target/headers") + +if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/target/headers") + message(FATAL_ERROR "bindings/java/target/headers not generated, please generate them firstly") +endif() + +target_include_directories(unicorn_java PRIVATE target/headers ${JNI_INCLUDE_DIRS}) +target_link_libraries(unicorn_java PRIVATE unicorn ${JNI_LIBRARIES}) \ No newline at end of file diff --git a/bindings/java/Makefile b/bindings/java/Makefile index aa3fe7d1..0c4fc5ab 100644 --- a/bindings/java/Makefile +++ b/bindings/java/Makefile @@ -36,6 +36,9 @@ unicorn_Unicorn.o: unicorn_Unicorn.c target/headers/unicorn_Unicorn.h libunicorn_java$(LIB_EXT): $(OBJS) $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) +gen_const: + cd .. && python3 const_generator.py java + clean: rm -f libunicorn_java$(LIB_EXT) rm -f $(OBJS) diff --git a/bindings/java/pom.xml b/bindings/java/pom.xml index 686f7b66..781eeb51 100644 --- a/bindings/java/pom.xml +++ b/bindings/java/pom.xml @@ -6,7 +6,7 @@ org.unicorn-engine unicorn - 2.0 + 2.1.0 unicorn https://www.unicorn-engine.org diff --git a/bindings/java/src/main/java/unicorn/UnicornConst.java b/bindings/java/src/main/java/unicorn/UnicornConst.java index 8ab6fdb1..b0d135a8 100644 --- a/bindings/java/src/main/java/unicorn/UnicornConst.java +++ b/bindings/java/src/main/java/unicorn/UnicornConst.java @@ -4,15 +4,15 @@ package unicorn; public interface UnicornConst { public static final int UC_API_MAJOR = 2; + public static final int UC_API_MINOR = 1; - public static final int UC_API_MINOR = 0; - public static final int UC_API_PATCH = 2; - public static final int UC_API_EXTRA = 1; + public static final int UC_API_PATCH = 0; + public static final int UC_API_EXTRA = 255; public static final int UC_VERSION_MAJOR = 2; + public static final int UC_VERSION_MINOR = 1; - public static final int UC_VERSION_MINOR = 0; - public static final int UC_VERSION_PATCH = 2; - public static final int UC_VERSION_EXTRA = 1; + public static final int UC_VERSION_PATCH = 0; + public static final int UC_VERSION_EXTRA = 255; public static final int UC_SECOND_SCALE = 1000000; public static final int UC_MILISECOND_SCALE = 1000; public static final int UC_ARCH_ARM = 1; @@ -144,11 +144,14 @@ public interface UnicornConst { public static final int UC_CTL_TLB_FLUSH = 11; public static final int UC_CTL_TLB_TYPE = 12; public static final int UC_CTL_TCG_BUFFER_SIZE = 13; + public static final int UC_CTL_CONTEXT_MODE = 14; public static final int UC_PROT_NONE = 0; public static final int UC_PROT_READ = 1; public static final int UC_PROT_WRITE = 2; public static final int UC_PROT_EXEC = 4; public static final int UC_PROT_ALL = 7; + public static final int UC_CTL_CONTEXT_CPU = 1; + public static final int UC_CTL_CONTEXT_MEMORY = 2; } diff --git a/bindings/pascal/unicorn/UnicornConst.pas b/bindings/pascal/unicorn/UnicornConst.pas index 8b38e8e0..92a99d4a 100644 --- a/bindings/pascal/unicorn/UnicornConst.pas +++ b/bindings/pascal/unicorn/UnicornConst.pas @@ -5,15 +5,15 @@ unit UnicornConst; interface const UC_API_MAJOR = 2; + UC_API_MINOR = 1; - UC_API_MINOR = 0; - UC_API_PATCH = 2; - UC_API_EXTRA = 1; + UC_API_PATCH = 0; + UC_API_EXTRA = 255; UC_VERSION_MAJOR = 2; + UC_VERSION_MINOR = 1; - UC_VERSION_MINOR = 0; - UC_VERSION_PATCH = 2; - UC_VERSION_EXTRA = 1; + UC_VERSION_PATCH = 0; + UC_VERSION_EXTRA = 255; UC_SECOND_SCALE = 1000000; UC_MILISECOND_SCALE = 1000; UC_ARCH_ARM = 1; @@ -78,6 +78,7 @@ const UC_API_MAJOR = 2; UC_ERR_HOOK_EXIST = 19; UC_ERR_RESOURCE = 20; UC_ERR_EXCEPTION = 21; + UC_ERR_OVERFLOW = 22; UC_MEM_READ = 16; UC_MEM_WRITE = 17; UC_MEM_FETCH = 18; @@ -143,12 +144,16 @@ const UC_API_MAJOR = 2; UC_CTL_TB_FLUSH = 10; UC_CTL_TLB_FLUSH = 11; UC_CTL_TLB_TYPE = 12; + UC_CTL_TCG_BUFFER_SIZE = 13; + UC_CTL_CONTEXT_MODE = 14; UC_PROT_NONE = 0; UC_PROT_READ = 1; UC_PROT_WRITE = 2; UC_PROT_EXEC = 4; UC_PROT_ALL = 7; + UC_CTL_CONTEXT_CPU = 1; + UC_CTL_CONTEXT_MEMORY = 2; implementation end. \ No newline at end of file diff --git a/bindings/python/.gdb_history b/bindings/python/.gdb_history new file mode 100644 index 00000000..1a960552 --- /dev/null +++ b/bindings/python/.gdb_history @@ -0,0 +1,107 @@ +q +rr +r +bt +b tcg.c:3075 +r +p ts +p *ts +bt +q +b translate.c:4810 +r +q +r +b translate.c:4810 +frame level 5 +frame level 7 +q +r +bt +q +r +bt +q +r +bt +b translate.c:4810 +r +p/x s->pc +n +n +n +n +n +n +n +n +p/x aflag +n +n +n +p/x dflag +n +n +n +n +p/x f +n +s +n +n +n +n +n +n +n +n +n +n +n +n +n +n +n +q +r +bt +q +r +bt +frame level 7 +p/x op +p op +p *op +q +b tcg_optimize +r +b tcg_optimize_x86_64 +r +n +s +s +s +q +r +exit +b tcg_dump_ops +r +b tcg_dump_ops +b tcg_dump_ops_x86_64 +r +b tcg_optimize_x86_64 +r +b tcg_optimize_x86_64 +r +b tcg_optimize_x86_64 +r +b print_log +r +b print_log +r +f fprintf +q +b write +r +bt +q diff --git a/bindings/python/setup.py b/bindings/python/setup.py index 664ec40d..5710a0de 100755 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -32,7 +32,7 @@ SRC_DIR = os.path.join(ROOT_DIR, 'src') UC_DIR = SRC_DIR if os.path.exists(SRC_DIR) else os.path.join(ROOT_DIR, '../..') BUILD_DIR = os.path.join(UC_DIR, 'build_python') -VERSION = "2.0.2" +VERSION = "2.1.0" if SYSTEM == 'darwin': LIBRARY_FILE = "libunicorn.2.dylib" diff --git a/bindings/python/unicorn/unicorn_const.py b/bindings/python/unicorn/unicorn_const.py index 64247899..46c53ddc 100644 --- a/bindings/python/unicorn/unicorn_const.py +++ b/bindings/python/unicorn/unicorn_const.py @@ -1,14 +1,14 @@ # For Unicorn Engine. AUTO-GENERATED FILE, DO NOT EDIT [unicorn_const.py] UC_API_MAJOR = 2 +UC_API_MINOR = 1 -UC_API_MINOR = 0 -UC_API_PATCH = 2 -UC_API_EXTRA = 1 +UC_API_PATCH = 0 +UC_API_EXTRA = 255 UC_VERSION_MAJOR = 2 +UC_VERSION_MINOR = 1 -UC_VERSION_MINOR = 0 -UC_VERSION_PATCH = 2 -UC_VERSION_EXTRA = 1 +UC_VERSION_PATCH = 0 +UC_VERSION_EXTRA = 255 UC_SECOND_SCALE = 1000000 UC_MILISECOND_SCALE = 1000 UC_ARCH_ARM = 1 @@ -73,6 +73,7 @@ UC_ERR_FETCH_UNALIGNED = 18 UC_ERR_HOOK_EXIST = 19 UC_ERR_RESOURCE = 20 UC_ERR_EXCEPTION = 21 +UC_ERR_OVERFLOW = 22 UC_MEM_READ = 16 UC_MEM_WRITE = 17 UC_MEM_FETCH = 18 @@ -138,9 +139,13 @@ UC_CTL_TB_REMOVE_CACHE = 9 UC_CTL_TB_FLUSH = 10 UC_CTL_TLB_FLUSH = 11 UC_CTL_TLB_TYPE = 12 +UC_CTL_TCG_BUFFER_SIZE = 13 +UC_CTL_CONTEXT_MODE = 14 UC_PROT_NONE = 0 UC_PROT_READ = 1 UC_PROT_WRITE = 2 UC_PROT_EXEC = 4 UC_PROT_ALL = 7 +UC_CTL_CONTEXT_CPU = 1 +UC_CTL_CONTEXT_MEMORY = 2 diff --git a/bindings/ruby/Makefile b/bindings/ruby/Makefile index c4033f83..92a9face 100644 --- a/bindings/ruby/Makefile +++ b/bindings/ruby/Makefile @@ -5,7 +5,7 @@ # Use bundle install && rake to install gem and test install: gen_const cd unicorn_gem && rake build - cd unicorn_gem && gem install --local pkg/unicorn-engine-2.0.0.gem + cd unicorn_gem && gem install --local pkg/unicorn-engine-2.1.0.gem gen_const: cd .. && python3 const_generator.py ruby diff --git a/bindings/ruby/unicorn_gem/lib/unicorn_engine/unicorn_const.rb b/bindings/ruby/unicorn_gem/lib/unicorn_engine/unicorn_const.rb index 8eaf2c36..8c004ed0 100644 --- a/bindings/ruby/unicorn_gem/lib/unicorn_engine/unicorn_const.rb +++ b/bindings/ruby/unicorn_gem/lib/unicorn_engine/unicorn_const.rb @@ -2,15 +2,15 @@ module UnicornEngine UC_API_MAJOR = 2 + UC_API_MINOR = 1 - UC_API_MINOR = 0 - UC_API_PATCH = 2 - UC_API_EXTRA = 1 + UC_API_PATCH = 0 + UC_API_EXTRA = 255 UC_VERSION_MAJOR = 2 + UC_VERSION_MINOR = 1 - UC_VERSION_MINOR = 0 - UC_VERSION_PATCH = 2 - UC_VERSION_EXTRA = 1 + UC_VERSION_PATCH = 0 + UC_VERSION_EXTRA = 255 UC_SECOND_SCALE = 1000000 UC_MILISECOND_SCALE = 1000 UC_ARCH_ARM = 1 @@ -75,6 +75,7 @@ module UnicornEngine UC_ERR_HOOK_EXIST = 19 UC_ERR_RESOURCE = 20 UC_ERR_EXCEPTION = 21 + UC_ERR_OVERFLOW = 22 UC_MEM_READ = 16 UC_MEM_WRITE = 17 UC_MEM_FETCH = 18 @@ -140,10 +141,14 @@ module UnicornEngine UC_CTL_TB_FLUSH = 10 UC_CTL_TLB_FLUSH = 11 UC_CTL_TLB_TYPE = 12 + UC_CTL_TCG_BUFFER_SIZE = 13 + UC_CTL_CONTEXT_MODE = 14 UC_PROT_NONE = 0 UC_PROT_READ = 1 UC_PROT_WRITE = 2 UC_PROT_EXEC = 4 UC_PROT_ALL = 7 + UC_CTL_CONTEXT_CPU = 1 + UC_CTL_CONTEXT_MEMORY = 2 end \ No newline at end of file diff --git a/bindings/ruby/unicorn_gem/lib/unicorn_engine/version.rb b/bindings/ruby/unicorn_gem/lib/unicorn_engine/version.rb index 2e12656e..7dd69b0a 100644 --- a/bindings/ruby/unicorn_gem/lib/unicorn_engine/version.rb +++ b/bindings/ruby/unicorn_gem/lib/unicorn_engine/version.rb @@ -1,3 +1,3 @@ module Unicorn - VERSION = "2.0.0" + VERSION = "2.1.0" end diff --git a/bindings/rust/README.md b/bindings/rust/README.md index 35b881aa..f1401c36 100644 --- a/bindings/rust/README.md +++ b/bindings/rust/README.md @@ -32,7 +32,7 @@ Add this to your `Cargo.toml`: ``` [dependencies] -unicorn-engine = "2.0.0" +unicorn-engine = "2.1.0" ``` ## Acknowledgements diff --git a/bindings/zig/unicorn/unicorn_const.zig b/bindings/zig/unicorn/unicorn_const.zig index afebcd76..aaf1169f 100644 --- a/bindings/zig/unicorn/unicorn_const.zig +++ b/bindings/zig/unicorn/unicorn_const.zig @@ -2,15 +2,15 @@ pub const unicornConst = enum(c_int) { API_MAJOR = 2, + API_MINOR = 1, - API_MINOR = 0, - API_PATCH = 2, - API_EXTRA = 1, + API_PATCH = 0, + API_EXTRA = 255, VERSION_MAJOR = 2, + VERSION_MINOR = 1, - VERSION_MINOR = 0, - VERSION_PATCH = 2, - VERSION_EXTRA = 1, + VERSION_PATCH = 0, + VERSION_EXTRA = 255, SECOND_SCALE = 1000000, MILISECOND_SCALE = 1000, ARCH_ARM = 1, @@ -75,6 +75,7 @@ pub const unicornConst = enum(c_int) { ERR_HOOK_EXIST = 19, ERR_RESOURCE = 20, ERR_EXCEPTION = 21, + ERR_OVERFLOW = 22, MEM_READ = 16, MEM_WRITE = 17, MEM_FETCH = 18, @@ -140,11 +141,15 @@ pub const unicornConst = enum(c_int) { CTL_TB_FLUSH = 10, CTL_TLB_FLUSH = 11, CTL_TLB_TYPE = 12, + CTL_TCG_BUFFER_SIZE = 13, + CTL_CONTEXT_MODE = 14, PROT_NONE = 0, PROT_READ = 1, PROT_WRITE = 2, PROT_EXEC = 4, PROT_ALL = 7, + CTL_CONTEXT_CPU = 1, + CTL_CONTEXT_MEMORY = 2, }; diff --git a/build.zig.zon b/build.zig.zon index 4cdd174d..96e681b9 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,5 +1,5 @@ .{ .name = "unicorn", - .version = "2.0.0", + .version = "2.1.0", .paths = .{""}, } diff --git a/include/unicorn/unicorn.h b/include/unicorn/unicorn.h index d0f5b9ea..05d20e13 100644 --- a/include/unicorn/unicorn.h +++ b/include/unicorn/unicorn.h @@ -71,10 +71,10 @@ typedef size_t uc_hook; // Unicorn API version #define UC_API_MAJOR 2 -#define UC_API_MINOR 0 -#define UC_API_PATCH 2 +#define UC_API_MINOR 1 +#define UC_API_PATCH 0 // Release candidate version, 255 means the official release. -#define UC_API_EXTRA 1 +#define UC_API_EXTRA 255 // Unicorn package version #define UC_VERSION_MAJOR UC_API_MAJOR