[OpenBIOS] [PATCH] Enforce physical alignment based upon size for the SPARC32 romvec obp_dumb_memalloc() function.

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Tue Apr 5 13:41:47 CEST 2011


On 04/04/11 22:15, Blue Swirl wrote:

>> +    /* Enforce a minimum alignment of CONFIG_OFMEM_MALLOC_ALIGN, and also ensure that
>> +       only the MSB is set for the alignment value. This prevents spurious
>> +       "bad alignment" warnings from OFMEM when running with CONFIG_DEBUG_OFMEM. */
>> +    align = (size + CONFIG_OFMEM_MALLOC_ALIGN - 1)&  ~(size - 1);
>
> What happens if size is not a power of 2?

Hmmmm that's a good point actually. I've just done a quick test of a 
revised patch that uses the standard bit-rotation algorithm to round up 
to the next power of 2, and that seems to work in the same way while 
making things more robust. Patch to follow shortly.


ATB,

Mark.

-- 
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the OpenBIOS mailing list