[OpenBIOS] PPC: QEMU breaks static variables in OpenBIOS

Alexander Graf agraf at suse.de
Sun Jan 6 14:31:28 CET 2013


On 05.01.2013, at 23:33, Alexander Graf wrote:

> 
> On 05.01.2013, at 23:26, Alexander Graf wrote:
> 
>> 
>> On 05.01.2013, at 23:13, Alexander Graf wrote:
>> 
>>> 
>>> On 05.01.2013, at 22:47, Mark Cave-Ayland wrote:
>>> 
>>>> On 05/01/13 21:23, Alexander Graf wrote:
>>>> 
>>>>>> I thought about that, but figured that because it was a hot-path I'd do it inline to save some cycles invoking another function. Since it uses the same OF_* constants as those functions then it should just work.
>>>>> 
>>>>> If the calculation function was provided through a static inline function in a header, this'd be a no-issue.
>>>>> 
>>>>> Alex
>>>> 
>>>> va2pa() looks like a good candidate for this, however it isn't marked as static inline because it's called from ofmem_common.c in libopenbios.
>>>> 
>>>> Then again I'm not sure this is important as I've heard in several places that most optimising compilers ignore the inline keyword, and will just inline whatever they think will run fastest based upon the current optimisation level.
>>>> 
>>>> Anyway let me know which way you'd prefer.
>>> 
>>> 
>>> Does the patch below work?
>> 
>> It looks pretty broken still:
> 
> The problem is that .bss is beyond OF_CODE_START + OF_CODE_SIZE. Too bad.
> This version seems to compile into something sane. It's essentially the same as Mark's latest one though, just slightly more readable IMHO :).

I applied this patch to svn.

For those of you wary of touching a "hot path" (even though eviction shouldn't occur too often in really hot paths), all of the functions below get inlined by gcc and statically compiled out, because gcc knows the destination address of the pointer already.


Alex




More information about the OpenBIOS mailing list