summaryrefslogtreecommitdiffstats
path: root/c/src/exec/score/src/wkspace.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1996-04-22 16:46:36 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1996-04-22 16:46:36 +0000
commit8faca06664388ed141b2f7b9b5ddcfb0b4577fe8 (patch)
tree9d84dc448d03fcbc43d0d5a77f68de44e7dc6d2b /c/src/exec/score/src/wkspace.c
parentmade initialization routine a regular subroutine (diff)
downloadrtems-8faca06664388ed141b2f7b9b5ddcfb0b4577fe8.tar.bz2
thread.c: added support for optional user provided stack allocator
wkspace.c: made initialization routine a regular subroutine
Diffstat (limited to 'c/src/exec/score/src/wkspace.c')
-rw-r--r--c/src/exec/score/src/wkspace.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/c/src/exec/score/src/wkspace.c b/c/src/exec/score/src/wkspace.c
index f168e91d62..1dda9408bb 100644
--- a/c/src/exec/score/src/wkspace.c
+++ b/c/src/exec/score/src/wkspace.c
@@ -22,6 +22,49 @@
/*PAGE
*
+ * _Workspace_Handler_initialization
+ */
+
+void _Workspace_Handler_initialization(
+ void *starting_address,
+ unsigned32 size
+)
+{
+ unsigned32 *zero_out_array;
+ unsigned32 index;
+ unsigned32 memory_available;
+
+ if ( !starting_address || !_Addresses_Is_aligned( starting_address ) )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS
+ );
+
+ if ( _CPU_Table.do_zero_of_workspace ) {
+ for( zero_out_array = (unsigned32 *) starting_address, index = 0 ;
+ index < size / 4 ;
+ index++ )
+ zero_out_array[ index ] = 0;
+ }
+
+ memory_available = _Heap_Initialize(
+ &_Workspace_Area,
+ starting_address,
+ size,
+ CPU_HEAP_ALIGNMENT
+ );
+
+ if ( memory_available == 0 )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_TOO_LITTLE_WORKSPACE
+ );
+}
+
+/*PAGE
+ *
* _Workspace_Allocate_or_fatal_error
*
*/