From: Paul Brook <paul@codesourcery.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Crash due to invalid env->current_tb
Date: Thu, 1 May 2008 17:31:44 +0100 [thread overview]
Message-ID: <200805011731.44724.paul@codesourcery.com> (raw)
In-Reply-To: <f43fc5580805010915r514791e3u1d625e30f275098f@mail.gmail.com>
On Thursday 01 May 2008, Blue Swirl wrote:
> On 5/1/08, Paul Brook <paul@codesourcery.com> wrote:
> > > > T0 = gen_func();
> > > >
> > > > For 64bit target T0 is 64bits so "=a" does not work and "=A" is
> > > > needed. The strange thing is that I need to throw away the upper
> > > > 32bits because otherwise it won't work. gen_func is defined to
> > > > return just long but T0 is unsigned long long, this seems
> > > > inconsistent. The 'and' does not appear in 32bit targets so it does
> > > > not harm there.
> > >
> > > This is because in this special case, T0 is not used as target CPU
> > > temporary, but instead to return next TB address. On i386 this is 32
> > > bits, so only EAX is needed. TCG does not touch EDX, so it contains
> > > garbage. This also means that moving EDX to high word of T0 and then
> > > throwing the high word away may be slightly wasteful.
> >
> > Do we need to use T0 at all here? Can't we just use a normal local
> > variable?
>
> I suspect T0 was used to gain extra performance,
Really? I doubt it. Especially on x86 reserving a register for a fixed purpose
is almost always a bad idea.
It was used with dyngen because there was no way of directly passing
information between cpu_loop and generated code. However now we have a proper
code generator there is no need for this.
> but in case of 64-bit target on 32-bit host there is this unnecessary work.
>
> But does cpu-exec.c need to know about T0/T1/T2 at all?
I don't think so.
> Can we replace exec.h include with cpu.h one?
Currently we still need it to setup "env". However once we have proper TCG
prologue/epilogue we should be able to pass env as an argument to gen_func,
and have that do the setup for us.
Paul
next prev parent reply other threads:[~2008-05-01 16:31 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-29 11:56 [Qemu-devel] Crash due to invalid env->current_tb Adam Lackorzynski
2008-04-29 17:09 ` Blue Swirl
2008-04-29 18:40 ` Adam Lackorzynski
2008-04-30 9:08 ` Alexander Graf
2008-04-30 15:11 ` Adam Lackorzynski
2008-04-30 15:21 ` Adam Lackorzynski
2008-04-30 17:09 ` Blue Swirl
2008-04-30 17:30 ` Alexander Graf
2008-04-30 18:21 ` Blue Swirl
2008-05-01 12:02 ` Adam Lackorzynski
2008-05-01 15:02 ` Blue Swirl
2008-05-01 16:04 ` Paul Brook
2008-05-01 16:15 ` Blue Swirl
2008-05-01 16:31 ` Paul Brook [this message]
2008-05-02 15:41 ` Adam Lackorzynski
2008-05-03 18:00 ` Blue Swirl
2008-05-03 22:02 ` Paul Brook
2008-04-30 15:28 ` Laurent Vivier
2008-04-30 20:36 ` Adam Lackorzynski
2008-05-02 1:39 ` Bernhard Kauer
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=200805011731.44724.paul@codesourcery.com \
--to=paul@codesourcery.com \
--cc=blauwirbel@gmail.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).