qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Monitoring write to memory
@ 2015-07-01 12:23 Jun Koi
  2015-07-09 16:14 ` Christopher Covington
  0 siblings, 1 reply; 2+ messages in thread
From: Jun Koi @ 2015-07-01 12:23 UTC (permalink / raw)
  To: qemu-devel@nongnu.org; +Cc: Peter Maydell

[-- Attachment #1: Type: text/plain, Size: 1025 bytes --]

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.

[-- Attachment #2: Type: text/html, Size: 1390 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-09 16:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-01 12:23 [Qemu-devel] Monitoring write to memory Jun Koi
2015-07-09 16:14 ` Christopher Covington

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).