qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stuart Brady <sdb@zubnet.me.uk>
To: 曹莹 <caoyingseso@126.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] How does env_to_regs and regs_to_env works?
Date: Wed, 2 Jun 2010 22:25:04 +0100	[thread overview]
Message-ID: <20100602212504.GA10569@zubnet.me.uk> (raw)
In-Reply-To: <3288a7e7.ce3b.128ed860390.Coremail.caoyingseso@126.com>

On Mon, May 31, 2010 at 04:41:42PM +0800, 曹莹 wrote:

> Codes in env_to_regs are like this:
> 
> #ifdef reg_EAX
> 
> EAX = env->regs[R_EAX];

[...]

> I cannot find where the micro reg_EAX is defined
[...]
> I think, env_to_regs is actually a void function
> But if this is true, how did Qemu’s register mapping accomplished? 

For i386 and x86_64, only AREG[0123] were ever defined.  The introduction
of TCG on 2008-02-01 broke support for all hosts except i386 and x86_64.

Commit edea5f0 (2008-05-10) then removed the definitions of reg_EAX, etc.
for target-i386.

Commit 6635f6f (2009-03-08) then removed the definitions of AREG3 to AREG11
for any hosts that defined them.

Commit 49a945a (2010-01-19) then removed env_to_regs() and regs_to_env().

So in other words, env_to_regs() and regs_to_env() haven't done anything
at all for quite a long time.

TCG allocates host registers dynamically (i.e. at translation time),
so host registers are no longer allocated statically (as they were with
dyngen under combinations of hosts and targets with these definitions).
TCG_AREG0 is still needed for the 'env' pointer itself, though.

It is TCG's job to make sure that the generated code saves values in the
CPUState struct where appropriate, i.e. at the end of any 'basic block',
or where host registers might get clobbered, or where exceptions might
need to be raised.  This is handled by calls to the save_globals()
function in tcg.c.

Cheers,
-- 
Stuart Brady

      reply	other threads:[~2010-06-02 21:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-31  8:41 [Qemu-devel] How does env_to_regs and regs_to_env works? 曹莹
2010-06-02 21:25 ` Stuart Brady [this message]

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=20100602212504.GA10569@zubnet.me.uk \
    --to=sdb@zubnet.me.uk \
    --cc=caoyingseso@126.com \
    --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).