qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Crash due to invalid env->current_tb


From: Blue Swirl
Subject: Re: [Qemu-devel] Crash due to invalid env->current_tb
Date: Wed, 30 Apr 2008 21:21:40 +0300

On 4/30/08, Alexander Graf <address@hidden> wrote:
>
>  On Apr 30, 2008, at 5:21 PM, Adam Lackorzynski wrote:
>
>
> >
> > On Wed Apr 30, 2008 at 17:11:32 +0200, Adam Lackorzynski wrote:
> >
> > > On Wed Apr 30, 2008 at 11:08:46 +0200, Alexander Graf wrote:
> > >
> > > > There was a comment from Fabrice on how to do prologues in TCG to save
> /
> > > > restore the clobbered values. Btw, ebx gets clobbered as well.
> > > >
> > >
> > > tcg/README says that some registers are clobbered. So something like
> > > this should be safe:
> > >
> > > Index: cpu-exec.c
> > >
> ===================================================================
> > > --- cpu-exec.c  (revision 4276)
> > > +++ cpu-exec.c  (working copy)
> > > @@ -690,6 +691,15 @@
> > >                fp.ip = tc_ptr;
> > >                fp.gp = code_gen_buffer + 2 * (1 << 20);
> > >                (*(void (*)(void)) &fp)();
> > > +#elif defined(__i386)
> > > +               asm volatile ("push %%ebp\n"
> > > +                             "push %%ebx\n"
> > > +                             "call *%1\n"
> > > +                             "pop %%ebx\n"
> > > +                             "pop %%ebp\n"
> > > +                             : "=a" (T0)
> > > +                             : "r" (gen_func)
> > > +                             : "esi", "edi", "ecx", "edx");
> > > #else
> > >                T0 = gen_func();
> > > #endif
> > >
> >
> > I just realised that the push and pop of ebx is not needed as T0 is ebx
> > which gets overwritten in the output anyway.
> >
>
>  Why is T0 =a then? Shouldn't =a mean "input and output on eax for T0"?

GCC-Inline-Assembly-HOWTO:
"=" : Means that this operand is write-only for this instruction; the
previous value is discarded and replaced by output data.

The attached version survives quick tests for both Sparc32 and Sparc64.

Attachment: fix_i386.diff
Description: plain/text


reply via email to

[Prev in Thread] Current Thread [Next in Thread]