diff --git a/include/uc_priv.h b/include/uc_priv.h index ce73ce01..e713f4bb 100644 --- a/include/uc_priv.h +++ b/include/uc_priv.h @@ -110,7 +110,7 @@ enum uc_hook_idx { // if statement to check hook bounds #define HOOK_BOUND_CHECK(hh, addr) \ - ((((addr) >= (hh)->begin && (addr) < (hh)->end) \ + ((((addr) >= (hh)->begin && (addr) <= (hh)->end) \ || (hh)->begin > (hh)->end)) #define HOOK_EXISTS(uc, idx) ((uc)->hook[idx##_IDX].head != NULL) diff --git a/qemu/target-arm/translate-a64.c b/qemu/target-arm/translate-a64.c index 4079a61c..06378453 100644 --- a/qemu/target-arm/translate-a64.c +++ b/qemu/target-arm/translate-a64.c @@ -10970,7 +10970,6 @@ static void disas_data_proc_simd_fp(DisasContext *s, uint32_t insn) static void disas_a64_insn(CPUARMState *env, DisasContext *s) { uint32_t insn; - struct hook *hook; TCGContext *tcg_ctx = env->uc->tcg_ctx; // Unicorn: end address tells us to stop emulation @@ -11042,7 +11041,6 @@ void gen_intermediate_code_internal_a64(ARMCPU *cpu, int max_insns; TCGContext *tcg_ctx = env->uc->tcg_ctx; bool block_full = false; - struct hook *hook; pc_start = tb->pc; diff --git a/samples/mem_apis.c b/samples/mem_apis.c index 50554eeb..bd0d81ba 100644 --- a/samples/mem_apis.c +++ b/samples/mem_apis.c @@ -170,7 +170,7 @@ static void do_nx_demo(bool cause_fault) // intercept code and invalid memory events if (uc_hook_add(uc, &trace2, UC_HOOK_CODE, hook_code, NULL, (uint64_t)1, (uint64_t)0) != UC_ERR_OK || uc_hook_add(uc, &trace1, UC_HOOK_MEM_INVALID, - hook_mem_invalid, NULL) != UC_ERR_OK) { + hook_mem_invalid, NULL, (uint64_t)1, (uint64_t)0) != UC_ERR_OK) { printf("not ok - Failed to install hooks\n"); return; } @@ -251,7 +251,7 @@ static void do_perms_demo(bool change_perms) if (uc_hook_add(uc, &trace2, UC_HOOK_CODE, hook_code, NULL, (uint64_t)1, (uint64_t)0) != UC_ERR_OK || uc_hook_add(uc, &trace1, UC_HOOK_MEM_INVALID, - hook_mem_invalid, NULL) != UC_ERR_OK) { + hook_mem_invalid, NULL, (uint64_t)1, (uint64_t)0) != UC_ERR_OK) { printf("not ok - Failed to install hooks\n"); return; } @@ -329,7 +329,7 @@ static void do_unmap_demo(bool do_unmap) if (uc_hook_add(uc, &trace2, UC_HOOK_CODE, hook_code, NULL, (uint64_t)1, (uint64_t)0) != UC_ERR_OK || uc_hook_add(uc, &trace1, UC_HOOK_MEM_INVALID, - hook_mem_invalid, NULL) != UC_ERR_OK) { + hook_mem_invalid, NULL, (uint64_t)1, (uint64_t)0) != UC_ERR_OK) { printf("not ok - Failed to install hooks\n"); return; }