qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Monitoring write to memory


From: Jun Koi
Subject: [Qemu-devel] Monitoring write to memory
Date: Wed, 1 Jul 2015 20:23:53 +0800

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?


Another problem is that: how can I cast i32 to i64? I wanted to do:

    TCGArg args[2] = { GET_TCGV_I32(arg), GET_TCGV_I64(addr) };
 
but in 32bit mode, addr is TCGv, so GET_TCGV_I64(addr) gets error report.


Thank you.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]