Merge branch 'hook-refactor' of https://github.com/lunixbochs/unicorn into lunixbochs-hook-refactor

This commit is contained in:
Nguyen Anh Quynh 2016-01-23 13:24:12 +08:00
commit 38d1443504
3 changed files with 4 additions and 6 deletions

View file

@ -110,7 +110,7 @@ enum uc_hook_idx {
// if statement to check hook bounds // if statement to check hook bounds
#define HOOK_BOUND_CHECK(hh, addr) \ #define HOOK_BOUND_CHECK(hh, addr) \
((((addr) >= (hh)->begin && (addr) < (hh)->end) \ ((((addr) >= (hh)->begin && (addr) <= (hh)->end) \
|| (hh)->begin > (hh)->end)) || (hh)->begin > (hh)->end))
#define HOOK_EXISTS(uc, idx) ((uc)->hook[idx##_IDX].head != NULL) #define HOOK_EXISTS(uc, idx) ((uc)->hook[idx##_IDX].head != NULL)

View file

@ -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) static void disas_a64_insn(CPUARMState *env, DisasContext *s)
{ {
uint32_t insn; uint32_t insn;
struct hook *hook;
TCGContext *tcg_ctx = env->uc->tcg_ctx; TCGContext *tcg_ctx = env->uc->tcg_ctx;
// Unicorn: end address tells us to stop emulation // Unicorn: end address tells us to stop emulation
@ -11042,7 +11041,6 @@ void gen_intermediate_code_internal_a64(ARMCPU *cpu,
int max_insns; int max_insns;
TCGContext *tcg_ctx = env->uc->tcg_ctx; TCGContext *tcg_ctx = env->uc->tcg_ctx;
bool block_full = false; bool block_full = false;
struct hook *hook;
pc_start = tb->pc; pc_start = tb->pc;

View file

@ -170,7 +170,7 @@ static void do_nx_demo(bool cause_fault)
// intercept code and invalid memory events // 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 || 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, 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"); printf("not ok - Failed to install hooks\n");
return; 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 || 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_add(uc, &trace1,
UC_HOOK_MEM_INVALID, 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"); printf("not ok - Failed to install hooks\n");
return; 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 || 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_add(uc, &trace1,
UC_HOOK_MEM_INVALID, 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"); printf("not ok - Failed to install hooks\n");
return; return;
} }