forked from Imagelibrary/rtems
2011-02-17 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libcsupport/src/rtems_heap_extend.c: New file. * libcsupport/Makefile.am: Reflect change from above. * libcsupport/include/rtems/malloc.h: Declare rtems_heap_extend(). * score/include/rtems/score/heap.h: Documentation.
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
2011-02-17 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||||
|
|
||||||
|
* libcsupport/src/rtems_heap_extend.c: New file.
|
||||||
|
* libcsupport/Makefile.am: Reflect change from above.
|
||||||
|
* libcsupport/include/rtems/malloc.h: Declare rtems_heap_extend().
|
||||||
|
* score/include/rtems/score/heap.h: Documentation.
|
||||||
|
|
||||||
2011-02-16 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
2011-02-16 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||||
|
|
||||||
* score/src/wkspace.c: Removed NULL pointer check from
|
* score/src/wkspace.c: Removed NULL pointer check from
|
||||||
|
|||||||
@@ -98,7 +98,8 @@ MALLOC_C_FILES = src/malloc_initialize.c src/calloc.c src/malloc.c \
|
|||||||
src/malloc_report_statistics.c src/malloc_report_statistics_plugin.c \
|
src/malloc_report_statistics.c src/malloc_report_statistics_plugin.c \
|
||||||
src/malloc_statistics_helpers.c src/posix_memalign.c \
|
src/malloc_statistics_helpers.c src/posix_memalign.c \
|
||||||
src/rtems_memalign.c src/malloc_deferred.c src/malloc_sbrk_helpers.c \
|
src/rtems_memalign.c src/malloc_deferred.c src/malloc_sbrk_helpers.c \
|
||||||
src/malloc_dirtier.c src/malloc_p.h src/rtems_malloc.c
|
src/malloc_dirtier.c src/malloc_p.h src/rtems_malloc.c \
|
||||||
|
src/rtems_heap_extend.c
|
||||||
|
|
||||||
PASSWORD_GROUP_C_FILES = src/getpwent.c
|
PASSWORD_GROUP_C_FILES = src/getpwent.c
|
||||||
|
|
||||||
|
|||||||
@@ -161,6 +161,24 @@ void *rtems_heap_allocate_aligned_with_boundary(
|
|||||||
uintptr_t boundary
|
uintptr_t boundary
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Extends the memory available for the heap using the memory area
|
||||||
|
* starting at @a area_begin of size @a area_size bytes.
|
||||||
|
*
|
||||||
|
* There are no alignment requirements. The memory area must be big enough to
|
||||||
|
* contain some maintainance blocks. It must not overlap parts of the current
|
||||||
|
* heap areas. Disconnected subordinate heap areas will lead to used blocks
|
||||||
|
* which cover the gaps. Extending with an inappropriate memory area will
|
||||||
|
* corrupt the heap.
|
||||||
|
*
|
||||||
|
* @retval RTEMS_SUCCESSFUL Successful operation.
|
||||||
|
* @retval RTEMS_INVALID_ADDRESS Invalid memory area.
|
||||||
|
*/
|
||||||
|
rtems_status_code rtems_heap_extend(
|
||||||
|
void *area_begin,
|
||||||
|
uintptr_t area_size
|
||||||
|
);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
45
cpukit/libcsupport/src/rtems_heap_extend.c
Normal file
45
cpukit/libcsupport/src/rtems_heap_extend.c
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
*
|
||||||
|
* @ingroup libcsupport
|
||||||
|
*
|
||||||
|
* @brief rtems_heap_extend() implementation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2011 embedded brains GmbH. All rights reserved.
|
||||||
|
*
|
||||||
|
* embedded brains GmbH
|
||||||
|
* Obere Lagerstr. 30
|
||||||
|
* 82178 Puchheim
|
||||||
|
* Germany
|
||||||
|
* <rtems@embedded-brains.de>
|
||||||
|
*
|
||||||
|
* The license and distribution terms for this file may be
|
||||||
|
* found in the file LICENSE in this distribution or at
|
||||||
|
* http://www.rtems.com/license/LICENSE.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef RTEMS_NEWLIB
|
||||||
|
#include "malloc_p.h"
|
||||||
|
|
||||||
|
rtems_status_code rtems_heap_extend(
|
||||||
|
void *area_begin,
|
||||||
|
uintptr_t area_size
|
||||||
|
)
|
||||||
|
{
|
||||||
|
bool ok = _Protected_heap_Extend(RTEMS_Malloc_Heap, area_begin, area_size);
|
||||||
|
|
||||||
|
if (ok) {
|
||||||
|
return RTEMS_SUCCESSFUL;
|
||||||
|
} else {
|
||||||
|
return RTEMS_INVALID_ADDRESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* RTEMS_NEWLIB */
|
||||||
@@ -430,15 +430,17 @@ uintptr_t _Heap_Initialize(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Extends the memory area of the heap @a heap using the memory area
|
* @brief Extends the memory available for the heap @a heap using the memory
|
||||||
* starting at @a area_begin of size @a area_size bytes.
|
* area starting at @a area_begin of size @a area_size bytes.
|
||||||
*
|
*
|
||||||
* The extended space available for allocation will be returned in
|
* The extended space available for allocation will be returned in
|
||||||
* @a amount_extended. This pointer may be @c NULL.
|
* @a amount_extended. This pointer may be @c NULL.
|
||||||
*
|
*
|
||||||
* The memory area must be big enough to contain some maintainance blocks. It
|
* There are no alignment requirements. The memory area must be big enough to
|
||||||
* must not overlap parts of the current heap areas. Disconnected subordinate
|
* contain some maintainance blocks. It must not overlap parts of the current
|
||||||
* heap areas will lead to used blocks which cover the gaps.
|
* heap areas. Disconnected subordinate heap areas will lead to used blocks
|
||||||
|
* which cover the gaps. Extending with an inappropriate memory area will
|
||||||
|
* corrupt the heap.
|
||||||
*
|
*
|
||||||
* Returns @c true in case of success, and @c false otherwise.
|
* Returns @c true in case of success, and @c false otherwise.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user