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