[OpenBIOS] [PATCH 3/6] Introduce va2pa() and pa2va() functions for PPC for subsequent use by OFMEM.

Andreas Färber andreas.faerber at web.de
Fri Dec 31 00:46:15 CET 2010


Am 31.12.2010 um 00:31 schrieb Mark Cave-Ayland:

> On 30/12/10 22:43, Andreas Färber wrote:
>
>>> Possibly, although I took a glance at the hash table code and  
>>> couldn't
>>> immediately get my head around how to come up with the reverse  
>>> mapping.
>>
>> There's a list of translations in ofmem_t that we'd have to iterate
>> through, no? :)
>
> IIRC the translations list doesn't contain the mappings for the ROM  
> itself as the pages are mapped directly during startup. But since  
> va2pa() and pa2va() are only used by ofmem_posix_memalign() (i.e.  
> internal ofmem_malloc() allocations only), they are guaranteed to  
> lie within the address space for the ROM image which makes things  
> easier.

Only for sparc! For ppc I located it further below, beneath the  
(aligned) hash map iirc.

Obviously we all try to set up sane translations initially, so I was  
more worried about runtime. But on second thoughts, if someone remaps  
our malloc zone with whatever alignment then we're doomed anyway.

I must admit that I still don't understand which case exactly broke  
the alignment on sparc in the first place, so I'm unable to provide  
pinpointed solutions. I'm regarding these as general functions - thus  
a va2pa() that doesn't respect the va translations is broken IMO.

Andreas


More information about the OpenBIOS mailing list