qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] x86 segment limits enforcement with TCG


From: Stephen Checkoway
Subject: Re: [Qemu-devel] x86 segment limits enforcement with TCG
Date: Sun, 24 Feb 2019 15:21:37 -0500


> On Feb 24, 2019, at 14:46, Peter Maydell <address@hidden> wrote:
> 
> On Sun, 24 Feb 2019 at 19:37, Stephen Checkoway
> <address@hidden> wrote:
>> I think that something about adding the tcg_gen_brcond_tl is causing values 
>> to become dead and then qemu aborts.
> 
> Yep -- all "TCG temporaries" are dead at the end
> of a basic block, and brcond ends a basic block.
> Only globals and "local temporaries" stay live
> across brcond. This is documented in tcg/README,
> though it doesn't spell it out very explicitly.

Ah yes. I see that now. I missed it on my first read through.

> This makes brcond pretty painful to use and
> almost impossible to introduce into the middle
> of some existing sequence of generated code.
> I haven't looked at what the best way to do what
> you're trying to do here is, though.

Are there other examples of straight-line code being converted to a conditional 
I might be able to use as an example? I thought INTO would be a good example, 
but it merely calls a helper. Maybe I should do that? I assume it'll be slow, 
but speed isn't really my primary concern.

> By the way, don't do this:
> +    dc->A1 = tcg_temp_new();
> 
> The current use of a small number of tcg temps
> in the i386 translate.c code is an antipattern
> that is a relic from a very old version of the
> code. It's much better to simply create new
> temporaries in the code at the point where you
> need them and then free them once you're done.

Great, thanks. I saw both the A0/T0/T1 and the creation of new temporaries and 
I wasn't sure which pattern I should follow.

-- 
Stephen Checkoway








reply via email to

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