1 | /* wkspace.inl |
---|
2 | * |
---|
3 | * This file contains the macro implementation of the inlined routines |
---|
4 | * from the RAM Workspace Handler. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * All rights assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
11 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
12 | * notice must appear in all copies of this file and its derivatives. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __WORKSPACE_inl |
---|
18 | #define __WORKSPACE_inl |
---|
19 | |
---|
20 | /*PAGE |
---|
21 | * |
---|
22 | * _Workspace_Handler_initialization |
---|
23 | * |
---|
24 | */ |
---|
25 | |
---|
26 | #define _Workspace_Handler_initialization( _starting_address, _size ) \ |
---|
27 | { \ |
---|
28 | unsigned32 *zero_out_array; \ |
---|
29 | unsigned32 index; \ |
---|
30 | unsigned32 memory_available; \ |
---|
31 | \ |
---|
32 | if ( !(_starting_address) || !_Addresses_Is_aligned( (_starting_address) ) ) \ |
---|
33 | _Internal_error_Occurred( \ |
---|
34 | INTERNAL_ERROR_CORE, \ |
---|
35 | TRUE, \ |
---|
36 | INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS \ |
---|
37 | ); \ |
---|
38 | \ |
---|
39 | if ( _CPU_Table.do_zero_of_workspace ) { \ |
---|
40 | for( zero_out_array = (unsigned32 *) (_starting_address), index = 0 ; \ |
---|
41 | index < (_size) / 4 ; \ |
---|
42 | index++ ) \ |
---|
43 | zero_out_array[ index ] = 0; \ |
---|
44 | } \ |
---|
45 | \ |
---|
46 | memory_available = _Heap_Initialize( \ |
---|
47 | &_Workspace_Area, \ |
---|
48 | (_starting_address), \ |
---|
49 | (_size), \ |
---|
50 | CPU_HEAP_ALIGNMENT \ |
---|
51 | ); \ |
---|
52 | \ |
---|
53 | if ( memory_available == 0 ) \ |
---|
54 | _Internal_error_Occurred( \ |
---|
55 | INTERNAL_ERROR_CORE, \ |
---|
56 | TRUE, \ |
---|
57 | INTERNAL_ERROR_TOO_LITTLE_WORKSPACE \ |
---|
58 | ); \ |
---|
59 | } |
---|
60 | |
---|
61 | /*PAGE |
---|
62 | * |
---|
63 | * _Workspace_Allocate |
---|
64 | * |
---|
65 | */ |
---|
66 | |
---|
67 | #define _Workspace_Allocate( _size ) \ |
---|
68 | _Heap_Allocate( &_Workspace_Area, (_size) ) |
---|
69 | |
---|
70 | /*PAGE |
---|
71 | * |
---|
72 | * _Workspace_Free |
---|
73 | * |
---|
74 | */ |
---|
75 | |
---|
76 | #define _Workspace_Free( _block ) \ |
---|
77 | _Heap_Free( &_Workspace_Area, (_block) ) |
---|
78 | |
---|
79 | #endif |
---|
80 | /* end of include file */ |
---|