Rev 2664 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2664 | Rev 2665 | ||
---|---|---|---|
Line 10... | Line 10... | ||
10 | cmp edi,[display_buffer] |
10 | cmp edi,[display_buffer] |
11 | jae out_of_memory |
11 | jae out_of_memory |
12 | mov eax,edi |
12 | mov eax,edi |
13 | sub eax,ebx |
13 | sub eax,ebx |
14 | mov [ebx-38h+0Ch],eax |
14 | mov [ebx-40h+0Ch],eax |
15 | mov esi,[output_file] |
15 | mov esi,[output_file] |
16 | call copy_asciiz |
16 | call copy_asciiz |
17 | cmp edi,[display_buffer] |
17 | cmp edi,[display_buffer] |
18 | jae out_of_memory |
18 | jae out_of_memory |
19 | mov edx,[symbols_stream] |
19 | mov edx,[symbols_stream] |
20 | mov ebp,[free_additional_memory] |
20 | mov ebp,[free_additional_memory] |
21 | mov [number_of_sections],0 |
21 | and [number_of_sections],0 |
22 | cmp [output_format],4 |
22 | cmp [output_format],4 |
23 | je prepare_strings_table |
23 | je prepare_strings_table |
24 | cmp [output_format],5 |
24 | cmp [output_format],5 |
25 | jne strings_table_ready |
25 | jne strings_table_ready |
26 | bt [format_flags],0 |
26 | bt [format_flags],0 |
27 | jc strings_table_ready |
27 | jc strings_table_ready |
Line 150... | Line 150... | ||
150 | jmp prepare_labels_dump |
150 | jmp prepare_labels_dump |
151 | labels_dump_ok: |
151 | labels_dump_ok: |
152 | mov eax,edi |
152 | mov eax,edi |
153 | sub eax,ebx |
153 | sub eax,ebx |
154 | mov [ebx-38h+14h],eax |
154 | mov [ebx-40h+14h],eax |
155 | add eax,38h |
155 | add eax,40h |
156 | mov [ebx-38h+18h],eax |
156 | mov [ebx-40h+18h],eax |
157 | mov ecx,[memory_end] |
157 | mov ecx,[memory_end] |
158 | sub ecx,[labels_list] |
158 | sub ecx,[labels_list] |
159 | mov [ebx-38h+1Ch],ecx |
159 | mov [ebx-40h+1Ch],ecx |
160 | add eax,ecx |
160 | add eax,ecx |
161 | mov [ebx-38h+20h],eax |
161 | mov [ebx-40h+20h],eax |
162 | mov ecx,[source_start] |
162 | mov ecx,[source_start] |
163 | sub ecx,[memory_start] |
163 | sub ecx,[memory_start] |
164 | mov [ebx-38h+24h],ecx |
164 | mov [ebx-40h+24h],ecx |
165 | add eax,ecx |
165 | add eax,ecx |
166 | mov [ebx-38h+28h],eax |
166 | mov [ebx-40h+28h],eax |
167 | mov eax,[number_of_sections] |
167 | mov eax,[number_of_sections] |
168 | shl eax,2 |
168 | shl eax,2 |
169 | mov [ebx-38h+34h],eax |
169 | mov [ebx-40h+34h],eax |
170 | call prepare_preprocessed_source |
170 | call prepare_preprocessed_source |
171 | mov esi,[labels_list] |
171 | mov esi,[labels_list] |
172 | mov ebp,edi |
172 | mov ebp,edi |
173 | make_lines_dump: |
173 | make_lines_dump: |
174 | cmp esi,[display_buffer] |
174 | cmp esi,[display_buffer] |
175 | je lines_dump_ok |
175 | je lines_dump_ok |
Line 177... | Line 177... | ||
177 | mov ecx,[esi-8] |
177 | mov ecx,[esi-8] |
178 | sub esi,8 |
178 | sub esi,8 |
179 | sub esi,ecx |
179 | sub esi,ecx |
180 | cmp eax,1 |
180 | cmp eax,1 |
181 | jne make_lines_dump |
181 | je process_line_dump |
- | 182 | cmp eax,2 |
|
- | 183 | jne make_lines_dump |
|
182 | mov eax,[esi+4] |
184 | add dword [ebx-40h+3Ch],8 |
- | 185 | jmp make_lines_dump |
|
- | 186 | process_line_dump: |
|
- | 187 | mov eax,[esi+4] |
|
183 | sub eax,[code_start] |
188 | sub eax,[code_start] |
184 | add eax,[headers_size] |
189 | add eax,[headers_size] |
185 | cmp byte [esi+1Ah],0 |
190 | cmp byte [esi+1Ah],0 |
186 | je store_offset |
191 | je store_offset |
187 | xor eax,eax |
192 | xor eax,eax |
Line 191... | Line 196... | ||
191 | sub eax,[memory_start] |
196 | sub eax,[memory_start] |
192 | stos dword [edi] |
197 | stos dword [edi] |
193 | mov eax,[esi+4] |
198 | mov eax,[esi+4] |
194 | xor edx,edx |
199 | xor edx,edx |
195 | sub eax,[esi+8] |
200 | xor cl,cl |
- | 201 | sub eax,[esi+8] |
|
196 | sbb edx,[esi+8+4] |
202 | sbb edx,[esi+8+4] |
197 | stos dword [edi] |
203 | sbb cl,[esi+1Bh] |
- | 204 | stos dword [edi] |
|
198 | mov eax,edx |
205 | mov eax,edx |
199 | stos dword [edi] |
206 | stos dword [edi] |
200 | mov eax,[esi+10h] |
207 | mov eax,[esi+10h] |
201 | stos dword [edi] |
208 | stos dword [edi] |
202 | mov eax,[esi+14h] |
209 | mov eax,[esi+14h] |
Line 208... | Line 215... | ||
208 | xor eax,eax |
215 | xor eax,eax |
209 | base_symbol_for_line_ok: |
216 | base_symbol_for_line_ok: |
210 | stos dword [edi] |
217 | stos dword [edi] |
211 | mov eax,[esi+18h] |
218 | mov eax,[esi+18h] |
212 | and eax,001FFFFh |
219 | and eax,01FFFFh |
213 | stos dword [edi] |
220 | stos dword [edi] |
214 | cmp edi,[display_buffer] |
221 | mov [edi-1],cl |
- | 222 | cmp edi,[display_buffer] |
|
215 | jae out_of_memory |
223 | jae out_of_memory |
216 | jmp make_lines_dump |
224 | mov eax,edi |
- | 225 | sub eax,1Ch |
|
- | 226 | sub eax,ebp |
|
- | 227 | mov [esi],eax |
|
- | 228 | jmp make_lines_dump |
|
217 | lines_dump_ok: |
229 | lines_dump_ok: |
218 | mov edx,edi |
230 | mov edx,edi |
219 | mov eax,[current_offset] |
231 | mov eax,[current_offset] |
220 | sub eax,[code_start] |
232 | sub eax,[code_start] |
221 | add eax,[headers_size] |
233 | add eax,[headers_size] |
222 | stos dword [edi] |
234 | stos dword [edi] |
223 | mov ecx,edi |
235 | mov ecx,edi |
224 | sub ecx,ebx |
236 | sub ecx,ebx |
225 | sub ecx,[ebx-38h+14h] |
237 | sub ecx,[ebx-40h+14h] |
226 | mov [ebx-38h+2Ch],ecx |
238 | mov [ebx-40h+2Ch],ecx |
227 | add ecx,[ebx-38h+28h] |
239 | add ecx,[ebx-40h+28h] |
228 | mov [ebx-38h+30h],ecx |
240 | mov [ebx-40h+30h],ecx |
229 | find_inexisting_offsets: |
241 | add ecx,[ebx-40h+34h] |
- | 242 | mov [ebx-40h+38h],ecx |
|
- | 243 | find_inexisting_offsets: |
|
230 | sub edx,1Ch |
244 | sub edx,1Ch |
231 | cmp edx,ebp |
245 | cmp edx,ebp |
232 | jb write_symbols |
246 | jb write_symbols |
233 | test byte [edx+1Ah],1 |
247 | test byte [edx+1Ah],1 |
234 | jnz find_inexisting_offsets |
248 | jnz find_inexisting_offsets |
Line 236... | Line 250... | ||
236 | jb correct_inexisting_offset |
250 | jb correct_inexisting_offset |
237 | mov eax,[edx] |
251 | mov eax,[edx] |
238 | jmp find_inexisting_offsets |
252 | jmp find_inexisting_offsets |
239 | correct_inexisting_offset: |
253 | correct_inexisting_offset: |
240 | mov dword [edx],0 |
254 | and dword [edx],0 |
241 | or byte [edx+1Ah],2 |
255 | or byte [edx+1Ah],2 |
242 | jmp find_inexisting_offsets |
256 | jmp find_inexisting_offsets |
243 | write_symbols: |
257 | write_symbols: |
244 | mov edx,[symbols_file] |
258 | mov edx,[symbols_file] |
245 | call create |
259 | call create |
246 | jc write_failed |
260 | jc write_failed |
247 | mov edx,[code_start] |
261 | mov edx,[code_start] |
248 | mov ecx,[edx+14h] |
262 | mov ecx,[edx+14h] |
249 | add ecx,38h |
263 | add ecx,40h |
250 | call write |
264 | call write |
251 | jc write_failed |
265 | jc write_failed |
252 | mov edx,[display_buffer] |
266 | mov edx,[display_buffer] |
253 | mov ecx,[memory_end] |
267 | mov ecx,[memory_end] |
254 | sub ecx,[labels_list] |
268 | sub ecx,[labels_list] |
255 | call write |
269 | call write |
Line 268... | Line 282... | ||
268 | mov ecx,[number_of_sections] |
282 | mov ecx,[number_of_sections] |
269 | shl ecx,2 |
283 | shl ecx,2 |
270 | call write |
284 | call write |
271 | jc write_failed |
285 | jc write_failed |
272 | call close |
286 | mov esi,[labels_list] |
- | 287 | mov edi,[memory_start] |
|
- | 288 | make_references_dump: |
|
- | 289 | cmp esi,[display_buffer] |
|
- | 290 | je references_dump_ok |
|
- | 291 | mov eax,[esi-4] |
|
- | 292 | mov ecx,[esi-8] |
|
- | 293 | sub esi,8 |
|
- | 294 | sub esi,ecx |
|
- | 295 | cmp eax,2 |
|
- | 296 | je dump_reference |
|
- | 297 | cmp eax,1 |
|
- | 298 | jne make_references_dump |
|
- | 299 | mov edx,[esi] |
|
- | 300 | jmp make_references_dump |
|
- | 301 | dump_reference: |
|
- | 302 | mov eax,[memory_end] |
|
- | 303 | sub eax,[esi] |
|
- | 304 | sub eax,LABEL_STRUCTURE_SIZE |
|
- | 305 | stosd |
|
- | 306 | mov eax,edx |
|
- | 307 | stosd |
|
- | 308 | cmp edi,[display_buffer] |
|
- | 309 | jb make_references_dump |
|
- | 310 | jmp out_of_memory |
|
- | 311 | references_dump_ok: |
|
- | 312 | mov edx,[memory_start] |
|
- | 313 | mov ecx,edi |
|
- | 314 | sub ecx,edx |
|
- | 315 | call write |
|
- | 316 | jc write_failed |
|
- | 317 | call close |
|
273 | ret |
318 | ret |
274 | setup_dump_header: |
319 | setup_dump_header: |
275 | xor eax,eax |
320 | xor eax,eax |
276 | mov ecx,38h shr 2 |
321 | mov ecx,40h shr 2 |
277 | rep stos dword [edi] |
322 | rep stos dword [edi] |
278 | mov ebx,edi |
323 | mov ebx,edi |
279 | mov dword [ebx-38h],'fas'+1Ah shl 24 |
324 | mov dword [ebx-40h],'fas'+1Ah shl 24 |
280 | mov dword [ebx-38h+4],VERSION_MAJOR + VERSION_MINOR shl 8 + 38h shl 16 |
325 | mov dword [ebx-40h+4],VERSION_MAJOR + VERSION_MINOR shl 8 + 40h shl 16 |
281 | mov dword [ebx-38h+10h],38h |
326 | mov dword [ebx-40h+10h],40h |
282 | ret |
327 | ret |
283 | prepare_preprocessed_source: |
328 | prepare_preprocessed_source: |
284 | mov esi,[memory_start] |
329 | mov esi,[memory_start] |
285 | mov ebp,[source_start] |
330 | mov ebp,[source_start] |
286 | test ebp,ebp |
331 | test ebp,ebp |
287 | jnz prepare_preprocessed_line |
332 | jnz prepare_preprocessed_line |
Line 363... | Line 408... | ||
363 | jae out_of_memory |
408 | jae out_of_memory |
364 | mov eax,edi |
409 | mov eax,edi |
365 | sub eax,ebx |
410 | sub eax,ebx |
366 | dec eax |
411 | dec eax |
367 | mov [ebx-38h+0Ch],eax |
412 | mov [ebx-40h+0Ch],eax |
368 | mov eax,edi |
413 | mov eax,edi |
369 | sub eax,ebx |
414 | sub eax,ebx |
370 | mov [ebx-38h+14h],eax |
415 | mov [ebx-40h+14h],eax |
371 | add eax,38h |
416 | add eax,40h |
372 | mov [ebx-38h+20h],eax |
417 | mov [ebx-40h+20h],eax |
373 | call prepare_preprocessed_source |
418 | call prepare_preprocessed_source |
374 | sub esi,[memory_start] |
419 | sub esi,[memory_start] |
375 | mov [ebx-38h+24h],esi |
420 | mov [ebx-40h+24h],esi |
376 | mov edx,[symbols_file] |
421 | mov edx,[symbols_file] |
377 | call create |
422 | call create |
378 | jc write_failed |
423 | jc write_failed |
379 | mov edx,[free_additional_memory] |
424 | mov edx,[free_additional_memory] |
380 | mov ecx,[edx+14h] |
425 | mov ecx,[edx+14h] |
381 | add ecx,38h |
426 | add ecx,40h |
382 | call write |
427 | call write |
383 | jc write_failed |
428 | jc write_failed |
384 | mov edx,[memory_start] |
429 | mov edx,[memory_start] |
385 | mov ecx,esi |
430 | mov ecx,esi |
386 | call write |
431 | call write |
387 | jc write_failed |
432 | jc write_failed |