RTEMS 6.1-rc2
Loading...
Searching...
No Matches
Files | Functions
Protected Heap Handler

This group contains the Protected Heap Handler implementation. More...

Files

file  protectedheap.h
 This header file provides the interfaces of the Protected Heap Handler.
 
file  pheapallocate.c
 This source file contains the implementation of _Protected_heap_Allocate_aligned_with_boundary().
 
file  pheapextend.c
 This source file contains the implementation of _Protected_heap_Extend().
 
file  pheapfree.c
 This source file contains the implementation of _Protected_heap_Free().
 
file  pheapgetfreeinfo.c
 This source file contains the implementation of _Protected_heap_Get_free_information().
 
file  pheapgetinfo.c
 This source file contains the implementation of _Protected_heap_Get_information().
 
file  pheapgetsize.c
 This source file contains the implementation of _Protected_heap_Get_size().
 
file  pheapwalk.c
 This source file contains the implementation of _Protected_heap_Walk().
 

Functions

bool _Protected_heap_Extend (Heap_Control *heap, void *area_begin, uintptr_t area_size)
 Extends the protected heap.
 
void * _Protected_heap_Allocate_aligned_with_boundary (Heap_Control *heap, uintptr_t size, uintptr_t alignment, uintptr_t boundary)
 Allocates an aligned memory area with boundary constraint for the protected heap.
 
bool _Protected_heap_Free (Heap_Control *heap, void *addr)
 Frees the allocated memory area.
 
bool _Protected_heap_Walk (Heap_Control *heap, int source, bool dump)
 Verifies the integrity of the heap.
 
bool _Protected_heap_Get_information (Heap_Control *heap, Heap_Information_block *info)
 Returns information about used and free blocks for the heap.
 
bool _Protected_heap_Get_free_information (Heap_Control *heap, Heap_Information *info)
 Returns information about free blocks for the heap.
 
uintptr_t _Protected_heap_Get_size (Heap_Control *heap)
 Returns the size of the allocatable area in bytes.
 

Detailed Description

This group contains the Protected Heap Handler implementation.

The ScoreAllocatorMutex is used to protect the heap accesses.

Function Documentation

◆ _Protected_heap_Allocate_aligned_with_boundary()

void * _Protected_heap_Allocate_aligned_with_boundary ( Heap_Control heap,
uintptr_t  size,
uintptr_t  alignment,
uintptr_t  boundary 
)

Allocates an aligned memory area with boundary constraint for the protected heap.

A size value of zero will return a unique address which may be freed with _Heap_Free(). This method first locks the allocator and after the allocation of the memory area, unlocks it again.

Parameters
[in,out]heapThe heap to allocate a memory are from.
sizeThe size of the desired memory are in bytes.
alignmentThe allocated memory area will begin at an address aligned by this value.
boundaryThe allocated memory area will fulfill a boundary constraint, if this value is not equal to zero. The boundary value specifies the set of addresses which are aligned by the boundary value. The interior of the allocated memory area will not contain an element of this set. The begin or end address of the area may be a member of the set.
Return values
pointerThe starting address of the allocated memory area.
NULLNo memory is available of the parameters are inconsistent.

◆ _Protected_heap_Extend()

bool _Protected_heap_Extend ( Heap_Control heap,
void *  area_begin,
uintptr_t  area_size 
)

Extends the protected heap.

Parameters
[in,out]heapThe heap to extend.
area_beginThe starting addres of the area to extend heap with.
area_sizeThe size of the heap area.
Return values
trueThe operation succeeded.
falseThe operation failed.

◆ _Protected_heap_Free()

bool _Protected_heap_Free ( Heap_Control heap,
void *  addr 
)

Frees the allocated memory area.

Inappropriate values for addr may corrupt the heap. This method first locks the allocator and after the free operation, unlocks it again.

Parameters
[in,out]heapThe heap of the allocated memory area.
addrThe starting address of the memory area to be freed.
Return values
trueThe allocated memory area was successfully freed.
falseThe method failed.

◆ _Protected_heap_Get_free_information()

bool _Protected_heap_Get_free_information ( Heap_Control heap,
Heap_Information info 
)

Returns information about free blocks for the heap.

This method first locks the allocator and after the operation, unlocks it again.

Parameters
heapThe heap to get the information from.
[out]infoStores the information about free blocks of heap after the method call.

◆ _Protected_heap_Get_information()

bool _Protected_heap_Get_information ( Heap_Control heap,
Heap_Information_block info 
)

Returns information about used and free blocks for the heap.

This method first locks the allocator and after the operation, unlocks it again.

Parameters
heapThe heap to get the information from.
[out]infoStores the information of the heap after the method call.

◆ _Protected_heap_Get_size()

uintptr_t _Protected_heap_Get_size ( Heap_Control heap)

Returns the size of the allocatable area in bytes.

This value is an integral multiple of the page size.

Parameters
heapThe heap to get the allocatable area from.
Returns
The size of the allocatable area in heap in bytes.

◆ _Protected_heap_Walk()

bool _Protected_heap_Walk ( Heap_Control heap,
int  source,
bool  dump 
)

Verifies the integrity of the heap.

Walks the heap to verify its integrity. This method first locks the allocator and after the operation, unlocks it again, if the thread dispatch is enabled.

Parameters
heapThe heap whose integrity is to be verified.
sourceIf dump is true, this is used to mark the output lines.
dumpIndicates whether diagnostic messages will be printed to standard output.
Return values
trueNo errors occurred, the heapĀ“s integrity is not violated.
falseThe heap is corrupt.