On 07/01/2015 08:23 AM, Jun Koi wrote:
> Hello,
> 
> I am trying to monitor all the memory writing events inside Qemu by
> instrumenting tcg_gen_qemu_st8, tcg_gen_qemu_st16, tcg_gen_qemu_st32,
> tcg_gen_qemu_st64, as followings:
> 
> 
> // in tcg-op.h
> 
> void helper_checkmem(int64_t data, int64_t address);  // this is declared
> elsewhere
> 
> static inline void tcg_gen_qemu_st8(struct uc_struct *uc, TCGv arg, TCGv addr,
> int mem_index)
> {
> #if TARGET_LONG_BITS == 32
>     TCGArg args[2] = { GET_TCGV_I32(arg), GET_TCGV_I32(addr) };
> #else
>     TCGArg args[2] = { GET_TCGV_I64(arg), GET_TCGV_I64(addr) };
> #endif
>     tcg_gen_callN(&tcg_ctx, helper_checkmem, dh_retvar_void, 2, args);
>     tcg_gen_qemu_st_tl(uc, arg, addr, mem_index, MO_UB);
> }
> 
> 
> However, when I compile, helper_checkmem() is never called at runtime when
> memory is accessed.
> What is wrong with my code?

What guest code are you running? Does it have a strb instruction? If you're
able to code a simple bare metal test case you should be able to debug qemu
with gdb to see what code paths are taken and why the ones you anticipated 
aren't.

Chris

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

Reply via email to