[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Crash due to invalid env->current_tb
From: |
Paul Brook |
Subject: |
Re: [Qemu-devel] Crash due to invalid env->current_tb |
Date: |
Thu, 1 May 2008 17:31:44 +0100 |
User-agent: |
KMail/1.9.9 |
On Thursday 01 May 2008, Blue Swirl wrote:
> On 5/1/08, Paul Brook <address@hidden> 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