From 15a774ac904ca8f834c2f2c2dbd0510ce53ca662 Mon Sep 17 00:00:00 2001 From: Jonathon Reinhart Date: Wed, 26 Aug 2015 06:34:47 -0400 Subject: [PATCH] change uch to uc_struct (target-mips) --- qemu/target-mips/translate.c | 8 ++++---- qemu/target-mips/unicorn.c | 17 +++++++---------- qemu/target-mips/unicorn.h | 6 +++--- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/qemu/target-mips/translate.c b/qemu/target-mips/translate.c index 4dbad582..6ffd0d79 100644 --- a/qemu/target-mips/translate.c +++ b/qemu/target-mips/translate.c @@ -11344,7 +11344,7 @@ static int decode_mips16_opc (CPUMIPSState *env, DisasContext *ctx) // Unicorn: trace this instruction on request if (env->uc->hook_insn) { - struct hook_struct *trace = hook_find((uch)env->uc, UC_HOOK_CODE, ctx->pc); + struct hook_struct *trace = hook_find(env->uc, UC_HOOK_CODE, ctx->pc); if (trace) gen_uc_tracecode(tcg_ctx, 0xf8f8f8f8, trace->callback, env->uc, ctx->pc, trace->user_data); // if requested to emulate only some instructions, check if @@ -13944,7 +13944,7 @@ static int decode_micromips_opc (CPUMIPSState *env, DisasContext *ctx) // Unicorn: trace this instruction on request if (env->uc->hook_insn) { - struct hook_struct *trace = hook_find((uch)env->uc, UC_HOOK_CODE, ctx->pc); + struct hook_struct *trace = hook_find(env->uc, UC_HOOK_CODE, ctx->pc); if (trace) gen_uc_tracecode(tcg_ctx, 0xf8f8f8f8, trace->callback, env->uc, ctx->pc, trace->user_data); // if requested to emulate only some instructions, check if @@ -18523,7 +18523,7 @@ static void decode_opc (CPUMIPSState *env, DisasContext *ctx) // Unicorn: trace this instruction on request if (env->uc->hook_insn) { - struct hook_struct *trace = hook_find((uch)env->uc, UC_HOOK_CODE, ctx->pc); + struct hook_struct *trace = hook_find(env->uc, UC_HOOK_CODE, ctx->pc); if (trace) gen_uc_tracecode(tcg_ctx, 0xf8f8f8f8, trace->callback, env->uc, ctx->pc, trace->user_data); // if requested to emulate only some instructions, check if @@ -19208,7 +19208,7 @@ gen_intermediate_code_internal(MIPSCPU *cpu, TranslationBlock *tb, // Unicorn: trace this block on request if (env->uc->hook_block) { - struct hook_struct *trace = hook_find((uch)env->uc, UC_HOOK_BLOCK, pc_start); + struct hook_struct *trace = hook_find(env->uc, UC_HOOK_BLOCK, pc_start); if (trace) { // save block address to see if we need to patch block size later env->uc->block_addr = pc_start; diff --git a/qemu/target-mips/unicorn.c b/qemu/target-mips/unicorn.c index a66efdaf..33f1d6c0 100644 --- a/qemu/target-mips/unicorn.c +++ b/qemu/target-mips/unicorn.c @@ -22,19 +22,17 @@ static void mips_set_pc(struct uc_struct *uc, uint64_t address) ((CPUMIPSState *)uc->current_cpu->env_ptr)->active_tc.PC = address; } -void mips_reg_reset(uch handle) +void mips_reg_reset(struct uc_struct *uc) { - struct uc_struct *uc = (struct uc_struct *) handle; - CPUArchState *env; - - env = first_cpu->env_ptr; + (void)uc; + CPUArchState *env = first_cpu->env_ptr; memset(env->active_tc.gpr, 0, sizeof(env->active_tc.gpr)); - env->active_tc.PC = 0; } + env->active_tc.PC = 0; +} -int mips_reg_read(uch handle, unsigned int regid, void *value) +int mips_reg_read(struct uc_struct *uc, unsigned int regid, void *value) { - struct uc_struct *uc = (struct uc_struct *) handle; CPUState *mycpu = first_cpu; if (regid >= UC_MIPS_REG_0 && regid <= UC_MIPS_REG_31) @@ -57,9 +55,8 @@ int mips_reg_read(uch handle, unsigned int regid, void *value) #define WRITE_BYTE_H(x, b) (x = (x & ~0xff00) | (b & 0xff)) #define WRITE_BYTE_L(x, b) (x = (x & ~0xff) | (b & 0xff)) -int mips_reg_write(uch handle, unsigned int regid, const void *value) +int mips_reg_write(struct uc_struct *uc, unsigned int regid, const void *value) { - struct uc_struct *uc = (struct uc_struct *) handle; CPUState *mycpu = first_cpu; if (regid >= UC_MIPS_REG_0 && regid <= UC_MIPS_REG_31) diff --git a/qemu/target-mips/unicorn.h b/qemu/target-mips/unicorn.h index 29d36a7d..874b82f1 100644 --- a/qemu/target-mips/unicorn.h +++ b/qemu/target-mips/unicorn.h @@ -5,10 +5,10 @@ #define UC_QEMU_TARGET_MIPS_H // functions to read & write registers -int mips_reg_read(uch handle, unsigned int regid, void *value); -int mips_reg_write(uch handle, unsigned int regid, const void *value); +int mips_reg_read(struct uc_struct *uc, unsigned int regid, void *value); +int mips_reg_write(struct uc_struct *uc, unsigned int regid, const void *value); -void mips_reg_reset(uch handle); +void mips_reg_reset(struct uc_struct *uc); void mips_uc_init(struct uc_struct* uc); void mipsel_uc_init(struct uc_struct* uc);