qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] op-helper.c vs helper.c


From: Blue Swirl
Subject: Re: [Qemu-devel] op-helper.c vs helper.c
Date: Sat, 24 Sep 2011 08:15:23 +0000

On Thu, Sep 22, 2011 at 1:09 PM, Xin Tong Utoronto <address@hidden> wrote:
>
>
> On Mon, Sep 19, 2011 at 9:49 AM, Peter Maydell <address@hidden>
> wrote:
>>
>> On 19 September 2011 13:06, Xin Tong Utoronto <address@hidden> wrote:
>> > There are 2 files on helpers in target-ppc and target-i386 ( op-helper.c
>> >  helper.c), what are their differences ? also, what kind of functions
>> > are
>> > typically emulated using helpers ?
>>
>> The key difference is that op_helper.c is compiled with compiler
>> flags and includes header files that give it access to a global
>> variable 'CPUState *env' which is kept in a fixed CPU register
>> during execution of translated code.
>
> This is easier for the tcg to call ?
>
>>
>> helper.c (and other foo_helper.c
>> files) are built as regular C files, and so if they need access to the
>> CPU state it has to be passed into the helper as an explicit parameter.
>>
>>
>> We're currently trying to cut back on the use of the implicit global,
>> so new helper functions should probably go in helper.c.
>>
> Why do we want to cut back on the use of the implicit global ? what is the
> criteria for a function to be in the implicit global list ?

The global register was necessary in the dyngen based system. We can
avoid that these days, it just makes code more fragile compared to
plain C. The changes in performance seems to be marginal.

>> > also, what kind of functions are typically emulated using helpers ?
>>
>> Anything that seems too hard to do inline :-) tcg/README has a
>> paragraph at the end giving some rules of thumb.
>>
>> -- PMM
>
>
>
> --
> Kind Regards
>
> Xin Tong
>



reply via email to

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