summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/rtems_memalign.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-02-25 09:02:43 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-02-25 11:35:54 +0100
commit9d1f39434585e8d3f8897d95a2bfe1ddccb79aec (patch)
tree2d3a0868f410cff137871f5ce493df4f27a22b1a /cpukit/libcsupport/src/rtems_memalign.c
parentmalloc: Use dedicated lock for deferred frees (diff)
downloadrtems-9d1f39434585e8d3f8897d95a2bfe1ddccb79aec.tar.bz2
malloc: Add _Malloc_System_state()
Replace malloc_is_system_state_OK() with _Malloc_System_state() to allow early allocations, e.g. in bsp_start(). Here the _Thread_Executing is NULL, thus an _API_Mutex_Lock() would lead to a NULL pointer access. Move malloc() support code to general case rtems_heap_allocate_aligned_with_boundary(). Use rtems_heap_allocate_aligned_with_boundary() to avoid duplicated code.
Diffstat (limited to 'cpukit/libcsupport/src/rtems_memalign.c')
-rw-r--r--cpukit/libcsupport/src/rtems_memalign.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/cpukit/libcsupport/src/rtems_memalign.c b/cpukit/libcsupport/src/rtems_memalign.c
index 5755fa0b3c..8e3363ebf3 100644
--- a/cpukit/libcsupport/src/rtems_memalign.c
+++ b/cpukit/libcsupport/src/rtems_memalign.c
@@ -41,24 +41,9 @@ int rtems_memalign(
*pointer = NULL;
/*
- * Do not attempt to allocate memory if not in correct system state.
- */
- if ( !malloc_is_system_state_OK() )
- return EINVAL;
-
- /*
- * If some free's have been deferred, then do them now.
- */
- malloc_deferred_frees_process();
-
- /*
* Perform the aligned allocation requested
*/
- return_this = _Protected_heap_Allocate_aligned(
- RTEMS_Malloc_Heap,
- size,
- alignment
- );
+ return_this = rtems_heap_allocate_aligned_with_boundary( size, alignment, 0 );
if ( !return_this )
return ENOMEM;