Turnstone Operating System
|
main memory interface and functions implementation More...
Typedefs | |
typedef task_t *(* | memory_current_task_getter_f) (void) |
typedef void(* | memory_backtrace_f) (void) |
Functions | |
MODULE ("turnstone.lib.memory") | |
void | memory_set_current_task_getter (memory_current_task_getter_f getter) |
static task_t * | memory_get_current_task (void) |
memory_heap_t * | memory_set_default_heap (memory_heap_t *heap) |
sets default heap More... | |
memory_heap_t * | memory_get_default_heap (void) |
memory_heap_t * | memory_get_heap (memory_heap_t *heap) |
returns heap, finds correct heap for task. More... | |
void * | memory_malloc_ext (memory_heap_t *heap, size_t size, size_t align) |
malloc memory More... | |
int8_t | memory_free_ext (memory_heap_t *heap, void *address) |
frees memory More... | |
void | memory_get_heap_stat_ext (memory_heap_t *heap, memory_heap_stat_t *stat) |
returns stats for heap More... | |
int8_t | memory_memset (void *address, uint8_t value, size_t size) |
sets memory with value More... | |
int8_t | memory_memcopy (const void *source, void *destination, size_t size) |
copy source to destination with length bytes from source More... | |
int8_t | memory_memcompare (const void *mem1, const void *mem2, size_t size) |
compares first length bytes of mem1 with mem2 More... | |
int8_t | memory_memclean (void *address, size_t size) |
zeros memory More... | |
void | memory_heap_backtrace (void) |
Variables | |
memory_heap_t * | memory_heap_default = NULL |
memory_current_task_getter_f | memory_current_task_getter = NULL |
memory_backtrace_f | memory_heap_backtrace_func = NULL |
main memory interface and functions implementation
This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.
int8_t memory_free_ext | ( | memory_heap_t * | heap, |
void * | address | ||
) |
frees memory
[in] | heap | the heap where the address is. |
[in] | address | address to free |
if heap is NULL, address will be freed at default heap
memory_heap_t * memory_get_heap | ( | memory_heap_t * | heap | ) |
returns heap, finds correct heap for task.
void memory_get_heap_stat_ext | ( | memory_heap_t * | heap, |
memory_heap_stat_t * | stat | ||
) |
returns stats for heap
[in] | heap | heap which stats will be collected |
[out] | stat | returned stats |
void * memory_malloc_ext | ( | memory_heap_t * | heap, |
size_t | size, | ||
size_t | align | ||
) |
malloc memory
[in] | heap | the heap used for malloc |
[in] | size | size of variable |
[in] | align | address of variable aligned at. |
if heap is NULL, variable allocated at default heap.
zeros memory
[in] | a | the address to be zerod. |
[in] | s | repeat count |
compares first length bytes of mem1 with mem2
mem1 | first memory address |
mem2 | second memory address |
size | count of bytes for compare |
copy source to destination with length bytes from source
[in] | source | source address |
[in] | destination | destination address |
[in] | size | how many bytes will be copied |
if destination is smaller then length a memory corruption will be happend
sets memory with value
[in] | address | the address to be setted. |
[in] | value | the value |
[in] | size | repeat count |
memory_heap_t * memory_set_default_heap | ( | memory_heap_t * | heap | ) |
sets default heap
[in] | heap | the heap will be the default one |
memory_heap_t* memory_heap_default = NULL |
default heap variable