From 8918deb1b2796d6f1a312905c89b904f72746218 Mon Sep 17 00:00:00 2001 From: Jonathon Reinhart Date: Wed, 26 Aug 2015 07:11:49 -0400 Subject: [PATCH] change uch to uc_struct (target-m68k) --- qemu/target-m68k/translate.c | 4 ++-- qemu/target-m68k/unicorn.c | 12 ++++-------- qemu/target-m68k/unicorn.h | 6 +++--- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/qemu/target-m68k/translate.c b/qemu/target-m68k/translate.c index ce630d7d..0751445c 100644 --- a/qemu/target-m68k/translate.c +++ b/qemu/target-m68k/translate.c @@ -3044,7 +3044,7 @@ static void disas_m68k_insn(CPUM68KState * env, DisasContext *s) // Unicorn: trace this instruction on request if (env->uc->hook_insn) { - struct hook_struct *trace = hook_find((uch)env->uc, UC_HOOK_CODE, s->pc); + struct hook_struct *trace = hook_find(env->uc, UC_HOOK_CODE, s->pc); if (trace) gen_uc_tracecode(tcg_ctx, 2, trace->callback, env->uc, s->pc, trace->user_data); // if requested to emulate only some instructions, check if @@ -3102,7 +3102,7 @@ gen_intermediate_code_internal(M68kCPU *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-m68k/unicorn.c b/qemu/target-m68k/unicorn.c index f085b53c..d8403c63 100644 --- a/qemu/target-m68k/unicorn.c +++ b/qemu/target-m68k/unicorn.c @@ -21,21 +21,18 @@ static void m68k_set_pc(struct uc_struct *uc, uint64_t address) ((CPUM68KState *)uc->current_cpu->env_ptr)->pc = address; } -void m68k_reg_reset(uch handle) +void m68k_reg_reset(struct uc_struct *uc) { - struct uc_struct *uc = (struct uc_struct *) handle; - CPUArchState *env; + CPUArchState *env = first_cpu->env_ptr; - env = first_cpu->env_ptr; memset(env->aregs, 0, sizeof(env->aregs)); memset(env->dregs, 0, sizeof(env->dregs)); env->pc = 0; } -int m68k_reg_read(uch handle, unsigned int regid, void *value) +int m68k_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_M68K_REG_A0 && regid <= UC_M68K_REG_A7) @@ -60,9 +57,8 @@ int m68k_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 m68k_reg_write(uch handle, unsigned int regid, const void *value) +int m68k_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_M68K_REG_A0 && regid <= UC_M68K_REG_A7) diff --git a/qemu/target-m68k/unicorn.h b/qemu/target-m68k/unicorn.h index 5fcca5f3..37ea828f 100644 --- a/qemu/target-m68k/unicorn.h +++ b/qemu/target-m68k/unicorn.h @@ -5,10 +5,10 @@ #define UC_QEMU_TARGET_M68K_H // functions to read & write registers -int m68k_reg_read(uch handle, unsigned int regid, void *value); -int m68k_reg_write(uch handle, unsigned int regid, const void *value); +int m68k_reg_read(struct uc_struct *uc, unsigned int regid, void *value); +int m68k_reg_write(struct uc_struct *uc, unsigned int regid, const void *value); -void m68k_reg_reset(uch handle); +void m68k_reg_reset(struct uc_struct *uc); void m68k_uc_init(struct uc_struct* uc);