Re: [OpenBIOS] [PATCH 2/6] Introduce ofmem_posix_memalign() function for arbitrary alignment.

On Wed, Dec 29, 2010 at 11:07 AM, Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk> wrote:
Rework ofmem_malloc() so that it takes a parameter specifying the alignment for the allocation and then change the API to match that of posix_memalign(). Then create ofmem_malloc() as a simple wrapper function onto ofmem_posix_memalign() using a default alignment of CONFIG_OFMEM_MALLOC_ALIGN.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk> --- openbios-devel/include/libopenbios/ofmem.h | 1 + openbios-devel/libopenbios/ofmem_common.c | 32 +++++++++++++++++++++------ 2 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/openbios-devel/include/libopenbios/ofmem.h b/openbios-devel/include/libopenbios/ofmem.h index 7b49e48..3d8ddbf 100644 --- a/openbios-devel/include/libopenbios/ofmem.h +++ b/openbios-devel/include/libopenbios/ofmem.h @@ -80,6 +80,7 @@ extern inline phys_addr_t va2pa(unsigned long va); extern inline unsigned long pa2va(phys_addr_t pa);
/* malloc interface */ +extern int ofmem_posix_memalign( void **memptr, int alignment, size_t size );
Actually the API for posix_memalign uses size_t for alignment.
participants (1)
-
Blue Swirl