https://github.com/akkartik/mu/blob/master/056trace.subx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 == data
16
17
18 Trace-stream:
19 0/imm32
20
21 Trace-segment:
22 0/imm32/curr
23 0/imm32/limit
24
25
26
27 _test-trace-stream:
28
29 0/imm32
30
31 0/imm32
32
33 8/imm32
34
35 00 00 00 00 00 00 00 00
36
37 == code
38
39
40
41
42
43
44 initialize-trace-stream:
45
46 55/push-ebp
47 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
48
49 50/push-eax
50 51/push-ecx
51
52 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 .
53
54
55 68/push Trace-segment/imm32
56 51/push-ecx
57
58 e8/call new-segment/disp32
59
60 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
61
62 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-segment/disp32
63
64
65 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
66
67
68 81 5/subop/subtract 3/mod/direct 1/rm32/ecx . . . . . 0xc/imm32
69
70 89/copy 1/mod/*+disp8 0/rm32/eax . . . 1/r32/ecx 8/disp8 .
71 $initialize-trace-stream:end:
72
73 59/pop-to-ecx
74 58/pop-to-eax
75
76 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
77 5d/pop-to-ebp
78 c3/return
79
80
81
82 trace:
83
84 55/push-ebp
85 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
86
87 50/push-eax
88 51/push-ecx
89 52/push-edx
90 53/push-ebx
91 56/push-esi
92 57/push-edi
93
94 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 7/r32/edi Trace-stream/disp32
95
96 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 6/r32/esi 8/disp8 .
97
98 8b/copy 0/mod/indirect 7/rm32/edi . . . 1/r32/ecx . .
99
100 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 2/r32/edx 8/disp8 .
101
102
103 56/push-esi
104
105 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 2/index/edx . 3/r32/ebx 0xc/disp8 .
106 53/push-ebx
107
108 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 1/index/ecx . 3/r32/ebx 0xc/disp8 .
109 53/push-ebx
110
111 e8/call _append-3/disp32
112
113 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
114
115 3d/compare-eax-and 0/imm32
116 74/jump-if-equal $trace:end/disp8
117
118 01/add 0/mod/indirect 7/rm32/edi . . . 0/r32/eax . .
119
120 8b/copy 0/mod/indirect 7/rm32/edi . . . 1/r32/ecx . .
121
122
123 68/push Newline/imm32
124
125 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 2/index/edx . 3/r32/ebx 0xc/disp8 .
126 53/push-ebx
127
128 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 1/index/ecx . 3/r32/ebx 0xc/disp8 .
129 53/push-ebx
130
131 e8/call _append-3/disp32
132
133 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
134
135 01/add 0/mod/indirect 7/rm32/edi . . . 0/r32/eax . .
136 $trace:end:
137
138 5f/pop-to-edi
139 5e/pop-to-esi
140 5b/pop-to-ebx
141 5a/pop-to-edx
142 59/pop-to-ecx
143 58/pop-to-eax
144
145 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
146 5d/pop-to-ebp
147 c3/return
148
149 test-trace-single:
150
151 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
152
153 b8/copy-to-eax _test-trace-stream/imm32
154 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
155
156 e8/call clear-trace-stream/disp32
157
158
159 68/push "Ab"/imm32
160
161 e8/call trace/disp32
162
163 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
164
165
166 68/push "F - test-trace-single"/imm32
167 68/push 0x0a6241/imm32/Ab-newline
168
169 b8/copy-to-eax _test-trace-stream/imm32
170 ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 0xc/disp8 .
171
172 e8/call check-ints-equal/disp32
173
174 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
175
176 8f 0/subop/pop 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
177
178 c3/return
179
180 test-trace-appends:
181
182 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
183
184 b8/copy-to-eax _test-trace-stream/imm32
185 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
186
187 e8/call clear-trace-stream/disp32
188
189
190 68/push "C"/imm32
191
192 e8/call trace/disp32
193
194 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
195
196
197 68/push "D"/imm32
198
199 e8/call trace/disp32
200
201 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
202
203
204 68/push "F - test-trace-appends"/imm32
205 68/push 0x0a440a43/imm32/C-newline-D-newline
206
207 b8/copy-to-eax _test-trace-stream/imm32
208 ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 0xc/disp8 .
209
210 e8/call check-ints-equal/disp32
211
212 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
213
214 8f 0/subop/pop 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
215
216 c3/return
217
218 test-trace-empty-line:
219
220 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
221
222 b8/copy-to-eax _test-trace-stream/imm32
223 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
224
225 e8/call clear-trace-stream/disp32
226
227
228 68/push ""/imm32
229
230 e8/call trace/disp32
231
232 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
233
234
235 68/push "F - test-trace-empty-line"/imm32
236 68/push 0/imm32
237
238 b8/copy-to-eax _test-trace-stream/imm32
239 ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 0xc/disp8 .
240
241 e8/call check-ints-equal/disp32
242
243 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
244
245 8f 0/subop/pop 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
246
247 c3/return
248
249 check-trace-contains:
250
251 55/push-ebp
252 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
253
254
255 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
256
257 e8/call rewind-stream/disp32
258
259 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
260
261
262 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
263 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
264
265 e8/call check-trace-scans-to/disp32
266
267 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
268 $check-trace-contains:end:
269
270 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
271 5d/pop-to-ebp
272 c3/return
273
274 check-trace-scans-to:
275
276 55/push-ebp
277 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
278
279 50/push-eax
280
281
282 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
283
284 e8/call trace-scan/disp32
285
286 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
287
288
289 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
290 68/push 1/imm32
291 50/push-eax
292
293 e8/call check-ints-equal/disp32
294
295 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
296 $check-trace-scans-to:end:
297
298 58/pop-to-eax
299
300 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
301 5d/pop-to-ebp
302 c3/return
303
304
305 trace-scan:
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320 55/push-ebp
321 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
322
323 51/push-ecx
324 56/push-esi
325
326 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 6/r32/esi Trace-stream/disp32
327
328 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx .
329
330 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
331 $trace-scan:loop:
332
333 39/compare 1/mod/*+disp8 6/rm32/esi . . . 1/r32/ecx 4/disp8 .
334 7d/jump-if-greater-or-equal $trace-scan:false/disp8
335
336
337 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
338 56/push-esi
339
340 e8/call next-line-matches?/disp32
341
342 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
343
344 3d/compare-eax-and 0/imm32
345 74/jump-if-equal $trace-scan:continue/disp8
346 $trace-scan:true:
347
348
349 56/push-esi
350
351 e8/call skip-next-line/disp32
352
353 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
354
355 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
356
357 b8/copy-to-eax 1/imm32/true
358 eb/jump $trace-scan:end/disp8
359 $trace-scan:continue:
360
361
362 56/push-esi
363
364 e8/call skip-next-line/disp32
365
366 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
367 eb/jump $trace-scan:loop/disp8
368 $trace-scan:false:
369
370 8f 0/subop/pop 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
371
372 b8/copy-to-eax 0/imm32/false
373 $trace-scan:end:
374
375 59/pop-to-ecx
376
377 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
378 5d/pop-to-ebp
379 c3/return
380
381 test-trace-scan-first:
382
383 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
384
385
386 b8/copy-to-eax _test-trace-stream/imm32
387 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
388
389 e8/call clear-trace-stream/disp32
390
391
392 68/push "Ab"/imm32
393
394 e8/call trace/disp32
395
396 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
397
398
399 68/push "Ab"/imm32
400
401 e8/call trace-scan/disp32
402
403 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
404
405
406 68/push "F - test-trace-scan-first"/imm32
407 68/push 1/imm32
408 50/push-eax
409
410 e8/call check-ints-equal/disp32
411
412 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
413
414 8f 0/subop/pop 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
415
416 c3/return
417
418 test-trace-scan-skips-lines-until-found:
419
420 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
421
422
423 b8/copy-to-eax _test-trace-stream/imm32
424 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
425
426 e8/call clear-trace-stream/disp32
427
428
429 68/push "Ab"/imm32
430
431 e8/call trace/disp32
432
433 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
434
435
436 68/push "cd"/imm32
437
438 e8/call trace/disp32
439
440 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
441
442
443 68/push "cd"/imm32
444
445 e8/call trace-scan/disp32
446
447 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
448
449
450 68/push "F - test-trace-scan-skips-lines-until-found"/imm32
451 68/push 1/imm32
452 50/push-eax
453
454 e8/call check-ints-equal/disp32
455
456 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
457
458 8f 0/subop/pop 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
459
460 c3/return
461
462 test-trace-second-scan-starts-where-first-left-off:
463
464 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
465
466
467 b8/copy-to-eax _test-trace-stream/imm32
468 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
469
470 e8/call clear-trace-stream/disp32
471
472
473 68/push "Ab"/imm32
474
475 e8/call trace/disp32
476
477 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
478
479
480 68/push "Ab"/imm32
481
482 e8/call trace-scan/disp32
483
484 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
485
486
487
488 68/push "Ab"/imm32
489
490 e8/call trace-scan/disp32
491
492 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
493
494
495 68/push "F - test-trace-second-scan-starts-where-first-left-off"/imm32
496 68/push 0/imm32
497 50/push-eax
498
499 e8/call check-ints-equal/disp32
500
501 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
502
503 8f 0/subop/pop 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
504
505 c3/return
506
507 test-trace-scan-failure-leaves-read-index-untouched:
508
509 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
510
511
512 b8/copy-to-eax _test-trace-stream/imm32
513 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
514
515 e8/call clear-trace-stream/disp32
516
517
518 68/push "Ab"/imm32
519
520 e8/call trace/disp32
521
522 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
523
524
525 68/push "F - test-trace-second-scan-starts-where-first-left-off/precondition-failure"/imm32
526 68/push 0/imm32
527 b8/copy-to-eax _test-trace-stream/imm32
528 ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 .
529
530 e8/call check-ints-equal/disp32
531
532 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
533
534
535
536 68/push "Ax"/imm32
537
538 e8/call trace-scan/disp32
539
540 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
541
542
543
544 68/push "F - test-trace-second-scan-starts-where-first-left-off"/imm32
545 68/push 0/imm32
546 b8/copy-to-eax _test-trace-stream/imm32
547 ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 .
548
549 e8/call check-ints-equal/disp32
550
551 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
552
553 8f 0/subop/pop 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
554
555 c3/return
556
557 next-line-matches?:
558
559
560
561
562
563
564
565
566
567
568 55/push-ebp
569 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
570
571 51/push-ecx
572 52/push-edx
573 53/push-ebx
574 56/push-esi
575 57/push-edi
576
577 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 2/r32/edx 0xc/disp8 .
578
579
580 8d/copy-address 1/mod/*+disp8 2/rm32/edx . . . 6/r32/esi 4/disp8 .
581
582
583 8b/copy 0/mod/indirect 2/rm32/edx . . 0/r32/eax . .
584
585 8d/copy-address 0/mod/indirect 4/rm32/sib 6/base/esi 0/index/eax . 1/r32/ecx . .
586
587 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 7/r32/edi 8/disp8 .
588
589 8d/copy-address 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 0xc/disp8 .
590
591
592 8b/copy 0/mod/indirect 7/rm32/edi . . 0/r32/eax . .
593
594 8d/copy-address 0/mod/indirect 4/rm32/sib 3/base/ebx 0/index/eax . 2/r32/edx . .
595
596
597 8b/copy 1/mod/*+disp8 7/rm32/edi . . 0/r32/eax 4/disp8 .
598
599 8d/copy-address 0/mod/indirect 4/rm32/sib 3/base/ebx 0/index/eax . 7/r32/edi . .
600 $next-line-matches?:loop:
601
602 39/compare 3/mod/direct 6/rm32/esi . . . 1/r32/ecx . .
603 73/jump-if-greater-or-equal-unsigned $next-line-matches?:break/disp8
604
605
606 b8/copy-to-eax 0/imm32/false
607 39/compare 3/mod/direct 7/rm32/edi . . . 2/r32/edx . .
608 73/jump-if-greater-or-equal-unsigned $next-line-matches?:end/disp8
609
610 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
611 31/xor 3/mod/direct 3/rm32/eax . . . 3/r32/eax . .
612
613 8a/copy-byte 0/mod/indirect 7/rm32/edi . . 0/r32/eax . .
614
615 8a/copy-byte 0/mod/indirect 6/rm32/esi . . 3/r32/ebx . .
616
617 39/compare 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
618
619 b8/copy-to-eax 0/imm32/false
620 75/jump-if-not-equal $next-line-matches?:end/disp8
621
622 47/increment-edi
623
624 46/increment-esi
625 eb/jump $next-line-matches?:loop/disp8
626 $next-line-matches?:break:
627
628 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
629
630 8a/copy-byte 0/mod/indirect 7/rm32/edi . . 0/r32/eax . .
631 3d/compare-eax-and 0xa/imm32/newline
632
633 b8/copy-to-eax 1/imm32/true
634 74/jump-if-equal $next-line-matches?:end/disp8
635 b8/copy-to-eax 0/imm32/true
636 $next-line-matches?:end:
637
638 5f/pop-to-edi
639 5e/pop-to-esi
640 5b/pop-to-ebx
641 5a/pop-to-edx
642 59/pop-to-ecx
643
644 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
645 5d/pop-to-ebp
646 c3/return
647
648 test-next-line-matches?-no-match-1:
649
650
651
652 68/push "blah blah"/imm32
653 68/push _test-stream-line-ABABA/imm32
654
655 e8/call next-line-matches?/disp32
656
657 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
658
659
660 68/push "F - test-next-line-matches?-no-match-1"/imm32
661 68/push 0/imm32
662 50/push-eax
663
664 e8/call check-ints-equal/disp32
665
666 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
667 c3/return
668
669 test-next-line-matches?-no-match-2:
670
671
672
673 68/push ""/imm32
674 68/push _test-stream-line-ABABA/imm32
675
676 e8/call next-line-matches?/disp32
677
678 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
679
680
681 68/push "F - test-next-line-matches?-no-match-2"/imm32
682 68/push 0/imm32
683 50/push-eax
684
685 e8/call check-ints-equal/disp32
686
687 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
688 c3/return
689
690 test-next-line-matches?-no-match-3:
691
692
693
694 68/push "AA"/imm32
695 68/push _test-stream-line-ABABA/imm32
696
697 e8/call next-line-matches?/disp32
698
699 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
700
701
702 68/push "F - test-next-line-matches?-no-match-3"/imm32
703 68/push 0/imm32
704 50/push-eax
705
706 e8/call check-ints-equal/disp32
707
708 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
709 c3/return
710
711 test-next-line-matches?-match:
712
713
714
715 68/push "ABABA"/imm32
716 68/push _test-stream-line-ABABA/imm32
717
718 e8/call next-line-matches?/disp32
719
720 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
721
722
723 68/push "F - test-next-line-matches?-match"/imm32
724 68/push 1/imm32
725 50/push-eax
726
727 e8/call check-ints-equal/disp32
728
729 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
730 c3/return
731
732
733 skip-next-line:
734
735
736
737
738
739
740
741
742
743
744
745
746 55/push-ebp
747 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
748
749 50/push-eax
750 51/push-ecx
751 52/push-edx
752 53/push-ebx
753
754 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 8/disp8 .
755
756 8d/copy-address 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 0xc/disp8 .
757
758 8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . .
759
760 8d/copy-address 0/mod/indirect 4/rm32/sib 2/base/edx 0/index/eax . 3/r32/ebx . .
761
762 8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 0/r32/eax 4/disp8 .
763
764 8d/copy-address 0/mod/indirect 4/rm32/sib 2/base/edx 0/index/eax . 1/r32/ecx . .
765
766 8b/copy 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
767 $skip-next-line:loop:
768
769 39/compare 3/mod/direct 1/rm32/ecx . . . 3/r32/ebx . .
770 73/jump-if-greater-or-equal-unsigned $skip-next-line:end/disp8
771
772 42/increment-edx
773
774 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
775 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . .
776 3d/compare-eax-and 0a/imm32/newline
777 74/jump-if-equal $skip-next-line:end/disp8
778
779 41/increment-ecx
780
781 eb/jump $skip-next-line:loop/disp8
782 $skip-next-line:end:
783
784 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 8/disp8 .
785
786 89/copy 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 4/disp8 .
787
788 5b/pop-to-ebx
789 5a/pop-to-edx
790 59/pop-to-ecx
791 58/pop-to-eax
792
793 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
794 5d/pop-to-ebp
795 c3/return
796
797 test-skip-next-line-empty:
798
799
800
801 68/push _test-stream-empty/imm32
802
803 e8/call skip-next-line/disp32
804
805 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
806
807
808 68/push "F - test-skip-next-line-empty"/imm32
809 68/push 0/imm32
810 b8/copy-to-eax _test-stream-empty/imm32
811 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 0/r32/eax 4/disp8 .
812 50/push-eax
813
814 e8/call check-ints-equal/disp32
815
816 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
817 c3/return
818
819 test-skip-next-line-filled:
820
821
822
823 68/push _test-stream-filled/imm32
824
825 e8/call skip-next-line/disp32
826
827 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
828
829
830 68/push "F - test-skip-next-line-filled"/imm32
831 68/push 5/imm32
832 b8/copy-to-eax _test-stream-filled/imm32
833 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 0/r32/eax 4/disp8 .
834 50/push-eax
835
836 e8/call check-ints-equal/disp32
837
838 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
839 c3/return
840
841 clear-trace-stream:
842
843 55/push-ebp
844 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
845
846 50/push-eax
847 51/push-ecx
848
849 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
850
851 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 1/r32/ecx 8/disp8 .
852
853 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 0xc/disp8 .
854
855 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
856
857 c7 0/subop/copy 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 0/imm32
858
859 81 0/subop/add 3/mod/direct 0/rm32/eax . . . . . 0xc/imm32
860 $clear-trace-stream:loop:
861
862 39/compare 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . .
863 73/jump-if-greater-or-equal-unsigned $clear-trace-stream:end/disp8
864
865 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
866
867 81 0/subop/add 3/mod/direct 0/rm32/eax . . . . . 4/imm32
868 eb/jump $clear-trace-stream:loop/disp8
869 $clear-trace-stream:end:
870
871 59/pop-to-ecx
872 58/pop-to-eax
873
874 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
875 5d/pop-to-ebp
876 c3/return
877
878
879
880
881 _append-3:
882
883 55/push-ebp
884 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
885
886 51/push-ecx
887
888
889 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 0/r32/eax 0x10/disp8 .
890 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
891 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
892 51/push-ecx
893
894 8d/copy-address 1/mod/*+disp8 0/rm32/eax . . . 1/r32/ecx 4/disp8 .
895 51/push-ecx
896
897 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
898
899 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
900
901 e8/call _append-4/disp32
902
903 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
904 $_append-3:end:
905
906 59/pop-to-ecx
907
908 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
909 5d/pop-to-ebp
910 c3/return
911
912
913 _append-4:
914
915 55/push-ebp
916 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
917
918 51/push-ecx
919 52/push-edx
920 53/push-ebx
921 56/push-esi
922 57/push-edi
923
924 b8/copy-to-eax 0/imm32
925
926 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 8/disp8 .
927
928 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 2/r32/edx 0xc/disp8 .
929
930 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0x10/disp8 .
931
932 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 0x14/disp8 .
933 $_append-4:loop:
934
935 39/compare 3/mod/direct 6/rm32/esi . . . 1/r32/ecx . .
936 73/jump-if-greater-or-equal-unsigned $_append-4:end/disp8
937
938 39/compare 3/mod/direct 7/rm32/edi . . . 2/r32/edx . .
939 73/jump-if-greater-or-equal-unsigned $_append-4:abort/disp8
940
941 8a/copy-byte 0/mod/indirect 6/rm32/esi . . . 3/r32/BL . .
942 88/copy-byte 0/mod/indirect 7/rm32/edi . . . 3/r32/BL . .
943
944 40/increment-eax
945
946 46/increment-esi
947
948 47/increment-edi
949 eb/jump $_append-4:loop/disp8
950 $_append-4:end:
951
952 5f/pop-to-edi
953 5e/pop-to-esi
954 5b/pop-to-ebx
955 5a/pop-to-edx
956 59/pop-to-ecx
957
958 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
959 5d/pop-to-ebp
960 c3/return
961
962 $_append-4:abort:
963
964
965 68/push "stream overflow\n"/imm32
966 68/push 2/imm32/stderr
967
968 e8/call _write/disp32
969
970 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
971
972 bb/copy-to-ebx 1/imm32
973 b8/copy-to-eax 1/imm32/exit
974 cd/syscall 0x80/imm8
975
976
977 == data
978
979 _test-stream-line-ABABA:
980
981 8/imm32
982
983 0/imm32
984
985 8/imm32
986
987 41 42 41 42 41 0a 00 00
988
989 _test-stream-empty:
990
991 0/imm32
992
993 0/imm32
994
995 8/imm32
996
997 00 00 00 00 00 00 00 00
998
999 _test-stream-filled:
1000
1001 8/imm32
1002
1003 0/imm32
1004
1005 8/imm32
1006
1007 41 41 41 41 0a 41 41 41
1008
1009