From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=48285 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OXIZ6-0001we-CK for qemu-devel@nongnu.org; Fri, 09 Jul 2010 14:44:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OXIZ4-00036y-QW for qemu-devel@nongnu.org; Fri, 09 Jul 2010 14:44:48 -0400 Received: from fe02x03-cgp.akado.ru ([77.232.31.165]:53078 helo=akado.ru) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OXIZ4-00036d-HI for qemu-devel@nongnu.org; Fri, 09 Jul 2010 14:44:46 -0400 Date: Fri, 9 Jul 2010 22:44:22 +0400 (MSD) From: malc Subject: Re: [Qemu-devel] Monitoring memory access In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jun Koi Cc: qemu-devel@nongnu.org On Fri, 9 Jul 2010, Jun Koi wrote: > On Fri, Jul 9, 2010 at 7:41 PM, malc wrote: > > On Fri, 9 Jul 2010, Jun Koi wrote: > > > >> Hi, > >> > >> I want to monitor memory reading access in Qemu. According to function > >> tcg/i386/tcg-target.c::tcg_out_qemu_ld(), all the memory access must > >> call qemu_ld_helpers[] functions, which in turn calls __ldX_mmu > >> functions. > >> > >> These __ldX_mmu() functions are declared in softmmu_template.c, with > >> macro glue(glue(__ld, SUFFIX), MMUSUFFIX). > >> > >> To monitor memory reading access, I simply put my monitored code at > >> the top of the above macro. But apparently I still miss something, > >> because I dont see the memory access I am looking for. > >> > >> Any hint where I am wrong? Perhaps some memory access do not call the > >> qemu_ld_helpers[] functions? > > > > Haven't we been through this already? > > http://www.mail-archive.com/qemu-devel@nongnu.org/msg29788.html > > > > Yes, we did, but sorry I am still stuck there. > > You said that once TLB is setup properly, future memory access would > do directly, without going thru helpers any more. Is that correct? Once TLB is filled helpers will be bypassed yes. > > But what I see in tcg_out_qemu_ld() is that the below function is always > called: > > .... > tcg_out_calli(s, (tcg_target_long)qemu_ld_helpers[s_bits]); > .... Even if you are looking only on, say, tcg/i386/tcg-target.c you should notice that the function does a lot more than just ld_helpers call - testing tlb and jumping around... > And since qemu_ld_helpers[] points to __ldX_mmu, so that means below > macro is always executed: > > glue(glue(__ld, SUFFIX), MMUSUFFIX). > > I simply put my monitored code inside this macro. > > Could you give me some hints where I am wrong? > I have honestly nothing more to add, just look closer. -- mailto:av1474@comtv.ru