[OpenBIOS] PPC: QEMU breaks static variables in OpenBIOS

Alexander Graf agraf at suse.de
Sat Jan 5 22:23:43 CET 2013



Am 05.01.2013 um 21:54 schrieb Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>:

> On 05/01/13 20:21, Blue Swirl wrote:
> 
> (removed Ben from the CC as this is clearly an OpenBIOS issue)
> 
>>> Actually here's a revised version that moves the __next_grab_slot back into
>>> C which is simpler still and continues to work for me. I guess in this form
>>> the same change could be applied as-is to hash_page_64()?
>> 
>> The address arithmetic looks very similar to va2pa() or ea_to_phys().
>> Could one of those be used instead?
> 
> 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

> 
>> Also since this is pretty hot code path, could you initialize the
>> pointer and perform the calculations just once during init?
> 
> Unfortunately not :(  The whole issue is that the exception handlers are invoked in real mode with MMU disabled, and hence to locate your global/static pointer you'd still have to convert its address from virtual to real before you could do anything with it. So for me it made sense to just do the increment on the variable directly.
> 
> 
> ATB,
> 
> Mark.



More information about the OpenBIOS mailing list