From: Jun Koi <junkoi2004@gmail.com>
To: Alexander Graf <agraf@suse.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] TCG is hard to understand!
Date: Fri, 11 Dec 2009 12:18:37 +0900 [thread overview]
Message-ID: <fdaac4d50912101918s5c11cebardc845acf704f2a0e@mail.gmail.com> (raw)
In-Reply-To: <D977842A-C628-479F-93D5-FAA6105C8372@suse.de>
Hi Alex,
>> However, I still dont understand what the line (3) does. Could you
>> give some hints?
>>
>>>> static TCGv_i32 cpu_tmp2_i32; // 1
>>>> ...
>>>> gen_ldst_modrm(s, modrm, OT_WORD, OR_TMP0, 0); // 2
>>>> gen_jmp_im(pc_start - s->cs_base); // 3
>
> This sets the position counter to the current address. That's important in case a helper command calls an exception, because only then the unrolling works and the IP is actually at the instruction we're processing.
This is excellent, thanks!
Another question: I look at tcg_gen_callN() to see how the helper is
executed. We put the helper opcode into the TCG code buffer, and put
helper's params into gen_opparam_buf.
However, then when TCG generates code to actually call the helper, we
just put the opcode of the host insn into the output buffer, which is
target code at this step, then run it.
Now when the helper is executed, it must get its param from the stack,
which is really the host stack. But as said above, its params are in
gen_opparam_buf, but not in stack?
I searched around, and dont see anywhere we link gen_opparam_buf with
the host stack. So how the helper can get its param??
Surely I missed something, or misunderstand the whole picture. Any hint?
Thanks a lot,
Jun
next prev parent reply other threads:[~2009-12-11 3:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-10 16:44 [Qemu-devel] TCG is hard to understand! Jun Koi
2009-12-10 22:21 ` Andreas Färber
2009-12-11 2:34 ` Jun Koi
2009-12-11 3:02 ` Alexander Graf
2009-12-11 3:18 ` Jun Koi [this message]
2009-12-11 7:36 ` Laurent Desnogues
2009-12-11 8:40 ` Jun Koi
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=fdaac4d50912101918s5c11cebardc845acf704f2a0e@mail.gmail.com \
--to=junkoi2004@gmail.com \
--cc=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
/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).