On Fri, 9 Jul 2010, Jun Koi wrote: > On Fri, Jul 9, 2010 at 7:41 PM, malc <av1...@comtv.ru> 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:av1...@comtv.ru