18 #ifndef _RTEMS_SCORE_HEAP_H 19 #define _RTEMS_SCORE_HEAP_H 21 #include <rtems/score/cpu.h> 29 #define HEAP_PROTECTION 136 #ifndef HEAP_PROTECTION 137 #define HEAP_PROTECTION_HEADER_SIZE 0 139 #define HEAP_PROTECTOR_COUNT 2 141 #define HEAP_BEGIN_PROTECTOR_0 ((uintptr_t) 0xfd75a98f) 142 #define HEAP_BEGIN_PROTECTOR_1 ((uintptr_t) 0xbfa1f177) 143 #define HEAP_END_PROTECTOR_0 ((uintptr_t) 0xd6b8855e) 144 #define HEAP_END_PROTECTOR_1 ((uintptr_t) 0x13a44a5b) 146 #define HEAP_FREE_PATTERN ((uintptr_t) 0xe7093cdf) 148 #define HEAP_PROTECTION_OBOLUS ((Heap_Block *) 1) 150 typedef void (*_Heap_Protection_handler)(
156 _Heap_Protection_handler block_initialize;
157 _Heap_Protection_handler block_check;
158 _Heap_Protection_handler block_error;
162 uintptr_t delayed_free_block_count;
163 uintptr_t delayed_free_fraction;
169 uintptr_t protector [HEAP_PROTECTOR_COUNT];
173 } Heap_Protection_block_begin;
176 uintptr_t protector [HEAP_PROTECTOR_COUNT];
177 } Heap_Protection_block_end;
179 #define HEAP_PROTECTION_HEADER_SIZE \ 180 (sizeof(Heap_Protection_block_begin) + sizeof(Heap_Protection_block_end)) 187 #define HEAP_BLOCK_HEADER_SIZE \ 188 (2 * sizeof(uintptr_t) + HEAP_PROTECTION_HEADER_SIZE) 209 #ifdef HEAP_PROTECTION 210 Heap_Protection_block_begin Protection_begin;
228 #ifdef HEAP_PROTECTION 229 Heap_Protection_block_end Protection_end;
258 uintptr_t min_block_size;
259 uintptr_t area_begin;
264 #ifdef HEAP_PROTECTION 265 Heap_Protection Protection;
293 uintptr_t page_size_or_unused
342 uintptr_t remainder = value % alignment;
344 if ( remainder != 0 ) {
345 return value - remainder + alignment;
353 return _Heap_Align_up(
sizeof(
Heap_Block ), page_size );
363 if ( page_size != 0 ) {
364 page_size = _Heap_Align_up( page_size, CPU_ALIGNMENT );
366 page_size = CPU_ALIGNMENT;
382 if ( page_size != 0 ) {
383 page_size = _Heap_Align_up( page_size, CPU_ALIGNMENT );
385 page_size = CPU_ALIGNMENT;
388 if ( page_size < alignment ) {
389 page_size = alignment;
Run-time heap statistics.
Definition: heapinfo.h:40
uintptr_t(* Heap_Initialization_or_extend_handler)(Heap_Control *heap, void *area_begin, uintptr_t area_size, uintptr_t page_size_or_unused)
Heap initialization and extend handler type.
Definition: heap.h:289
uintptr_t size_and_flag
Contains the size of the current block and a flag which indicates if the previous block is free or us...
Definition: heap.h:226
Definition: intercom.c:58
uintptr_t _Heap_No_extend(Heap_Control *unused_0, void *unused_1, uintptr_t unused_2, uintptr_t unused_3)
This function returns always zero.
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:65
RTEMS_INLINE_ROUTINE uintptr_t _Heap_Area_overhead(uintptr_t page_size)
Returns the worst case overhead to manage a memory area.
Definition: heap.h:359
Heap area structure for table based heap initialization and extension.
Definition: heap.h:275
Description for free or used blocks.
Definition: heap.h:193
#define HEAP_BLOCK_HEADER_SIZE
The block header consists of the two size fields (Heap_Block::prev_size and Heap_Block::size_and_flag...
Definition: heap.h:187
RTEMS_INLINE_ROUTINE uintptr_t _Heap_Size_with_overhead(uintptr_t page_size, uintptr_t size, uintptr_t alignment)
Returns the size with administration and alignment overhead for one allocation.
Definition: heap.h:376
Heap Handler Information API.
Control block used to manage a heap.
Definition: heap.h:255
Heap_Block * next
Pointer to the next free block or part of the allocated area.
Definition: heap.h:241
uintptr_t prev_size
Size of the previous block or part of the allocated area of the previous block.
Definition: heap.h:207
unsigned size
Definition: tte.h:74
Heap_Block * prev
Pointer to the previous free block or part of the allocated area.
Definition: heap.h:249
uintptr_t _Heap_Extend(Heap_Control *heap, void *area_begin, uintptr_t area_size, uintptr_t unused)
Extends the memory available for the heap heap using the memory area starting at area_begin of size a...
Definition: heapextend.c:119