Skip to content
  • Philippe Gerum's avatar
    copperplate/heapmem: fix private heap inits · 903b21fe
    Philippe Gerum authored and Jan Kiszka's avatar Jan Kiszka committed
    
    
    This is a general fix for properly initializing private copperplate
    heaps managed by the heapmem allocator:
    
    - the heapmem descriptor must be allocated separately, not to consume
      space from the heap memory. At this chance, heapmem_init() must be
      given the right descriptor address, not NULL.
    
    - heaps must account for the size of the meta data the allocator
      needs. Make sure to allocate this extra-space when no specific heap
      memory has been given.
    
    - upon array allocation, align the item size used in calculating the
      overall heap size on the next power-of-two boundary, so that the
      required number of items can be obtained from the pool (as the
      caller may rightfully assume).
    
    Without these changes, the private copperplate allocator simply cannot
    work on top of heapmem, so keep them grouped.
    
    Signed-off-by: default avatarPhilippe Gerum <rpm@xenomai.org>
    Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
    903b21fe