RTEMS CPU Kit with SuperCore  4.11.3
rtl-allocator.h
Go to the documentation of this file.
1 /*
2  * COPYRIGHT (c) 2012 Chris Johns <chrisj@rtems.org>
3  *
4  * The license and distribution terms for this file may be
5  * found in the file LICENSE in this distribution or at
6  * http://www.rtems.org/license/LICENSE.
7  */
16 #if !defined (_RTEMS_RTL_ALLOCATOR_H_)
17 #define _RTEMS_RTL_ALLOCATOR_H_
18 
19 #include <stdbool.h>
20 
21 #include "rtl-indirect-ptr.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif /* __cplusplus */
26 
40 };
41 
46 
50 #define RTEMS_RTL_ALLOC_TAGS ((size_t) (RTEMS_RTL_ALLOC_READ_EXEC + 1))
51 
66 typedef void (*rtems_rtl_allocator_t)(bool allocate,
67  rtems_rtl_alloc_tag_t tag,
68  void** address,
69  size_t size);
70 
79 };
80 
82 
89 
99 void* rtems_rtl_alloc_new (rtems_rtl_alloc_tag_t tag, size_t size, bool zero);
100 
107 void rtems_rtl_alloc_del (rtems_rtl_alloc_tag_t tag, void* address);
108 
119 
127 void rtems_rtl_alloc_indirect_new (rtems_rtl_alloc_tag_t tag,
128  rtems_rtl_ptr_t* handle,
129  size_t size);
130 
137 void rtems_rtl_alloc_indirect_del (rtems_rtl_alloc_tag_t tag,
138  rtems_rtl_ptr_t* handle);
139 
158 bool rtems_rtl_alloc_module_new (void** text_base, size_t text_size,
159  void** const_base, size_t const_size,
160  void** eh_base, size_t eh_size,
161  void** data_base, size_t data_size,
162  void** bss_base, size_t bss_size);
163 
173 void rtems_rtl_alloc_module_del (void** text_base, void** const_base,
174  void** eh_base, void** data_base,
175  void** bss_base);
176 
177 #ifdef __cplusplus
178 }
179 #endif /* __cplusplus */
180 
181 #endif
void rtems_rtl_alloc_initialise(rtems_rtl_alloc_data_t *data)
Initialise the allocate data.
Definition: rtl-allocator.c:41
void rtems_rtl_alloc_indirect_del(rtems_rtl_alloc_tag_t tag, rtems_rtl_ptr_t *handle)
Free memory from an indirect handle.
Definition: rtl-allocator.c:131
void rtems_rtl_alloc_module_del(void **text_base, void **const_base, void **eh_base, void **data_base, void **bss_base)
Free the memory allocated to a module.
Definition: rtl-allocator.c:223
RTEMS Run-Time Linker Indirect Pointer Management allows memory compaction in the allocator...
Memory used for symbols.
Definition: rtl-allocator.h:35
void rtems_rtl_alloc_indirect_new(rtems_rtl_alloc_tag_t tag, rtems_rtl_ptr_t *handle, size_t size)
Allocate memory to an indirect handle.
Definition: rtl-allocator.c:103
rtems_rtl_allocator_t rtems_rtl_alloc_hook(rtems_rtl_allocator_t handler)
Hook the Runtime Loader allocatior.
Definition: rtl-allocator.c:93
This is used to manage a chain.
Definition: chain.h:83
Memory used for external symbols.
Definition: rtl-allocator.h:36
The allocator data.
Definition: rtl-allocator.h:74
rtems_rtl_alloc_tags_e
Define the types of allocation the loader requires.
Definition: rtl-allocator.h:33
The memory is read and write.
Definition: rtl-allocator.h:38
#define RTEMS_RTL_ALLOC_TAGS
The number of tags.
Definition: rtl-allocator.h:50
A generic memory object.
Definition: rtl-allocator.h:34
enum rtems_rtl_alloc_tags_e rtems_rtl_alloc_tag_t
The allocator tag type.
Definition: rtl-allocator.h:45
bool rtems_rtl_alloc_module_new(void **text_base, size_t text_size, void **const_base, size_t const_size, void **eh_base, size_t eh_size, void **data_base, size_t data_size, void **bss_base, size_t bss_size)
Allocate the memory for a module given the size of the text, const, data and bss sections.
Definition: rtl-allocator.c:153
void(* rtems_rtl_allocator_t)(bool allocate, rtems_rtl_alloc_tag_t tag, void **address, size_t size)
Allocator handler handles all RTL allocations.
Definition: rtl-allocator.h:66
void rtems_rtl_alloc_del(rtems_rtl_alloc_tag_t tag, void *address)
The Runtime Loader allocator delete deletes allocated memory.
Definition: rtl-allocator.c:78
void * rtems_rtl_alloc_new(rtems_rtl_alloc_tag_t tag, size_t size, bool zero)
The Runtime Loader allocator new allocates new memory and optionally clear the memory if requested...
Definition: rtl-allocator.c:50
The memory is read only.
Definition: rtl-allocator.h:37
The RTL Indirect pointer.
Definition: rtl-indirect-ptr.h:29
rtems_rtl_allocator_t allocator
< The memory allocator handler.
Definition: rtl-allocator.h:76
The memory is read and executable.
Definition: rtl-allocator.h:39