From: Max Filippov <jcmvbkbc@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Actual TB code doesn't look like what was intended (TCG issue)?
Date: Fri, 24 Jun 2011 21:06:21 +0400 [thread overview]
Message-ID: <201106242106.21793.jcmvbkbc@gmail.com> (raw)
In-Reply-To: <BANLkTinREnaCAJKmFSaFMd_2GNMJSEY20g@mail.gmail.com>
> Here are my rules of thumb for generating code where the code
> generated might change based on some bit of CPU state:
>
> When you are generating code, if the code you generate will
> change based on the contents of something in the CPUState struct,
> then the bit of CPUState you are looking at has to be one of:
> (1) encoded in the TB flags (or tb->pc or tb->cs_base)
> (and gen_intermediate_code_internal() must read and
> use the value in tb->tb_flags, not the one in env)
> (2) always constant for the life of the simulation
> (eg env->features if you have some sort of
> "target feature support" flags)
> (3) specially handled so that when it changes then
> all TBs or at least all affected TBs are flushed
> (env->breakpoints is in this category), and also
> if the change is the result of some instruction then
> you must terminate the TB after that instruction.
> This is often used for things that rarely change and/or
> where you can't fit the whole value into tb_flags.
>
> The reason for this is that the CPUState you're passed in
> is not guaranteed to be the state of the CPU at the PC
> which you are starting translation from.
>
> This is the xtensa port at
> http://jcmvbkbc.spb.ru/git/?p=dumb/qemu-xtensa.git;a=shortlog;h=refs/heads/xtensa
> right?
>
> It looks like you're breaking these rules with a lot of
> the fields in your DisasContext. (Most obviously, you
> need to translate code from tb->pc, not env->pc, and
> xtensa_get_ring() and xtensa_get_cring() should not read
> from env->sregs[PS]. But you should be clear for every
> field in DisasContext which category it falls into.)
Peter you are right, I've moved ring/cring into tb_flags and the issue has gone. Thank you.
I'd like to document it somewhere in http://wiki.qemu.org/Documentation, can you suggest a good place for it?
-- Max
next prev parent reply other threads:[~2011-06-24 17:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-24 2:44 [Qemu-devel] Actual TB code doesn't look like what was intended (TCG issue)? Max Filippov
2011-06-24 7:46 ` Peter Maydell
2011-06-24 8:34 ` Max Filippov
2011-06-24 9:42 ` Peter Maydell
2011-06-24 10:08 ` Max Filippov
2011-06-24 10:32 ` Peter Maydell
2011-06-24 17:06 ` Max Filippov [this message]
2011-06-24 8:14 ` Laurent Desnogues
2011-06-24 8:35 ` Max Filippov
2011-06-24 9:38 ` Laurent Desnogues
2011-06-24 9: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=201106242106.21793.jcmvbkbc@gmail.com \
--to=jcmvbkbc@gmail.com \
--cc=peter.maydell@linaro.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.