* [Qemu-devel] Monitoring memory access @ 2010-07-09 9:55 Jun Koi 2010-07-09 10:41 ` malc 0 siblings, 1 reply; 4+ messages in thread From: Jun Koi @ 2010-07-09 9:55 UTC (permalink / raw) To: qemu-devel 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? Many thanks, Jun ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Monitoring memory access 2010-07-09 9:55 [Qemu-devel] Monitoring memory access Jun Koi @ 2010-07-09 10:41 ` malc 2010-07-09 12:45 ` Jun Koi 0 siblings, 1 reply; 4+ messages in thread From: malc @ 2010-07-09 10:41 UTC (permalink / raw) To: Jun Koi; +Cc: qemu-devel 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 -- mailto:av1474@comtv.ru ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Monitoring memory access 2010-07-09 10:41 ` malc @ 2010-07-09 12:45 ` Jun Koi 2010-07-09 18:44 ` malc 0 siblings, 1 reply; 4+ messages in thread From: Jun Koi @ 2010-07-09 12:45 UTC (permalink / raw) To: malc; +Cc: qemu-devel On Fri, Jul 9, 2010 at 7:41 PM, malc <av1474@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? 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]); .... 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? Thanks, J ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] Monitoring memory access 2010-07-09 12:45 ` Jun Koi @ 2010-07-09 18:44 ` malc 0 siblings, 0 replies; 4+ messages in thread From: malc @ 2010-07-09 18:44 UTC (permalink / raw) To: Jun Koi; +Cc: qemu-devel On Fri, 9 Jul 2010, Jun Koi wrote: > On Fri, Jul 9, 2010 at 7:41 PM, malc <av1474@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:av1474@comtv.ru ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-07-09 18:44 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-07-09 9:55 [Qemu-devel] Monitoring memory access Jun Koi 2010-07-09 10:41 ` malc 2010-07-09 12:45 ` Jun Koi 2010-07-09 18:44 ` malc
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).