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