From: Max Filippov <jcmvbkbc@gmail.com>
To: "陳韋任 (Wei-Ren Chen)" <chenwj@iis.sinica.edu.tw>
Cc: Laurent Desnogues <laurent.desnogues@gmail.com>,
Steven <wangwangkang@gmail.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] qemu log function to print out the registers of the guest
Date: Fri, 17 Aug 2012 15:57:55 +0400 [thread overview]
Message-ID: <CAMo8BfJZ8=28LP-m_uR1uTL2--yowOxgvdJDx3JzE29VPn+nJg@mail.gmail.com> (raw)
In-Reply-To: <20120817111436.GB67669@cs.nctu.edu.tw>
On Fri, Aug 17, 2012 at 3:14 PM, 陳韋任 (Wei-Ren Chen)
<chenwj@iis.sinica.edu.tw> wrote:
>> > On Thu, Aug 16, 2012 at 7:49 PM, Steven <wangwangkang@gmail.com> wrote:
>> > [...]
>> >> I want to get the guest memory address in the instruction mov
>> >> 0x4(%ebx) %eax, whic is 0x4(%ebx).
>> >> Since %ebx is not resolved until the execution time, the code in
>> >> softmmu_header.h does not generate any hit or miss information.
>> >> Do you know any place that I could resolve the memory access address? Thanks.
>> >
>> > You'll have to generate code. Look at how helpers work.
>> Hi, Laurent,
>> do you mean the target-i386/op_helper.c/helper.c or the tcg helper? Thanks.
>
> What do you mean by "resolve the memory access address"? Do you want
> to get guest virtual address for each guest memory access, right? As Max
> mentioned before (you can also read [1]), there are fast and slow path
> in QEMU softmmu, tlb hit and tlb miss respectively. Max provided patch
> for slow path. As for fast path, take a look on tcg_out_tlb_load (tcg
> /i386/tcg-target.c). tcg_out_tlb_load will generate native code in the
> code cache to do tlb lookup, I think you cannot use the trick Max used
> since tcg_out_tlb_load will not be called when the fast path executed,
That's why I've posted the following hunk that should have made all
accesses go via slow path:
diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
index da17bba..ec68c19 100644
--- a/tcg/i386/tcg-target.c
+++ b/tcg/i386/tcg-target.c
@@ -1062,7 +1062,7 @@ static inline void tcg_out_tlb_load(TCGContext
*s, int addrlo_idx,
tcg_out_mov(s, type, r0, addrlo);
/* jne label1 */
- tcg_out8(s, OPC_JCC_short + JCC_JNE);
+ tcg_out8(s, OPC_JMP_short);
label_ptr[0] = s->code_ptr;
s->code_ptr++;
> it "generates" code instead. Therefore, you might have to insert your
> instrument code in the code cache, perhaps modifying tcg_out_tlb_load
> to log value of "addrlo" (see comments above tcg_out_tlb_load).
--
Thanks.
-- Max
next prev parent reply other threads:[~2012-08-17 11:57 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-16 7:21 [Qemu-devel] qemu log function to print out the registers of the guest Steven
2012-08-16 8:02 ` 陳韋任 (Wei-Ren Chen)
2012-08-16 16:36 ` Steven
2012-08-16 16:54 ` Peter Maydell
2012-08-16 17:13 ` Steven
2012-08-16 17:15 ` Peter Maydell
2012-08-16 17:26 ` Steven
2012-08-16 19:31 ` Steven
2012-08-17 10:26 ` 陳韋任 (Wei-Ren Chen)
2012-08-16 17:00 ` Max Filippov
2012-08-16 17:29 ` Steven
2012-08-16 17:37 ` Max Filippov
2012-08-16 17:43 ` Max Filippov
2012-08-16 17:49 ` Steven
2012-08-16 18:31 ` Max Filippov
2012-08-16 21:18 ` Max Filippov
2012-08-17 5:38 ` Steven
2012-08-17 6:38 ` Max Filippov
2012-08-16 18:51 ` Laurent Desnogues
2012-08-16 19:02 ` Steven
2012-08-17 11:14 ` 陳韋任 (Wei-Ren Chen)
2012-08-17 11:57 ` Max Filippov [this message]
2012-08-19 8:33 ` 陳韋任 (Wei-Ren Chen)
2012-08-21 5:40 ` Steven
2012-08-21 7:18 ` Max Filippov
[not found] ` <CAMTrTqVF0EGEqC8qZHOV5RHYxq=MHYuu_X0V5va5gkyaRQWJuw@mail.gmail.com>
2012-08-25 20:41 ` Max Filippov
2012-08-27 16:15 ` Steven
2012-08-28 3:14 ` 陳韋任 (Wei-Ren Chen)
2012-08-28 3:44 ` Steven
2012-08-28 10:48 ` Max Filippov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAMo8BfJZ8=28LP-m_uR1uTL2--yowOxgvdJDx3JzE29VPn+nJg@mail.gmail.com' \
--to=jcmvbkbc@gmail.com \
--cc=chenwj@iis.sinica.edu.tw \
--cc=laurent.desnogues@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=wangwangkang@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).