diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-05-13 16:48:08 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-05-13 16:48:08 +0000 |
commit | 4423e62ac1d7bc7ed4e809ab5ac15540ea61c4c9 (patch) | |
tree | c28487317f85b85e38f401a04327f158f11c5776 /cpukit/rtems/src/workspace.c | |
parent | 2009-05-11 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-4423e62ac1d7bc7ed4e809ab5ac15540ea61c4c9.tar.bz2 |
2009-05-13 Joel Sherrill <joel.sherrill@OARcorp.com>
PR 1411/cpukit
* rtems/src/workspace.c, score/include/rtems/score/protectedheap.h,
score/src/pheapgetfreeinfo.c, score/src/pheapgetinfo.c: Improve
workspace wrapper methods.
Diffstat (limited to 'cpukit/rtems/src/workspace.c')
-rw-r--r-- | cpukit/rtems/src/workspace.c | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/cpukit/rtems/src/workspace.c b/cpukit/rtems/src/workspace.c index f573440475..e6394aca86 100644 --- a/cpukit/rtems/src/workspace.c +++ b/cpukit/rtems/src/workspace.c @@ -1,7 +1,7 @@ /* * Workspace Handler * - * COPYRIGHT (c) 1989-2007. + * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -17,6 +17,7 @@ #include <rtems/system.h> #include <rtems/score/wkspace.h> +#include <rtems/score/protectedheap.h> #include <rtems/score/interr.h> #include <rtems/config.h> @@ -26,28 +27,40 @@ bool rtems_workspace_get_information( Heap_Information_block *the_info ) { - Heap_Get_information_status status; - - status = _Heap_Get_information( &_Workspace_Area, the_info ); - if ( status == HEAP_GET_INFORMATION_SUCCESSFUL ) - return true; - else + if ( !the_info ) return false; + + return _Protected_heap_Get_information( &_Workspace_Area, the_info ); } /* * _Workspace_Allocate */ bool rtems_workspace_allocate( - size_t bytes, - void **pointer + uintptr_t bytes, + void **pointer ) { - *pointer = _Heap_Allocate( &_Workspace_Area, bytes ); - if (!pointer) - return false; - else - return true; + void *ptr; + + /* + * check the arguments + */ + if ( !pointer ) + return false; + + if ( !bytes ) + return false; + + /* + * Allocate the memory + */ + ptr = _Protected_heap_Allocate( &_Workspace_Area, (intptr_t) bytes ); + if (!ptr) + return false; + + *pointer = ptr; + return true; } /* @@ -57,6 +70,6 @@ bool rtems_workspace_free( void *pointer ) { - return _Heap_Free( &_Workspace_Area, pointer ); + return _Protected_heap_Free( &_Workspace_Area, pointer ); } |