RTEMS 6.1-rc1
rtl-allocator.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 * COPYRIGHT (c) 2012, 2018, 2023 Chris Johns <chrisj@rtems.org>
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
35#if !defined (_RTEMS_RTL_ALLOCATOR_H_)
36#define _RTEMS_RTL_ALLOCATOR_H_
37
38#include <stdbool.h>
39
40#include "rtl-indirect-ptr.h"
41
42#ifdef __cplusplus
43extern "C" {
44#endif /* __cplusplus */
45
59};
60
65
77};
78
83
87#define RTEMS_RTL_ALLOC_TAGS ((size_t) (RTEMS_RTL_ALLOC_READ_EXEC + 1))
88
105 void** address,
106 size_t size);
107
116};
117
119
126
136void* rtems_rtl_alloc_new (rtems_rtl_alloc_tag tag, size_t size, bool zero);
137
144void rtems_rtl_alloc_del (rtems_rtl_alloc_tag tag, void* address);
145
161 void* address,
162 size_t size,
163 bool zero);
164
172void rtems_rtl_alloc_lock (void);
173
181void rtems_rtl_alloc_unlock (void);
182
189void rtems_rtl_alloc_wr_enable (rtems_rtl_alloc_tag tag, void* address);
190
197void rtems_rtl_alloc_wr_disable (rtems_rtl_alloc_tag tag, void* address);
198
209
218 rtems_rtl_ptr* handle,
219 size_t size);
220
228 rtems_rtl_ptr* handle);
229
236
243
250
257
264
283bool rtems_rtl_alloc_module_new (void** text_base, size_t text_size,
284 void** const_base, size_t const_size,
285 void** eh_base, size_t eh_size,
286 void** data_base, size_t data_size,
287 void** bss_base, size_t bss_size);
288
307bool rtems_rtl_alloc_module_resize (void** text_base, size_t text_size,
308 void** const_base, size_t const_size,
309 void** eh_base, size_t eh_size,
310 void** data_base, size_t data_size,
311 void** bss_base, size_t bss_size);
312
322void rtems_rtl_alloc_module_del (void** text_base, void** const_base,
323 void** eh_base, void** data_base,
324 void** bss_base);
325
326#ifdef __cplusplus
327}
328#endif /* __cplusplus */
329
330#endif
rtems_rtl_alloc_tag rtems_rtl_alloc_bss_tag(void)
Definition: rtl-allocator.c:299
void rtems_rtl_alloc_indirect_new(rtems_rtl_alloc_tag tag, rtems_rtl_ptr *handle, size_t size)
Definition: rtl-allocator.c:225
rtems_rtl_alloc_tag rtems_rtl_alloc_text_tag(void)
Definition: rtl-allocator.c:275
void rtems_rtl_alloc_unlock(void)
Definition: rtl-allocator.c:182
void * rtems_rtl_alloc_resize(rtems_rtl_alloc_tag tag, void *address, size_t size, bool zero)
Definition: rtl-allocator.c:113
void rtems_rtl_alloc_initialise(rtems_rtl_alloc_data *data)
Definition: rtl-allocator.c:62
rtems_rtl_allocator rtems_rtl_alloc_hook(rtems_rtl_allocator handler)
Definition: rtl-allocator.c:215
void rtems_rtl_alloc_wr_enable(rtems_rtl_alloc_tag tag, void *address)
Definition: rtl-allocator.c:147
enum rtems_rtl_alloc_tags rtems_rtl_alloc_tag
Definition: rtl-allocator.h:64
void rtems_rtl_alloc_del(rtems_rtl_alloc_tag tag, void *address)
Definition: rtl-allocator.c:99
#define RTEMS_RTL_ALLOC_TAGS
Definition: rtl-allocator.h:87
void rtems_rtl_alloc_module_del(void **text_base, void **const_base, void **eh_base, void **data_base, void **bss_base)
Definition: rtl-allocator.c:435
rtems_rtl_alloc_tags
Definition: rtl-allocator.h:52
@ RTEMS_RTL_ALLOC_READ
Definition: rtl-allocator.h:56
@ RTEMS_RTL_ALLOC_READ_EXEC
Definition: rtl-allocator.h:58
@ RTEMS_RTL_ALLOC_EXTERNAL
Definition: rtl-allocator.h:55
@ RTEMS_RTL_ALLOC_SYMBOL
Definition: rtl-allocator.h:54
@ RTEMS_RTL_ALLOC_READ_WRITE
Definition: rtl-allocator.h:57
@ RTEMS_RTL_ALLOC_OBJECT
Definition: rtl-allocator.h:53
void rtems_rtl_alloc_wr_disable(rtems_rtl_alloc_tag tag, void *address)
Definition: rtl-allocator.c:198
void * rtems_rtl_alloc_new(rtems_rtl_alloc_tag tag, size_t size, bool zero)
Definition: rtl-allocator.c:71
void(* rtems_rtl_allocator)(rtems_rtl_alloc_cmd cmd, rtems_rtl_alloc_tag tag, void **address, size_t size)
Definition: rtl-allocator.h:103
rtems_rtl_alloc_cmd
Definition: rtl-allocator.h:69
@ RTEMS_RTL_ALLOC_UNLOCK
Definition: rtl-allocator.h:74
@ RTEMS_RTL_ALLOC_DEL
Definition: rtl-allocator.h:71
@ RTEMS_RTL_ALLOC_NEW
Definition: rtl-allocator.h:70
@ RTEMS_RTL_ALLOC_WR_ENABLE
Definition: rtl-allocator.h:75
@ RTEMS_RTL_ALLOC_LOCK
Definition: rtl-allocator.h:73
@ RTEMS_RTL_ALLOC_WR_DISABLE
Definition: rtl-allocator.h:76
@ RTEMS_RTL_ALLOC_RESIZE
Definition: rtl-allocator.h:72
bool rtems_rtl_alloc_module_resize(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)
Definition: rtl-allocator.c:375
rtems_rtl_alloc_tag rtems_rtl_alloc_data_tag(void)
Definition: rtl-allocator.c:293
rtems_rtl_alloc_tag rtems_rtl_alloc_eh_tag(void)
Definition: rtl-allocator.c:287
rtems_rtl_alloc_tag rtems_rtl_alloc_const_tag(void)
Definition: rtl-allocator.c:281
void rtems_rtl_alloc_lock(void)
Definition: rtl-allocator.c:164
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)
Definition: rtl-allocator.c:305
void rtems_rtl_alloc_indirect_del(rtems_rtl_alloc_tag tag, rtems_rtl_ptr *handle)
Definition: rtl-allocator.c:253
RTEMS Run-Time Linker Indirect Pointer Management allows memory compaction in the allocator.
Definition: rtl-allocator.h:111
rtems_rtl_allocator allocator
Definition: rtl-allocator.h:113
Definition: rtl-indirect-ptr.h:48
unsigned size
Definition: tte.h:1
This union represents a chain control block.
Definition: chain.h:96