diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-05-03 21:33:39 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-05-03 21:33:39 +0000 |
commit | e746a88b22c99f4ffe808fe2e9fb8816121cd608 (patch) | |
tree | 4305f0a400a0aed7e7792f43046c7011cf67f106 /cpukit/libcsupport/src/mallocfreespace.c | |
parent | 2007-05-03 Joel Sherrill <joel@OARcorp.com> (diff) | |
download | rtems-e746a88b22c99f4ffe808fe2e9fb8816121cd608.tar.bz2 |
2007-05-03 Joel Sherrill <joel@OARcorp.com>
* ChangeLog, libcsupport/src/malloc.c,
libcsupport/src/mallocfreespace.c, sapi/include/confdefs.h,
score/Makefile.am, score/preinstall.am: malloc never blocks so the
Region Manager is quite heavy for implementing this. This patch
implements the C Program Heap directly in terms of the new Protected
Heap handler. This handler is a direct use of a SuperCore Heap in
conjunction with the Allocator Mutex used internally by RTEMS. This
saves 3184 bytes on most SPARC test executables.
* score/include/rtems/score/protectedheap.h, score/src/pheapallocate.c,
score/src/pheapallocatealigned.c, score/src/pheapextend.c,
score/src/pheapfree.c, score/src/pheapgetblocksize.c,
score/src/pheapgetfreeinfo.c, score/src/pheapgetinfo.c,
score/src/pheapinit.c, score/src/pheapresizeblock.c,
score/src/pheapwalk.c: New files.
Diffstat (limited to 'cpukit/libcsupport/src/mallocfreespace.c')
-rw-r--r-- | cpukit/libcsupport/src/mallocfreespace.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/cpukit/libcsupport/src/mallocfreespace.c b/cpukit/libcsupport/src/mallocfreespace.c index 448dca46e4..51a02fc51f 100644 --- a/cpukit/libcsupport/src/mallocfreespace.c +++ b/cpukit/libcsupport/src/mallocfreespace.c @@ -19,6 +19,7 @@ #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ #include <rtems.h> #include <rtems/libcsupport.h> +#include <rtems/score/protectedheap.h> #include <stdio.h> #include <stdlib.h> @@ -27,7 +28,7 @@ #include <errno.h> #include <string.h> -extern rtems_id RTEMS_Malloc_Heap; +extern Heap_Control RTEMS_Malloc_Heap; /* * Find amount of free heap remaining @@ -35,10 +36,8 @@ extern rtems_id RTEMS_Malloc_Heap; size_t malloc_free_space( void ) { - region_information_block heap_info; + Heap_Information info; - if ( !rtems_region_get_free_information( RTEMS_Malloc_Heap, &heap_info ) ) { - return (size_t) heap_info.Free.largest; - } - return (size_t) -1; + _Protected_heap_Get_free_information( &RTEMS_Malloc_Heap, &info ); + return (size_t) info.largest; } |