2002-07-25 18:49:29 +04:00
|
|
|
/*
|
2006-03-13 20:18:15 +03:00
|
|
|
* Copyright 2002-2006, Axel Dörfler, axeld@pinc-software.de.
|
2005-05-26 13:11:30 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
|
|
|
* Distributed under the terms of the NewOS License.
|
|
|
|
*/
|
2008-02-11 00:00:13 +03:00
|
|
|
#ifndef _KERNEL_HEAP_H
|
|
|
|
#define _KERNEL_HEAP_H
|
2005-05-26 13:11:30 +04:00
|
|
|
|
2004-10-18 19:23:34 +04:00
|
|
|
#include <OS.h>
|
2003-05-03 20:03:26 +04:00
|
|
|
|
2008-02-11 00:00:13 +03:00
|
|
|
// allocate 16MB initial heap for the kernel
|
2008-02-18 04:04:19 +03:00
|
|
|
#define INITIAL_HEAP_SIZE 16 * 1024 * 1024
|
2008-02-11 00:00:13 +03:00
|
|
|
// grow by another 8MB each time the heap runs out of memory
|
2008-02-18 04:04:19 +03:00
|
|
|
#define HEAP_GROW_SIZE 8 * 1024 * 1024
|
2008-06-18 23:55:51 +04:00
|
|
|
// allocate a dedicated 1MB area for dynamic growing
|
|
|
|
#define HEAP_DEDICATED_GROW_SIZE 1 * 1024 * 1024
|
2002-08-05 21:22:19 +04:00
|
|
|
|
2002-07-25 18:49:29 +04:00
|
|
|
|
2004-10-18 19:23:34 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2008-06-18 23:55:51 +04:00
|
|
|
// malloc_nogrow disallows waiting for a grow to happen - only to be used by
|
|
|
|
// vm functions that may deadlock on a triggered area creation
|
|
|
|
void *malloc_nogrow(size_t size);
|
|
|
|
|
2004-10-18 19:23:34 +04:00
|
|
|
void *memalign(size_t alignment, size_t size);
|
|
|
|
|
2008-03-09 20:44:55 +03:00
|
|
|
void deferred_free(void* block);
|
|
|
|
|
2008-03-30 03:55:34 +04:00
|
|
|
void* malloc_referenced(size_t size);
|
|
|
|
void* malloc_referenced_acquire(void* data);
|
|
|
|
void malloc_referenced_release(void* data);
|
|
|
|
|
2006-03-19 18:02:21 +03:00
|
|
|
status_t heap_init(addr_t heapBase, size_t heapSize);
|
2008-02-11 00:00:13 +03:00
|
|
|
status_t heap_init_post_sem();
|
|
|
|
status_t heap_init_post_thread();
|
2004-10-18 19:23:34 +04:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2002-10-30 02:03:47 +03:00
|
|
|
#endif /* _KERNEL_MEMHEAP_H */
|