1 /* 2 * Copyright 2002-2006, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 * 5 * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. 6 * Distributed under the terms of the NewOS License. 7 */ 8 #ifndef _KERNEL_HEAP_H 9 #define _KERNEL_HEAP_H 10 11 #include <OS.h> 12 13 // allocate 16MB initial heap for the kernel 14 #define INITIAL_HEAP_SIZE 16 * 1024 * 1024 15 // grow by another 8MB each time the heap runs out of memory 16 #define HEAP_GROW_SIZE 8 * 1024 * 1024 17 // allocate a dedicated 2MB area for dynamic growing 18 #define HEAP_DEDICATED_GROW_SIZE 2 * 1024 * 1024 19 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 void *memalign(size_t alignment, size_t size); 26 27 void deferred_free(void* block); 28 29 void* malloc_referenced(size_t size); 30 void* malloc_referenced_acquire(void* data); 31 void malloc_referenced_release(void* data); 32 33 status_t heap_init(addr_t heapBase, size_t heapSize); 34 status_t heap_init_post_sem(); 35 status_t heap_init_post_thread(); 36 37 #ifdef __cplusplus 38 } 39 #endif 40 41 #endif /* _KERNEL_MEMHEAP_H */ 42