2ee739cc |
1 | /* |
2 | * flex.h |
3 | * |
4 | * [Generated from flex, 25 September 1996] |
5 | */ |
6 | |
7 | #if !defined(__CC_NORCROFT) || !defined(__arm) |
8 | #error You must use the Norcroft ARM Compiler for Sapphire programs |
9 | #endif |
10 | |
11 | #pragma include_only_once |
12 | #pragma force_top_level |
13 | |
14 | #ifndef __flex_h |
15 | #define __flex_h |
16 | |
17 | #ifndef __sapphire_h |
18 | #include "sapphire.h" |
19 | #endif |
20 | |
21 | /*----- Overview ----------------------------------------------------------* |
22 | * |
23 | * Functions provided: |
24 | * |
25 | * flex_reduce |
26 | * flex_compact |
27 | * flex_free |
28 | * flex_alloc |
29 | * flex_size |
30 | * flex_extend |
31 | * flex_midExtend |
32 | * flex_init |
33 | * flex_stackPtr |
34 | * flex_save |
35 | * flex_load |
36 | * flex_dump |
37 | * |
38 | * Macros provided: |
39 | * |
40 | * FSAVE |
41 | * FLOAD |
42 | */ |
43 | |
44 | /* --- flex_reduce --- * |
45 | * |
46 | * On entry: -- |
47 | * |
48 | * On exit: -- |
49 | * |
50 | * Use: Compacts the flex heap by one iteration. |
51 | */ |
52 | |
53 | extern routine flex_reduce; |
54 | |
55 | /* --- flex_compact --- * |
56 | * |
57 | * On entry: -- |
58 | * |
59 | * On exit: -- |
60 | * |
61 | * Use: Completely compacts the flex heap. |
62 | */ |
63 | |
64 | extern routine flex_compact; |
65 | |
66 | /* --- flex_free --- * |
67 | * |
68 | * On entry: R0 == pointer to the flex anchor |
69 | * |
70 | * On exit: -- |
71 | * |
72 | * Use: Frees a flex block allocated by flex_alloc. |
73 | */ |
74 | |
75 | extern routine flex_free; |
76 | |
77 | /* --- flex_alloc --- * |
78 | * |
79 | * On entry: R0 == pointer to a flex anchor |
80 | * R1 == desired size of flex block |
81 | * |
82 | * On exit: CS if no memory could be allocated, CC otherwise |
83 | * |
84 | * Use: Allocates a block in the shifting heap. |
85 | */ |
86 | |
87 | extern routine flex_alloc; |
88 | |
89 | /* --- flex_size --- * |
90 | * |
91 | * On entry: R0 == pointer to flex anchor |
92 | * |
93 | * On exit: R0 == size of allocated block |
94 | * |
95 | * Use: Reads the size of a flex block. |
96 | */ |
97 | |
98 | extern routine flex_size; |
99 | |
100 | /* --- flex_extend --- * |
101 | * |
102 | * On entry: R0 == pointer to flex anchor |
103 | * R1 == new size of block to set |
104 | * |
105 | * On exit: CS if it failed due to lack of memory, CC otherwise |
106 | * |
107 | * Use: Alters the size of a block to the given value. |
108 | */ |
109 | |
110 | extern routine flex_extend; |
111 | |
112 | /* --- flex_midExtend --- * |
113 | * |
114 | * On entry: R0 == pointer to a flex anchor |
115 | * R1 == `at' -- position in block to extend from |
116 | * R2 == `by' -- how many bytes to extend (may be -ve) |
117 | * |
118 | * On exit: CS if it failed due to lack of memory, CC otherwise |
119 | * |
120 | * Use: Either creates a gap in a block (by>0) or deletes bytes |
121 | * from a block. This is always done in such a way that the |
122 | * byte originally at offset `at' is now at offset `at'+`by'. |
123 | */ |
124 | |
125 | extern routine flex_midExtend; |
126 | |
127 | /* --- flex_init --- * |
128 | * |
129 | * On entry: -- |
130 | * |
131 | * On exit: -- |
132 | * |
133 | * Use: Initialises the flex heap for use. |
134 | */ |
135 | |
136 | extern routine flex_init; |
137 | |
138 | /* --- flex_stackPtr --- * |
139 | * |
140 | * On entry: R0 == 0 to read, or value to set |
141 | * |
142 | * On exit: R0 == old value |
143 | * |
144 | * Use: Either reads or writes the flex stack pointer. This sort |
145 | * of thing is useful in exception handlers etc. |
146 | */ |
147 | |
148 | extern routine flex_stackPtr; |
149 | |
150 | /* --- flex_save --- * |
151 | * |
152 | * On entry: -- |
153 | * |
154 | * On exit: -- |
155 | * |
156 | * Use: Saves some registers on the flex relocation stack. R13 |
157 | * and R14 cannot be saved -- these registers are corrupted |
158 | * during this routine's execution. |
159 | * |
160 | * Values saved on the flex relocation stack are adjusted as |
161 | * flex moves blocks of memory around, so that they still point |
162 | * to the same thing as they did before. Obviously, values |
163 | * which aren't pointers into flex blocks may be corrupted. |
164 | * Values pointing to objects deleted (either free blocks, or |
165 | * areas removed by flex_midExtend) may also be corrupted. |
166 | * |
167 | * Since this routine takes no arguments, some other method has |
168 | * to be used. The method chosen is to follow the call to |
169 | * flex_save with a LDM or STM instruction containing the |
170 | * registers to be saved. This instruction is skipped by the |
171 | * routine, and thus not executed. |
172 | * |
173 | * Note that if you give the LDM or STM the same condition code |
174 | * as the BL preceding it, it will never be executed, since |
175 | * flex_save skips it if the condition is true and it can't be |
176 | * executed if the condition is false. |
177 | */ |
178 | |
179 | extern routine flex_save; |
180 | |
181 | /* --- flex_load --- * |
182 | * |
183 | * On entry: -- |
184 | * |
185 | * On exit: Registers loaded from relocation stack as requested |
186 | * |
187 | * Use: Restores registers saved on flex's relocation stack. See |
188 | * flex_save for calling information and details about the |
189 | * relocation stack. |
190 | */ |
191 | |
192 | extern routine flex_load; |
193 | |
194 | /*----- Useful macros -----------------------------------------------------*/ |
195 | |
196 | /* --- Macro: FSAVE --- * |
197 | * |
198 | * Arguments: rList == quoted register list to save on relocation stack |
199 | * |
200 | * Use: Assembles code to write the given register list on the |
201 | * flex relocation stack. The register list should be in the |
202 | * same form as that for an STM or LDM instruction. |
203 | * |
204 | * For full details about the flex relocation stack, see |
205 | * flex_save. |
206 | */ |
207 | |
208 | /* --- Macro: FLOAD --- * |
209 | * |
210 | * Arguments: rList == quoted register list to read from relocation stack |
211 | * |
212 | * Use: Assembles code to read the given register list from the |
213 | * flex relocation stack. The register list should be in the |
214 | * same form as that for an STM or LDM instruction. |
215 | * |
216 | * For full details about the flex relocation stack, see |
217 | * flex_save. |
218 | */ |
219 | |
220 | /*----- That's all, folks -------------------------------------------------*/ |
221 | |
222 | #endif |