diff --git a/bindings/dotnet/UnicornManaged/Const/Common.fs b/bindings/dotnet/UnicornManaged/Const/Common.fs index 3ec03c74..4dce96df 100644 --- a/bindings/dotnet/UnicornManaged/Const/Common.fs +++ b/bindings/dotnet/UnicornManaged/Const/Common.fs @@ -90,6 +90,7 @@ module Common = let UC_HOOK_MEM_WRITE_INVALID = 288 let UC_HOOK_MEM_FETCH_INVALID = 576 let UC_HOOK_MEM_INVALID = 1008 + let UC_QUERY_MODE = 1 let UC_PROT_NONE = 0 let UC_PROT_READ = 1 diff --git a/bindings/go/unicorn/unicorn_const.go b/bindings/go/unicorn/unicorn_const.go index 2d8d2c1a..8fb6d3f4 100644 --- a/bindings/go/unicorn/unicorn_const.go +++ b/bindings/go/unicorn/unicorn_const.go @@ -85,6 +85,7 @@ const ( HOOK_MEM_WRITE_INVALID = 288 HOOK_MEM_FETCH_INVALID = 576 HOOK_MEM_INVALID = 1008 + QUERY_MODE = 1 PROT_NONE = 0 PROT_READ = 1 diff --git a/bindings/java/unicorn/UnicornConst.java b/bindings/java/unicorn/UnicornConst.java index 5967d26b..7203fbd0 100644 --- a/bindings/java/unicorn/UnicornConst.java +++ b/bindings/java/unicorn/UnicornConst.java @@ -87,6 +87,7 @@ public interface UnicornConst { public static final int UC_HOOK_MEM_WRITE_INVALID = 288; public static final int UC_HOOK_MEM_FETCH_INVALID = 576; public static final int UC_HOOK_MEM_INVALID = 1008; + public static final int UC_QUERY_MODE = 1; public static final int UC_PROT_NONE = 0; public static final int UC_PROT_READ = 1; diff --git a/bindings/python/unicorn/unicorn_const.py b/bindings/python/unicorn/unicorn_const.py index a1967684..dd4c6d16 100644 --- a/bindings/python/unicorn/unicorn_const.py +++ b/bindings/python/unicorn/unicorn_const.py @@ -83,6 +83,7 @@ UC_HOOK_MEM_READ_INVALID = 144 UC_HOOK_MEM_WRITE_INVALID = 288 UC_HOOK_MEM_FETCH_INVALID = 576 UC_HOOK_MEM_INVALID = 1008 +UC_QUERY_MODE = 1 UC_PROT_NONE = 0 UC_PROT_READ = 1 diff --git a/include/unicorn/unicorn.h b/include/unicorn/unicorn.h index d5cd1422..6ecd6dc2 100644 --- a/include/unicorn/unicorn.h +++ b/include/unicorn/unicorn.h @@ -257,8 +257,9 @@ typedef struct uc_mem_region { // All type of queries for uc_query() API. typedef enum uc_query_type { - // Query current hardware mode for ARM. Return 1 for Thumb, 0 for ARM - UC_QUERY_ARM_MODE = 1, + // Dynamically query current hardware mode. + // For ARM, uc_query() return 1 for Thumb mode, and 0 for Arm mode + UC_QUERY_MODE = 1, } uc_query_type; /* @@ -325,8 +326,9 @@ uc_err uc_close(uc_engine *uc); Query internal status of engine. @uc: handle returned by uc_open() - @type: query type - @result: status retrieved + @type: query type. See uc_query_type + + @result: save the internal status queried @return: error code of uc_err enum type (UC_ERR_*, see above) */ diff --git a/qemu/target-arm/unicorn_arm.c b/qemu/target-arm/unicorn_arm.c index 0a64d151..15906deb 100644 --- a/qemu/target-arm/unicorn_arm.c +++ b/qemu/target-arm/unicorn_arm.c @@ -113,7 +113,7 @@ static uc_err arm_query(struct uc_struct *uc, uc_query_type type, size_t *result CPUState *mycpu = first_cpu; switch(type) { - case UC_QUERY_ARM_MODE: + case UC_QUERY_MODE: *result = (ARM_CPU(uc, mycpu)->env.thumb != 0); return UC_ERR_OK; default: