source: rtems/c/src/exec/score/src/wkspace.c @ df49c60

4.104.114.84.95
Last change on this file since df49c60 was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on 11/17/99 at 17:51:34

Updated copyright notice.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  Workspace Handler
3 *
4 *  XXX
5 *
6 *  NOTE:
7 *
8 *  COPYRIGHT (c) 1989-1999.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.OARcorp.com/rtems/license.html.
14 *
15 *  $Id$
16 */
17
18#include <rtems/system.h>
19#include <rtems/score/wkspace.h>
20#include <rtems/score/interr.h>
21
22/*PAGE
23 *
24 *  _Workspace_Handler_initialization
25 */
26 
27void _Workspace_Handler_initialization(
28  void       *starting_address,
29  unsigned32  size
30)
31{
32  unsigned32 *zero_out_array;
33  unsigned32  index;
34  unsigned32  memory_available;
35 
36  if ( !starting_address || !_Addresses_Is_aligned( starting_address ) )
37    _Internal_error_Occurred(
38      INTERNAL_ERROR_CORE,
39      TRUE,
40      INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS
41    );
42 
43  if ( _CPU_Table.do_zero_of_workspace ) {
44    for( zero_out_array  = (unsigned32 *) starting_address, index = 0 ;
45         index < size / sizeof( unsigned32 ) ;
46         index++ )
47      zero_out_array[ index ] = 0;
48  }
49 
50  memory_available = _Heap_Initialize(
51    &_Workspace_Area,
52    starting_address,
53    size,
54    CPU_HEAP_ALIGNMENT
55  );
56 
57  if ( memory_available == 0 )
58    _Internal_error_Occurred(
59      INTERNAL_ERROR_CORE,
60      TRUE,
61      INTERNAL_ERROR_TOO_LITTLE_WORKSPACE
62    );
63}
64
65/*PAGE
66 *
67 *  _Workspace_Allocate_or_fatal_error
68 *
69 */
70
71void *_Workspace_Allocate_or_fatal_error(
72  unsigned32   size
73)
74{
75  void        *memory;
76
77  memory = _Workspace_Allocate( size );
78
79  if ( memory == NULL )
80    _Internal_error_Occurred(
81      INTERNAL_ERROR_CORE,
82      TRUE,
83      INTERNAL_ERROR_WORKSPACE_ALLOCATION
84    );
85
86  return memory;
87}
Note: See TracBrowser for help on using the repository browser.