Turnstone Operating System
|
memory functions More...
#include <types.h>
Classes | |
struct | memory_heap_stat_t |
heap statistics, both monitoring and leak analysis. More... | |
struct | memory_heap_t |
heap interface for all types More... | |
Macros | |
#define | ___MEMORY_H 0 |
#define | memory_get_heap_stat(s) memory_get_heap_stat_ext(NULL, s) |
#define | memory_free(addr) memory_free_ext(NULL, addr) |
#define | memory_malloc(s) memory_malloc_ext(NULL, s, 0x0) |
#define | memory_malloc_aligned(s, a) memory_malloc_ext(NULL, s, a) |
Typedefs | |
typedef struct lock_t | lock_t |
typedef struct memory_heap_stat_t | memory_heap_stat_t |
short hand for struct | |
typedef struct memory_heap_t | memory_heap_t |
short hand for struct | |
Functions | |
memory_heap_t * | memory_create_heap_simple (size_t start, size_t end) |
creates simple heap More... | |
memory_heap_t * | memory_create_heap_hash (size_t start, size_t end) |
creates hash backended heap More... | |
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_get_heap_stat_ext (memory_heap_t *heap, memory_heap_stat_t *stat) |
returns stats for heap More... | |
int8_t | memory_free_ext (memory_heap_t *heap, void *address) |
frees memory More... | |
void * | memory_malloc_ext (memory_heap_t *heap, size_t size, size_t align) |
malloc memory More... | |
int8_t | memory_memset (void *address, uint8_t value, size_t size) |
sets memory with value More... | |
int8_t | memory_memclean (void *address, size_t size) |
zeros memory 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... | |
memory functions
This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.
#define ___MEMORY_H 0 |
prevent duplicate header error macro
#define memory_free | ( | addr | ) | memory_free_ext(NULL, addr) |
frees memory addr at default heap
#define memory_get_heap_stat | ( | s | ) | memory_get_heap_stat_ext(NULL, s) |
returns stats for default heap
#define memory_malloc | ( | s | ) | memory_malloc_ext(NULL, s, 0x0) |
malloc with size s at default heap without aligned
#define memory_malloc_aligned | ( | s, | |
a | |||
) | memory_malloc_ext(NULL, s, a) |
malloc with size s at default heap with aligned a
memory_heap_t * memory_create_heap_hash | ( | size_t | start, |
size_t | end | ||
) |
creates hash backended heap
[in] | start | start address of heap |
[in] | end | end address of heap |
memory_heap_t * memory_create_heap_simple | ( | size_t | start, |
size_t | end | ||
) |
creates simple heap
[in] | start | start address of heap |
[in] | end | end address of heap |
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 |