From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40144) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDESf-0007IV-Bd for qemu-devel@nongnu.org; Thu, 09 Jul 2015 12:14:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZDESb-0008KZ-SX for qemu-devel@nongnu.org; Thu, 09 Jul 2015 12:14:09 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:34668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDESb-0008KJ-NX for qemu-devel@nongnu.org; Thu, 09 Jul 2015 12:14:05 -0400 Message-ID: <559E9DCA.1070303@codeaurora.org> Date: Thu, 09 Jul 2015 12:14:02 -0400 From: Christopher Covington MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Monitoring write to memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jun Koi , "qemu-devel@nongnu.org" Cc: Peter Maydell 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