Skip to content

Commit 8f0289f

Browse files
author
Oliver Lavery
committed
Add MPU macros to heap_5.c
1 parent 3888ffb commit 8f0289f

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

portable/MemMang/heap_5.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ typedef struct A_BLOCK_LINK
136136
/* We require xApplicationGetRandomNumber in order to initialize our canary value */
137137
extern BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber );
138138
/* Canary value for protecting internal heap pointers */
139-
static portPOINTER_SIZE_TYPE xHeapCanary;
139+
PRIVILEGED_DATA static portPOINTER_SIZE_TYPE xHeapCanary;
140140
/* Highest and lowest heap addresses for bounds checking */
141-
static void * pxHeapHighAddress = NULL;
142-
static void * pxHeapLowAddress = NULL;
141+
PRIVILEGED_DATA static void * pxHeapHighAddress = NULL;
142+
PRIVILEGED_DATA static void * pxHeapLowAddress = NULL;
143143

144144
/* Macro to load/store pxNextFreeBlock pointers to memory. By XORing the
145145
* pointers with a random canary value, intentional heap overwrites will
@@ -167,24 +167,24 @@ typedef struct A_BLOCK_LINK
167167
* the block in front it and/or the block behind it if the memory blocks are
168168
* adjacent to each other.
169169
*/
170-
static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert );
171-
170+
static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert ) PRIVILEGED_FUNCTION;
171+
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION;
172172
/*-----------------------------------------------------------*/
173173

174174
/* The size of the structure placed at the beginning of each allocated memory
175175
* block must by correctly byte aligned. */
176176
static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( portBYTE_ALIGNMENT - 1 ) ) ) & ~( ( size_t ) portBYTE_ALIGNMENT_MASK );
177177

178178
/* Create a couple of list links to mark the start and end of the list. */
179-
static BlockLink_t xStart;
180-
static BlockLink_t * pxEnd = NULL;
179+
PRIVILEGED_DATA static BlockLink_t xStart;
180+
PRIVILEGED_DATA static BlockLink_t * pxEnd = NULL;
181181

182182
/* Keeps track of the number of calls to allocate and free memory as well as the
183183
* number of free bytes remaining, but says nothing about fragmentation. */
184-
static size_t xFreeBytesRemaining = 0U;
185-
static size_t xMinimumEverFreeBytesRemaining = 0U;
186-
static size_t xNumberOfSuccessfulAllocations = 0;
187-
static size_t xNumberOfSuccessfulFrees = 0;
184+
PRIVILEGED_DATA static size_t xFreeBytesRemaining = 0U;
185+
PRIVILEGED_DATA static size_t xMinimumEverFreeBytesRemaining = 0U;
186+
PRIVILEGED_DATA static size_t xNumberOfSuccessfulAllocations = 0;
187+
PRIVILEGED_DATA static size_t xNumberOfSuccessfulFrees = 0;
188188

189189
/*-----------------------------------------------------------*/
190190

@@ -444,7 +444,7 @@ void * pvPortCalloc( size_t xNum,
444444
}
445445
/*-----------------------------------------------------------*/
446446

447-
static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
447+
static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert ) /* PRIVILEGED_FUNCTION */
448448
{
449449
BlockLink_t * pxIterator;
450450
uint8_t * puc;
@@ -513,7 +513,7 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
513513
}
514514
/*-----------------------------------------------------------*/
515515

516-
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
516+
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) /* PRIVILEGED_FUNCTION */
517517
{
518518
BlockLink_t * pxFirstFreeBlockInRegion = NULL;
519519
BlockLink_t * pxPreviousFreeBlock;

0 commit comments

Comments
 (0)