
23 Sep
2012
23 Sep
'12
3:06 p.m.
On Sep 23, 2012 8:09 AM, "Tomas Hlavacek" tmshlvck@gmail.com wrote:
early_malloc for DM with support for more heaps and lightweight first heap in the same memory as an early stack.
Adaptation layer for seamless calling of early_malloc or dlmalloc from DM based on init stage added (dmmalloc() and related functions).
Signed-off-by: Tomas Hlavacek tmshlvck@gmail.com
[snip]
+#ifdef CONFIG_SYS_EARLY_MALLOC +__weak struct early_heap_header *early_brk(size_t size) +{
struct early_heap_header *h =
(struct early_heap_header *)CONFIG_SYS_EARLY_HEAP_ADDR;
struct early_heap_header *ehp = gd->early_heap_first;
while (ehp != NULL) {
if (ehp == h)
return NULL;
ehp = ehp->next_early_heap;
}
if (g->early_heap_first == NULL) h = CONFIF_SYS_EARLY_HEAP_ADDR); else return NULL;
h->free_space_pointer = (void *)(roundup(
(phys_addr_t)CONFIG_SYS_EARLY_HEAP_ADDR +
sizeof(struct early_heap_header),
sizeof(phys_addr_t)));
h->free_bytes = size - roundup(sizeof(struct early_heap_header),
sizeof(phys_addr_t));
h->next_early_heap = NULL;
return h;
+}
Regards,
Graeme