https://github.com/akkartik/mu/blob/master/apps/survey.subx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 == code
40
41
42
43
44 Entry:
45
46 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
47
48
49
50 68/push Heap/imm32
51 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Heap-size/disp32
52
53 e8/call new-segment/disp32
54
55 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
56
57
58 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-size/disp32
59
60 e8/call initialize-trace-stream/disp32
61
62 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
63
64
65
66 81 7/subop/compare 1/mod/*+disp8 5/rm32/ebp . . . . 0/disp8 1/imm32
67 7e/jump-if-<= $subx-survey-main:interactive/disp8
68
69
70
71 68/push "test"/imm32
72 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
73
74 e8/call kernel-string-equal?/disp32
75
76 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
77
78 3d/compare-eax-and 0/imm32/false
79 74/jump-if-= $subx-survey-main:interactive/disp8
80
81 e8/call run-tests/disp32
82
83 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32
84 eb/jump $subx-survey-main:end/disp8
85 $subx-survey-main:interactive:
86
87
88
89 68/push Stdout/imm32
90 68/push Stdin/imm32
91
92 e8/call subx-survey/disp32
93
94 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
95
96
97
98
99
100
101
102
103
104 bb/copy-to-ebx 0/imm32
105 $subx-survey-main:end:
106 e8/call syscall_exit/disp32
107
108
109
110
111
112
113
114
115 subx-survey:
116
117
118
119
120
121
122
123
124
125
126
127 55/push-ebp
128 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
129
130 51/push-ecx
131 52/push-edx
132 56/push-esi
133
134 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc8/imm32
135 68/push 0xc8/imm32/size
136 68/push 0/imm32/read
137 68/push 0/imm32/write
138 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
139
140
141 2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Max-labels/disp32
142
143 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Max-labels/disp32
144
145 68/push 0/imm32/read
146
147 68/push 0/imm32/write
148 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
149
150
151 2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Input-size/disp32
152
153 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Input-size/disp32
154
155 68/push 0/imm32/read
156
157 68/push 0/imm32/write
158 89/copy 3/mod/direct 6/rm32/esi . . . 4/r32/esp . .
159
160
161 56/push-esi
162 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
163
164 e8/call slurp/disp32
165
166 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
167
168
169 52/push-edx
170 51/push-ecx
171 56/push-esi
172
173 e8/call compute-offsets/disp32
174
175 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
176
177
178 52/push-edx
179 51/push-ecx
180
181 e8/call compute-addresses/disp32
182
183 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
184
185
186 56/push-esi
187
188 e8/call rewind-stream/disp32
189
190 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
191
192
193 52/push-edx
194 51/push-ecx
195 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
196 56/push-esi
197
198 e8/call emit-output/disp32
199
200 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
201
202
203 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
204
205 e8/call flush/disp32
206
207 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
208 $subx-survey:end:
209
210 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xec/imm32
211 03/add 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Max-labels/disp32
212 03/add 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Input-size/disp32
213
214 5e/pop-to-esi
215 5a/pop-to-edx
216 59/pop-to-ecx
217
218 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
219 5d/pop-to-ebp
220 c3/return
221
222 test-subx-survey-computes-addresses:
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238 55/push-ebp
239 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
240
241
242
243 68/push _test-input-stream/imm32
244
245 e8/call clear-stream/disp32
246
247 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
248
249
250 68/push $_test-input-buffered-file->buffer/imm32
251
252 e8/call clear-stream/disp32
253
254 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
255
256
257 68/push _test-output-stream/imm32
258
259 e8/call clear-stream/disp32
260
261 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
262
263
264 68/push $_test-output-buffered-file->buffer/imm32
265
266 e8/call clear-stream/disp32
267
268 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
269
270
271
272 68/push "== code 0x1\n"/imm32
273 68/push _test-input-stream/imm32
274
275 e8/call write/disp32
276
277 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
278
279
280 68/push "Entry:\n"/imm32
281 68/push _test-input-stream/imm32
282
283 e8/call write/disp32
284
285 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
286
287
288 68/push "ab x/imm32\n"/imm32
289 68/push _test-input-stream/imm32
290
291 e8/call write/disp32
292
293 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
294
295
296 68/push "== data 0x1000\n"/imm32
297 68/push _test-input-stream/imm32
298
299 e8/call write/disp32
300
301 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
302
303
304 68/push "x:\n"/imm32
305 68/push _test-input-stream/imm32
306
307 e8/call write/disp32
308
309 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
310
311
312 68/push "01\n"/imm32
313 68/push _test-input-stream/imm32
314
315 e8/call write/disp32
316
317 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
318
319
320 68/push _test-output-buffered-file/imm32
321 68/push _test-input-buffered-file/imm32
322
323 e8/call subx-survey/disp32
324
325 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
326
327 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
353
354
355 68/push "F - test-subx-survey-computes-addresses/0"/imm32
356 68/push "label 'x' is at address 0x00001079."/imm32
357
358 e8/call check-trace-contains/disp32
359
360 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
361
362
363 68/push "F - test-subx-survey-computes-addresses/1"/imm32
364 68/push "segment 'code' starts at address 0x00000074."/imm32
365
366 e8/call check-trace-contains/disp32
367
368 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
369
370
371 68/push "F - test-subx-survey-computes-addresses/2"/imm32
372 68/push "segment 'code' has size 0x00000005."/imm32
373
374 e8/call check-trace-contains/disp32
375
376 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
377
378
379 68/push "F - test-subx-survey-computes-addresses/3"/imm32
380 68/push "segment 'data' starts at address 0x00001079."/imm32
381
382 e8/call check-trace-contains/disp32
383
384 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
385
386 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
387 5d/pop-to-ebp
388 c3/return
389
390
391 == data
392
393 compute-offsets:file-offset:
394 0/imm32
395 compute-offsets:segment-offset:
396 0/imm32
397 compute-offsets:segment-tmp:
398 0/imm32/start
399 0/imm32/end
400
401 == code
402
403
404
405
406
407 compute-offsets:
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468 55/push-ebp
469 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
470
471 50/push-eax
472 51/push-ecx
473 52/push-edx
474 53/push-ebx
475 56/push-esi
476 57/push-edi
477
478 68/push 0/imm32
479 68/push 0/imm32
480 89/copy 3/mod/direct 6/rm32/esi . . . 4/r32/esp . .
481
482 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:file-offset/disp32 0/imm32
483
484 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:segment-offset/disp32 0/imm32
485
486 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32
487 68/push 0x200/imm32/size
488 68/push 0/imm32/read
489 68/push 0/imm32/write
490 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
491
492 68/push 0/imm32
493 68/push 0/imm32
494 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
495 $compute-offsets:line-loop:
496
497 51/push-ecx
498 e8/call clear-stream/disp32
499
500 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
501
502 51/push-ecx
503 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
504 e8/call read-line/disp32
505
506 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
507
508 8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . .
509 3d/compare-eax-and 0/imm32
510 0f 84/jump-if-= $compute-offsets:break-line-loop/disp32
511 +-- 33 lines: #? # dump line ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
544 $compute-offsets:word-loop:
545
546 52/push-edx
547 51/push-ecx
548 e8/call next-word/disp32
549
550 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
551 $compute-offsets:case-empty:
552
553
554 52/push-edx
555 e8/call slice-empty?/disp32
556
557 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
558
559 3d/compare-eax-and 0/imm32/false
560 0f 85/jump-if-!= $compute-offsets:line-loop/disp32
561 $compute-offsets:case-comment:
562
563 68/push "#"/imm32
564 52/push-edx
565 e8/call slice-starts-with?/disp32
566
567 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
568
569 3d/compare-eax-and 0/imm32/false
570 0f 85/jump-if-!= $compute-offsets:line-loop/disp32
571 $compute-offsets:case-segment-header:
572
573
574 68/push "=="/imm32
575 52/push-edx
576 e8/call slice-equal?/disp32
577
578 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
579
580 3d/compare-eax-and 0/imm32/false
581 0f 84/jump-if-= $compute-offsets:case-label/disp32
582
583 81 7/subop/compare 0/mod/indirect 6/rm32/esi . . . . . 0/imm32
584 74/jump-if-= $compute-offsets:construct-next-segment/disp8
585
586
587
588 68/push 0x14/imm32/row-size
589 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
590 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
591 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
592
593 e8/call get-or-insert-handle/disp32
594
595 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
596
597 89/copy 3/mod/direct 7/rm32/edi . . . 0/r32/eax . .
598
599
600 51/push-ecx
601
602 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx compute-offsets:file-offset/disp32
603
604 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 1/r32/ecx 4/disp8 .
605
606 29/subtract 3/mod/direct 3/rm32/ebx . . . 1/r32/ecx . .
607
608 89/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 8/disp8 .
609
610 59/pop-to-ecx
611
612
613
614 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
615 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
616
617 e8/call lookup/disp32
618
619 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
620
621
622 68/push "."/imm32
623 53/push-ebx
624 68/push "' has size "/imm32
625 50/push-eax
626 68/push "segment '"/imm32
627
628 e8/call trace-sssns/disp32
629
630 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
631 $compute-offsets:construct-next-segment:
632
633 68/push compute-offsets:segment-tmp/imm32
634 51/push-ecx
635 e8/call next-word/disp32
636
637 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
638
639
640
641 68/push compute-offsets:segment-tmp/imm32
642
643 e8/call slice-empty?/disp32
644
645 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
646
647 3d/compare-eax-and 0/imm32/false
648 0f 85/jump-if-!= $compute-offsets:abort/disp32
649 $compute-offsets:update-curr-segment-name:
650
651
652 56/push-esi
653 68/push compute-offsets:segment-tmp/imm32
654 68/push Heap/imm32
655
656 e8/call slice-to-string/disp32
657
658 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
659
660 68/push compute-offsets:segment-tmp/imm32
661 51/push-ecx
662 e8/call next-word/disp32
663
664 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
665
666
667
668 68/push compute-offsets:segment-tmp/imm32
669
670 e8/call slice-empty?/disp32
671
672 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
673
674 3d/compare-eax-and 0/imm32/false
675 0f 85/jump-if-!= $compute-offsets:abort/disp32
676
677
678
679 68/push 0x14/imm32/row-size
680 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
681 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
682 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
683
684 e8/call get-or-insert-handle/disp32
685
686 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
687
688 89/copy 3/mod/direct 7/rm32/edi . . . 0/r32/eax . .
689
690
691
692 68/push compute-offsets:segment-tmp/imm32
693
694 e8/call parse-hex-int-from-slice/disp32
695
696 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
697
698 89/copy 0/mod/indirect 7/rm32/edi . . . 0/r32/eax . .
699
700 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax compute-offsets:file-offset/disp32
701 89/copy 1/mod/*+disp8 7/rm32/edi . . . 0/r32/eax 4/disp8 .
702
703
704
705 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
706 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
707
708 e8/call lookup/disp32
709
710 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
711
712
713 68/push "."/imm32
714 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:file-offset/disp32
715 68/push "' is at file offset "/imm32
716 50/push-eax
717 68/push "segment '"/imm32
718
719 e8/call trace-sssns/disp32
720
721 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
722
723 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:segment-offset/disp32 0/imm32
724
725 e9/jump $compute-offsets:line-loop/disp32
726 $compute-offsets:case-label:
727
728
729
730 52/push-edx
731
732 e8/call is-label?/disp32
733
734 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
735
736 3d/compare-eax-and 0/imm32/false
737 0f 84/jump-if-= $compute-offsets:case-default/disp32
738
739 ff 1/subop/decrement 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
740
741
742
743 68/push Heap/imm32
744 68/push 0x18/imm32/row-size
745 52/push-edx
746 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
747
748 e8/call get-or-insert-slice/disp32
749
750 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
751
752 89/copy 3/mod/direct 7/rm32/edi . . . 0/r32/eax . .
753 $compute-offsets:save-label-offset:
754
755 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
756 89/copy 0/mod/indirect 7/rm32/edi . . . 0/r32/eax . .
757 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 4/disp8 .
758 89/copy 1/mod/*+disp8 7/rm32/edi . . . 0/r32/eax 4/disp8 .
759
760
761
762 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
763 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
764
765 e8/call lookup/disp32
766
767 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
768
769
770 68/push "'."/imm32
771 50/push-eax
772 68/push "' is in segment '"/imm32
773 52/push-edx
774 68/push "label '"/imm32
775
776 e8/call trace-slsss/disp32
777
778 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
779
780
781 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx compute-offsets:segment-offset/disp32
782
783 89/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 8/disp8 .
784
785
786 68/push "."/imm32
787 53/push-ebx
788 68/push "' is at segment offset "/imm32
789 52/push-edx
790 68/push "label '"/imm32
791
792 e8/call trace-slsns/disp32
793
794 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
795
796 e9/jump $compute-offsets:word-loop/disp32
797 $compute-offsets:case-default:
798
799
800 52/push-edx
801
802 e8/call compute-width-of-slice/disp32
803
804 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
805
806 01/add 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax compute-offsets:segment-offset/disp32
807
808 01/add 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax compute-offsets:file-offset/disp32
809 +-- 41 lines: #? # dump segment-offset -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
850 e9/jump $compute-offsets:word-loop/disp32
851 $compute-offsets:break-line-loop:
852
853
854
855 68/push 0x14/imm32/row-size
856 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
857 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
858 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
859
860 e8/call get-or-insert-handle/disp32
861
862 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
863
864 89/copy 3/mod/direct 7/rm32/edi . . . 0/r32/eax . .
865
866
867 51/push-ecx
868
869 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx compute-offsets:file-offset/disp32
870
871 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 1/r32/ecx 4/disp8 .
872
873 29/subtract 3/mod/direct 3/rm32/ebx . . . 1/r32/ecx . .
874
875 89/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 8/disp8 .
876
877 59/pop-to-ecx
878
879
880
881 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
882 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
883
884 e8/call lookup/disp32
885
886 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
887
888
889 68/push "."/imm32
890 53/push-ebx
891 68/push "' has size "/imm32
892 50/push-eax
893 68/push "segment '"/imm32
894
895 e8/call trace-sssns/disp32
896
897 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
898 $compute-offsets:end:
899
900 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x21c/imm32
901
902 5f/pop-to-edi
903 5e/pop-to-esi
904 5b/pop-to-ebx
905 5a/pop-to-edx
906 59/pop-to-ecx
907 58/pop-to-eax
908
909 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
910 5d/pop-to-ebp
911 c3/return
912
913 $compute-offsets:abort:
914
915
916 68/push "'==' must be followed by segment name and segment-start\n"/imm32
917 68/push 2/imm32/stderr
918
919 e8/call _write/disp32
920
921 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
922
923 bb/copy-to-ebx 1/imm32
924 e8/call syscall_exit/disp32
925
926
927 test-compute-offsets:
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945 55/push-ebp
946 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
947
948
949
950 68/push _test-input-stream/imm32
951
952 e8/call clear-stream/disp32
953
954 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
955
956 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x28/imm32
957 68/push 0x28/imm32/size
958 68/push 0/imm32/read
959 68/push 0/imm32/write
960 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
961
962 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x30/imm32
963 68/push 0x30/imm32/size
964 68/push 0/imm32/read
965 68/push 0/imm32/write
966 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
967
968
969
970 68/push "== code 0x1\n"/imm32
971 68/push _test-input-stream/imm32
972
973 e8/call write/disp32
974
975 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
976
977
978 68/push "ab x/imm32 # skip comment\n"/imm32
979 68/push _test-input-stream/imm32
980
981 e8/call write/disp32
982
983 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
984
985
986 68/push "== data 0x1000\n"/imm32
987 68/push _test-input-stream/imm32
988
989 e8/call write/disp32
990
991 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
992
993
994 68/push "00\n"/imm32
995 68/push _test-input-stream/imm32
996
997 e8/call write/disp32
998
999 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1000
1001
1002 68/push "x:\n"/imm32
1003 68/push _test-input-stream/imm32
1004
1005 e8/call write/disp32
1006
1007 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1008
1009
1010 68/push "34\n"/imm32
1011 68/push _test-input-stream/imm32
1012
1013 e8/call write/disp32
1014
1015 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1016
1017
1018 52/push-edx
1019 51/push-ecx
1020 68/push _test-input-stream/imm32
1021
1022 e8/call compute-offsets/disp32
1023
1024 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1025 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1051
1052
1053
1054 68/push "F - test-compute-offsets/0"/imm32
1055 68/push "segment 'code' is at file offset 0x00000000."/imm32
1056
1057 e8/call check-trace-contains/disp32
1058
1059 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1060
1061
1062 68/push "F - test-compute-offsets/1"/imm32
1063 68/push "segment 'code' has size 0x00000005."/imm32
1064
1065 e8/call check-trace-contains/disp32
1066
1067 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1068
1069
1070 68/push "F - test-compute-offsets/2"/imm32
1071 68/push "segment 'data' is at file offset 0x00000005."/imm32
1072
1073 e8/call check-trace-contains/disp32
1074
1075 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1076
1077
1078 68/push "F - test-compute-offsets/3"/imm32
1079 68/push "segment 'data' has size 0x00000002."/imm32
1080
1081 e8/call check-trace-contains/disp32
1082
1083 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1084
1085
1086 68/push "F - test-compute-offsets/4"/imm32
1087 68/push "label 'x' is in segment 'data'."/imm32
1088
1089 e8/call check-trace-contains/disp32
1090
1091 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1092
1093
1094 68/push "F - test-compute-offsets/5"/imm32
1095 68/push "label 'x' is at segment offset 0x00000001."/imm32
1096
1097 e8/call check-trace-contains/disp32
1098
1099 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1100
1101
1102 68/push "F - test-compute-offsets-maintains-labels-write-index"/imm32
1103 68/push 0x18/imm32/1-entry
1104 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
1105
1106 e8/call check-ints-equal/disp32
1107
1108 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1109
1110 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1111 5d/pop-to-ebp
1112 c3/return
1113
1114
1115
1116
1117 compute-addresses:
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141 55/push-ebp
1142 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1143
1144 50/push-eax
1145 51/push-ecx
1146 52/push-edx
1147 53/push-ebx
1148 56/push-esi
1149 57/push-edi
1150
1151 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
1152
1153
1154 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
1155
1156 ba/copy-to-edx 0/imm32
1157
1158 b9/copy-to-ecx 0x14/imm32/row-size
1159
1160 f7 7/subop/divide 3/mod/direct 1/rm32/ecx . . . . . .
1161
1162 89/copy 3/mod/direct 7/rm32/edi . . . 0/r32/eax . .
1163
1164 c1/shift 4/subop/left 3/mod/direct 7/rm32/edi . . . . . 5/imm8
1165 81 0/subop/add 3/mod/direct 7/rm32/edi . . . . . 0x34/imm32
1166
1167 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . .
1168 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 1/index/ecx . 1/r32/ecx 0xc/disp8 .
1169
1170 8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 6/r32/esi 0xc/disp8 .
1171 $compute-addresses:segment-loop:
1172
1173 39/compare 3/mod/direct 6/rm32/esi . . . 1/r32/ecx . .
1174 73/jump-if-addr>= $compute-addresses:segment-break/disp8
1175
1176 01/add 1/mod/*+disp8 6/rm32/esi . . . 7/r32/edi 0xc/disp8 .
1177
1178
1179 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 8/disp8 .
1180
1181 81 4/subop/and 3/mod/direct 2/rm32/edx . . . . . 0xfffff000/imm32
1182
1183
1184 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 3/r32/ebx 0xc/disp8 .
1185
1186 81 4/subop/and 3/mod/direct 3/rm32/ebx . . . . . 0x00000fff/imm32
1187
1188 09/or 3/mod/direct 2/rm32/edx . . . 3/r32/ebx . .
1189 89/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 8/disp8 .
1190
1191
1192
1193 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
1194 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
1195
1196 e8/call lookup/disp32
1197
1198 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1199
1200
1201 68/push "."/imm32
1202 52/push-edx
1203 68/push "' starts at address "/imm32
1204 50/push-eax
1205 68/push "segment '"/imm32
1206
1207 e8/call trace-sssns/disp32
1208
1209 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1210
1211 81 0/subop/add 3/mod/direct 6/rm32/esi . . . . . 0x14/imm32
1212 eb/jump $compute-addresses:segment-loop/disp8
1213 $compute-addresses:segment-break:
1214 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1240
1241 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
1242
1243 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . .
1244 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 1/index/ecx . 1/r32/ecx 0xc/disp8 .
1245
1246 8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 6/r32/esi 0xc/disp8 .
1247 $compute-addresses:label-loop:
1248
1249 39/compare 3/mod/direct 6/rm32/esi . . . 1/r32/ecx . .
1250 0f 83/jump-if-addr>= $compute-addresses:end/disp32
1251 +-- 26 lines: #? # dump lrow->key ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1277
1278
1279
1280 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 0xc/disp8 .
1281 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 8/disp8 .
1282
1283 e8/call lookup/disp32
1284
1285 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1286
1287 89/copy 3/mod/direct 2/rm32/edx . . . 0/r32/eax . .
1288 +-- 26 lines: #? # dump seg-name -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1314
1315
1316
1317 68/push "segment table"/imm32
1318 68/push 0x14/imm32/row-size
1319 52/push-edx
1320 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
1321
1322 e8/call get/disp32
1323
1324 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
1325
1326 89/copy 3/mod/direct 2/rm32/edx . . . 0/r32/eax . .
1327
1328 8b/copy 0/mod/indirect 2/rm32/edx . . . 3/r32/ebx . .
1329
1330 03/add 1/mod/*+disp8 6/rm32/esi . . . 3/r32/ebx 0x10/disp8 .
1331
1332 89/copy 1/mod/*+disp8 6/rm32/esi . . . 3/r32/ebx 0x14/disp8 .
1333
1334
1335
1336 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
1337 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
1338
1339 e8/call lookup/disp32
1340
1341 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1342
1343
1344 68/push "."/imm32
1345 53/push-ebx
1346 68/push "' is at address "/imm32
1347 50/push-eax
1348 68/push "label '"/imm32
1349
1350 e8/call trace-sssns/disp32
1351
1352 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1353
1354 81 0/subop/add 3/mod/direct 6/rm32/esi . . . . . 0x18/imm32
1355 e9/jump $compute-addresses:label-loop/disp32
1356 $compute-addresses:end:
1357
1358 5f/pop-to-edi
1359 5e/pop-to-esi
1360 5b/pop-to-ebx
1361 5a/pop-to-edx
1362 59/pop-to-ecx
1363 58/pop-to-eax
1364
1365 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1366 5d/pop-to-ebp
1367 c3/return
1368
1369 test-compute-addresses:
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387 55/push-ebp
1388 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1389
1390
1391 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc8/imm32
1392 68/push 0xc8/imm32/size
1393 68/push 0/imm32/read
1394 68/push 0/imm32/write
1395 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1396
1397 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
1398 68/push 0xc0/imm32/size
1399 68/push 0/imm32/read
1400 68/push 0/imm32/write
1401 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1402
1403 68/push 0/imm32
1404 68/push 0/imm32
1405 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
1406
1407
1408 53/push-ebx
1409 68/push "a"/imm32
1410 68/push Heap/imm32
1411
1412 e8/call copy-array/disp32
1413
1414 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1415
1416
1417 68/push 5/imm32/segment-size
1418 68/push 0/imm32/file-offset
1419 68/push 0x1000/imm32/start-address
1420 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1421 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1422 51/push-ecx
1423
1424 e8/call stream-add5/disp32
1425
1426 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x18/imm32
1427
1428
1429 53/push-ebx
1430 68/push "b"/imm32
1431 68/push Heap/imm32
1432
1433 e8/call copy-array/disp32
1434
1435 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1436
1437
1438 68/push 1/imm32/segment-size
1439 68/push 5/imm32/file-offset
1440 68/push 0x2018/imm32/start-address
1441 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1442 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1443 51/push-ecx
1444
1445 e8/call stream-add5/disp32
1446
1447 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x18/imm32
1448
1449
1450 53/push-ebx
1451 68/push "c"/imm32
1452 68/push Heap/imm32
1453
1454 e8/call copy-array/disp32
1455
1456 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1457
1458 68/push 0xc/imm32/segment-size
1459 68/push 6/imm32/file-offset
1460 68/push 0x5444/imm32/start-address
1461 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1462 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1463 51/push-ecx
1464
1465 e8/call stream-add5/disp32
1466
1467 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x18/imm32
1468
1469
1470 68/push 0/imm32/label-address
1471 68/push 3/imm32/segment-offset
1472
1473 53/push-ebx
1474 68/push "a"/imm32
1475 68/push Heap/imm32
1476 e8/call copy-array/disp32
1477 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1478 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1479 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1480
1481 53/push-ebx
1482 68/push "l1"/imm32
1483 68/push Heap/imm32
1484 e8/call copy-array/disp32
1485 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1486 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1487 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1488
1489 52/push-edx
1490
1491 e8/call stream-add6/disp32
1492
1493 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x1c/imm32
1494
1495
1496 68/push 0/imm32/label-address
1497 68/push 0/imm32/segment-offset
1498
1499 53/push-ebx
1500 68/push "b"/imm32
1501 68/push Heap/imm32
1502 e8/call copy-array/disp32
1503 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1504 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1505 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1506
1507 53/push-ebx
1508 68/push "l2"/imm32
1509 68/push Heap/imm32
1510 e8/call copy-array/disp32
1511 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1512 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1513 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1514
1515 52/push-edx
1516
1517 e8/call stream-add6/disp32
1518
1519 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x1c/imm32
1520
1521
1522
1523 52/push-edx
1524 51/push-ecx
1525
1526 e8/call compute-addresses/disp32
1527
1528 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1529
1530 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1556
1557
1558 68/push "F - test-compute-addresses/0"/imm32
1559 68/push "segment 'a' starts at address 0x00001094."/imm32
1560
1561 e8/call check-trace-contains/disp32
1562
1563 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1564
1565
1566 68/push "F - test-compute-addresses/1"/imm32
1567 68/push "segment 'b' starts at address 0x00002099."/imm32
1568
1569 e8/call check-trace-contains/disp32
1570
1571 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1572
1573
1574 68/push "F - test-compute-addresses/2"/imm32
1575 68/push "segment 'c' starts at address 0x0000509a."/imm32
1576
1577 e8/call check-trace-contains/disp32
1578
1579 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1580
1581
1582 68/push "F - test-compute-addresses/3"/imm32
1583 68/push "label 'l1' is at address 0x00001097."/imm32
1584
1585 e8/call check-trace-contains/disp32
1586
1587 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1588
1589
1590 68/push "F - test-compute-addresses/4"/imm32
1591 68/push "label 'l2' is at address 0x00002099."/imm32
1592
1593 e8/call check-trace-contains/disp32
1594
1595 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1596
1597
1598 68/push "F - test-compute-addresses/maintains-labels-write-index"/imm32
1599 68/push 0x30/imm32/2-entries
1600 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
1601
1602 e8/call check-ints-equal/disp32
1603
1604 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1605
1606 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1607 5d/pop-to-ebp
1608 c3/return
1609
1610 test-compute-addresses-large-segments:
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624 55/push-ebp
1625 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1626
1627
1628 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc8/imm32
1629 68/push 0xc8/imm32/size
1630 68/push 0/imm32/read
1631 68/push 0/imm32/write
1632 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1633
1634 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
1635 68/push 0xc0/imm32/size
1636 68/push 0/imm32/read
1637 68/push 0/imm32/write
1638 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1639
1640 68/push 0/imm32
1641 68/push 0/imm32
1642 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
1643
1644
1645 53/push-ebx
1646 68/push "a"/imm32
1647 68/push Heap/imm32
1648
1649 e8/call copy-array/disp32
1650
1651 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1652
1653 68/push 0x5604/imm32/segment-size
1654 68/push 0/imm32/file-offset
1655 68/push 0x1000/imm32/start-address
1656 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1657 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1658 51/push-ecx
1659
1660 e8/call stream-add5/disp32
1661
1662 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x18/imm32
1663
1664
1665 53/push-ebx
1666 68/push "b"/imm32
1667 68/push Heap/imm32
1668
1669 e8/call copy-array/disp32
1670
1671 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1672
1673 68/push 1/imm32/segment-size
1674 68/push 0x5604/imm32/file-offset
1675 68/push 0x2018/imm32/start-address
1676 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1677 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1678 51/push-ecx
1679
1680 e8/call stream-add5/disp32
1681
1682 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x18/imm32
1683
1684 68/push 0/imm32/label-address
1685 68/push 3/imm32/segment-offset
1686
1687 53/push-ebx
1688 68/push "a"/imm32
1689 68/push Heap/imm32
1690 e8/call copy-array/disp32
1691 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1692 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1693 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1694
1695 53/push-ebx
1696 68/push "l1"/imm32
1697 68/push Heap/imm32
1698 e8/call copy-array/disp32
1699 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1700 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1701 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1702
1703 52/push-edx
1704
1705 e8/call stream-add6/disp32
1706
1707 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x1c/imm32
1708
1709
1710
1711 52/push-edx
1712 51/push-ecx
1713
1714 e8/call compute-addresses/disp32
1715
1716 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1717
1718 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1744
1745
1746 68/push "F - test-compute-addresses-large-segments/0"/imm32
1747 68/push "segment 'a' starts at address 0x00001074."/imm32
1748
1749 e8/call check-trace-contains/disp32
1750
1751 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1752
1753
1754 68/push "F - test-compute-addresses-large-segments/1"/imm32
1755 68/push "segment 'b' starts at address 0x00002678."/imm32
1756
1757 e8/call check-trace-contains/disp32
1758
1759 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1760
1761
1762 68/push "F - test-compute-addresses-large-segments/3"/imm32
1763 68/push "label 'l1' is at address 0x00001077."/imm32
1764
1765 e8/call check-trace-contains/disp32
1766
1767 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1768
1769 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1770 5d/pop-to-ebp
1771 c3/return
1772
1773 emit-output:
1774
1775
1776
1777
1778
1779 55/push-ebp
1780 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1781 +-- 9 lines: #? # write(2/stderr, "emit-headers\n") ---------------------------------------------------------------------------------------------------------------------------------------------------------
1790
1791
1792 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
1793 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
1794 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1795
1796 e8/call emit-headers/disp32
1797
1798 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1799 +-- 9 lines: #? # write(2/stderr, "emit-segments\n") --------------------------------------------------------------------------------------------------------------------------------------------------------
1808
1809
1810 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
1811 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1812 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
1813
1814 e8/call emit-segments/disp32
1815
1816 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1817 $emit-output:end:
1818
1819 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1820 5d/pop-to-ebp
1821 c3/return
1822
1823 emit-segments:
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880 55/push-ebp
1881 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1882
1883 50/push-eax
1884 51/push-ecx
1885 52/push-edx
1886 53/push-ebx
1887 56/push-esi
1888 57/push-edi
1889
1890 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32
1891 68/push 0x200/imm32/size
1892 68/push 0/imm32/read
1893 68/push 0/imm32/write
1894 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1895
1896 68/push 0/imm32/end
1897 68/push 0/imm32/start
1898 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1899
1900 68/push 0/imm32/end
1901 68/push 0/imm32/start
1902 89/copy 3/mod/direct 7/rm32/edi . . . 4/r32/esp . .
1903
1904 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
1905 $emit-segments:line-loop:
1906
1907
1908 51/push-ecx
1909
1910 e8/call clear-stream/disp32
1911
1912 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1913
1914
1915 51/push-ecx
1916 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
1917
1918 e8/call read-line/disp32
1919
1920 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1921 +-- 33 lines: #? # dump line ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1954 $emit-segments:check-for-end-of-input:
1955
1956 81 7/subop/compare 0/mod/indirect 1/rm32/ecx . . . . . 0/imm32
1957 0f 84/jump-if-= $emit-segments:end/disp32
1958
1959
1960
1961 51/push-ecx
1962
1963 e8/call num-bytes/disp32
1964
1965 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1966
1967 01/add 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . .
1968 $emit-segments:word-loop:
1969
1970
1971 52/push-edx
1972 51/push-ecx
1973
1974 e8/call next-word/disp32
1975
1976 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1977 +-- 33 lines: #? # dump word-slice ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2010 $emit-segments:check-for-end-of-line:
2011
2012
2013
2014 52/push-edx
2015
2016 e8/call slice-empty?/disp32
2017
2018 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2019
2020 3d/compare-eax-and 0/imm32/false
2021 0f 85/jump-if-!= $emit-segments:next-line/disp32
2022 $emit-segments:check-for-comment:
2023
2024
2025 8b/copy 0/mod/indirect 2/rm32/edx . . . 6/r32/esi . .
2026
2027 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
2028 8a/copy-byte 0/mod/indirect 6/rm32/esi . . . 0/r32/AL . .
2029
2030 3d/compare-eax-and 0x23/imm32/hash
2031 0f 84/jump-if-= $emit-segments:next-line/disp32
2032 $emit-segments:check-for-label:
2033
2034
2035
2036 52/push-edx
2037
2038 e8/call is-label?/disp32
2039
2040 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2041
2042 3d/compare-eax-and 0/imm32/false
2043 0f 85/jump-if-!= $emit-segments:line-loop/disp32
2044 $emit-segments:check-for-segment-header:
2045
2046
2047
2048 68/push "=="/imm32
2049 52/push-edx
2050
2051 e8/call slice-equal?/disp32
2052
2053 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2054
2055 3d/compare-eax-and 0/imm32/false
2056 0f 85/jump-if-!= $emit-segments:line-loop/disp32
2057 $emit-segments:2-character:
2058
2059
2060 8b/copy 1/mod/*+disp8 2/rm32/edx . . . 0/r32/eax 4/disp8 .
2061 2b/subtract 0/mod/indirect 2/rm32/edx . . . 0/r32/eax . .
2062
2063 3d/compare-eax-and 2/imm32
2064 75/jump-if-!= $emit-segments:check-metadata/disp8
2065
2066
2067 52/push-edx
2068 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2069
2070 e8/call write-slice-buffered/disp32
2071
2072 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2073
2074
2075 68/push Space/imm32
2076 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2077
2078 e8/call write-buffered/disp32
2079
2080 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2081
2082 e9/jump $emit-segments:word-loop/disp32
2083 $emit-segments:check-metadata:
2084
2085
2086
2087 57/push-edi
2088 68/push 0x2f/imm32/slash
2089 ff 6/subop/push 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
2090 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
2091
2092 e8/call next-token-from-slice/disp32
2093
2094 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
2095 +-- 33 lines: #? # dump datum --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2128
2129
2130
2131 68/push "label table"/imm32
2132 68/push 0x18/imm32/row-size
2133 57/push-edi
2134 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
2135
2136 e8/call get-slice/disp32
2137
2138 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
2139
2140 89/copy 3/mod/direct 6/rm32/esi . . . 0/r32/eax . .
2141 $emit-segments:check-global-variable:
2142
2143
2144
2145 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
2146 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
2147
2148 e8/call lookup/disp32
2149
2150 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2151
2152
2153 68/push "code"/imm32
2154 50/push-eax
2155
2156 e8/call string-equal?/disp32
2157
2158 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2159
2160 3d/compare-eax-and 0/imm32/false
2161 0f 85/jump-if-!= $emit-segments:check-code-label-for-imm8/disp32
2162 $emit-segments:check-global-variable-for-disp8:
2163
2164
2165
2166 68/push "disp8"/imm32
2167 52/push-edx
2168
2169 e8/call has-metadata?/disp32
2170
2171 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2172
2173 3d/compare-eax-and 0/imm32/false
2174 0f 85/jump-if-!= $emit-segments:global-variable-abort/disp32
2175 $emit-segments:check-global-variable-for-imm8:
2176
2177
2178
2179 68/push "imm8"/imm32
2180 52/push-edx
2181
2182 e8/call has-metadata?/disp32
2183
2184 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2185
2186 3d/compare-eax-and 0/imm32/false
2187 0f 85/jump-if-!= $emit-segments:global-variable-abort/disp32
2188 $emit-segments:emit-global-variable:
2189
2190
2191 68/push 4/imm32
2192 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 0xc/disp8 .
2193 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2194
2195 e8/call emit-hex/disp32
2196
2197 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2198
2199 e9/jump $emit-segments:word-loop/disp32
2200 $emit-segments:check-code-label-for-imm8:
2201
2202
2203
2204 68/push "imm8"/imm32
2205 52/push-edx
2206
2207 e8/call has-metadata?/disp32
2208
2209 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2210
2211 3d/compare-eax-and 0/imm32/false
2212 0f 85/jump-if-!= $emit-segments:imm8-abort/disp32
2213 $emit-segments:check-code-label-for-imm32:
2214
2215
2216
2217 68/push "imm32"/imm32
2218 52/push-edx
2219
2220 e8/call has-metadata?/disp32
2221
2222 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2223
2224 3d/compare-eax-and 0/imm32/false
2225 74/jump-if-= $emit-segments:check-code-label-for-disp8/disp8
2226 +-- 33 lines: #? # dump info->address ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2259 $emit-segments:emit-code-label-imm32:
2260
2261
2262 68/push 4/imm32
2263 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 0xc/disp8 .
2264 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2265
2266 e8/call emit-hex/disp32
2267
2268 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2269
2270 e9/jump $emit-segments:word-loop/disp32
2271 $emit-segments:check-code-label-for-disp8:
2272
2273
2274
2275 68/push "disp8"/imm32
2276 52/push-edx
2277
2278 e8/call has-metadata?/disp32
2279
2280 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2281
2282 3d/compare-eax-and 0/imm32/false
2283 74/jump-if-= $emit-segments:check-code-label-for-disp32/disp8
2284 $emit-segments:emit-code-label-disp8:
2285
2286
2287 68/push 1/imm32
2288 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 8/disp8 .
2289 29/subtract 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
2290 50/push-eax
2291 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2292
2293 e8/call emit-hex/disp32
2294
2295 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2296
2297 e9/jump $emit-segments:word-loop/disp32
2298 $emit-segments:check-code-label-for-disp32:
2299
2300
2301
2302 68/push "disp32"/imm32
2303 52/push-edx
2304
2305 e8/call has-metadata?/disp32
2306
2307 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2308
2309 3d/compare-eax-and 0/imm32/false
2310 0f 84/jump-if-= $emit-segments:abort/disp32
2311 $emit-segments:emit-code-label-disp32:
2312
2313
2314 68/push 4/imm32
2315 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 8/disp8 .
2316 29/subtract 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
2317 50/push-eax
2318 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2319
2320 e8/call emit-hex/disp32
2321
2322 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2323
2324 e9/jump $emit-segments:word-loop/disp32
2325 $emit-segments:next-line:
2326
2327
2328 68/push Newline/imm32
2329 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2330
2331 e8/call write-buffered/disp32
2332
2333 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2334
2335 e9/jump $emit-segments:line-loop/disp32
2336 $emit-segments:end:
2337
2338 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x21c/imm32
2339
2340 5f/pop-to-edi
2341 5e/pop-to-esi
2342 5b/pop-to-ebx
2343 5a/pop-to-edx
2344 59/pop-to-ecx
2345 58/pop-to-eax
2346
2347 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2348 5d/pop-to-ebp
2349 c3/return
2350
2351 $emit-segments:global-variable-abort:
2352
2353
2354 68/push "emit-segments: must refer to global variables with /disp32 or /imm32"/imm32
2355 68/push 2/imm32/stderr
2356
2357 e8/call _write/disp32
2358
2359 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2360
2361 bb/copy-to-ebx 1/imm32
2362 e8/call syscall_exit/disp32
2363
2364
2365 $emit-segments:imm8-abort:
2366
2367
2368 68/push "emit-segments: cannot refer to code labels with /imm8"/imm32
2369 68/push 2/imm32/stderr
2370
2371 e8/call _write/disp32
2372
2373 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2374
2375 bb/copy-to-ebx 1/imm32
2376 e8/call syscall_exit/disp32
2377
2378
2379 $emit-segments:abort:
2380
2381
2382
2383 68/push "emit-segments: missing metadata in "/imm32
2384 68/push 2/imm32/stderr
2385
2386 e8/call _write/disp32
2387
2388 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2389
2390
2391 52/push-edx
2392 68/push Stderr/imm32
2393
2394 e8/call write-slice-buffered/disp32
2395
2396 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2397
2398
2399 68/push Stderr/imm32
2400
2401 e8/call flush/disp32
2402
2403 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2404
2405 bb/copy-to-ebx 1/imm32
2406 e8/call syscall_exit/disp32
2407
2408
2409 test-emit-segments-global-variable:
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431 55/push-ebp
2432 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2433
2434
2435
2436 68/push _test-input-stream/imm32
2437
2438 e8/call clear-stream/disp32
2439
2440 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2441
2442
2443 68/push _test-output-stream/imm32
2444
2445 e8/call clear-stream/disp32
2446
2447 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2448
2449
2450 68/push $_test-output-buffered-file->buffer/imm32
2451
2452 e8/call clear-stream/disp32
2453
2454 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2455
2456 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
2457 68/push 0xc0/imm32/size
2458 68/push 0/imm32/read
2459 68/push 0/imm32/write
2460 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
2461
2462 68/push 0/imm32
2463 68/push 0/imm32
2464 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
2465
2466
2467
2468 68/push "== code 0x1000\n"/imm32
2469 68/push _test-input-stream/imm32
2470
2471 e8/call write/disp32
2472
2473 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2474
2475
2476 68/push "ab cd ef gh\n"/imm32
2477 68/push _test-input-stream/imm32
2478
2479 e8/call write/disp32
2480
2481 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2482
2483
2484 68/push "ij x/disp32\n"/imm32
2485 68/push _test-input-stream/imm32
2486
2487 e8/call write/disp32
2488
2489 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2490
2491
2492 68/push "== data 0x2000\n"/imm32
2493 68/push _test-input-stream/imm32
2494
2495 e8/call write/disp32
2496
2497 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2498
2499
2500 68/push "00\n"/imm32
2501 68/push _test-input-stream/imm32
2502
2503 e8/call write/disp32
2504
2505 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2506
2507
2508 68/push "x:\n"/imm32
2509 68/push _test-input-stream/imm32
2510
2511 e8/call write/disp32
2512
2513 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2514
2515
2516 68/push "34\n"/imm32
2517 68/push _test-input-stream/imm32
2518
2519 e8/call write/disp32
2520
2521 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2522
2523 68/push 0x207a/imm32/label-address
2524 68/push 1/imm32/segment-offset
2525
2526 53/push-ebx
2527 68/push "data"/imm32
2528 68/push Heap/imm32
2529 e8/call copy-array/disp32
2530 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2531 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
2532 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
2533
2534 53/push-ebx
2535 68/push "x"/imm32
2536 68/push Heap/imm32
2537 e8/call copy-array/disp32
2538 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2539 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
2540 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
2541
2542 52/push-edx
2543
2544 e8/call stream-add6/disp32
2545
2546 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x1c/imm32
2547
2548
2549
2550 52/push-edx
2551 68/push _test-output-buffered-file/imm32
2552 68/push _test-input-stream/imm32
2553
2554 e8/call emit-segments/disp32
2555
2556 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2557
2558
2559
2560 68/push _test-output-buffered-file/imm32
2561
2562 e8/call flush/disp32
2563
2564 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2565 +-- 33 lines: #? # dump output -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2598
2599
2600 68/push "F - test-emit-segments-global-variable/0"/imm32
2601 68/push "ab cd ef gh "/imm32
2602 68/push _test-output-stream/imm32
2603
2604 e8/call check-next-stream-line-equal/disp32
2605
2606 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2607
2608
2609 68/push "F - test-emit-segments-global-variable/1"/imm32
2610 68/push "ij 7a 20 00 00 "/imm32
2611 68/push _test-output-stream/imm32
2612
2613 e8/call check-next-stream-line-equal/disp32
2614
2615 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2616
2617
2618 68/push "F - test-emit-segments-global-variable/2"/imm32
2619 68/push "00 "/imm32
2620 68/push _test-output-stream/imm32
2621
2622 e8/call check-next-stream-line-equal/disp32
2623
2624 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2625
2626
2627 68/push "F - test-emit-segments-global-variable/3"/imm32
2628 68/push "34 "/imm32
2629 68/push _test-output-stream/imm32
2630
2631 e8/call check-next-stream-line-equal/disp32
2632
2633 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2634
2635 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2636 5d/pop-to-ebp
2637 c3/return
2638
2639 test-emit-segments-code-label:
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658 55/push-ebp
2659 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2660
2661
2662
2663 68/push _test-input-stream/imm32
2664
2665 e8/call clear-stream/disp32
2666
2667 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2668
2669
2670 68/push _test-output-stream/imm32
2671
2672 e8/call clear-stream/disp32
2673
2674 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2675
2676
2677 68/push $_test-output-buffered-file->buffer/imm32
2678
2679 e8/call clear-stream/disp32
2680
2681 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2682
2683 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
2684 68/push 0xc0/imm32/size
2685 68/push 0/imm32/read
2686 68/push 0/imm32/write
2687 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
2688
2689 68/push 0/imm32
2690 68/push 0/imm32
2691 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
2692
2693
2694
2695 68/push "== code 0x1000\n"/imm32
2696 68/push _test-input-stream/imm32
2697
2698 e8/call write/disp32
2699
2700 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2701
2702
2703 68/push "ab cd\n"/imm32
2704 68/push _test-input-stream/imm32
2705
2706 e8/call write/disp32
2707
2708 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2709
2710
2711 68/push "l1:\n"/imm32
2712 68/push _test-input-stream/imm32
2713
2714 e8/call write/disp32
2715
2716 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2717
2718
2719 68/push " ef gh\n"/imm32
2720 68/push _test-input-stream/imm32
2721
2722 e8/call write/disp32
2723
2724 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2725
2726
2727 68/push " ij l1/disp32\n"/imm32
2728 68/push _test-input-stream/imm32
2729
2730 e8/call write/disp32
2731
2732 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2733
2734 68/push 0x1056/imm32/label-address
2735 68/push 2/imm32/segment-offset
2736
2737 53/push-ebx
2738 68/push "code"/imm32
2739 68/push Heap/imm32
2740 e8/call copy-array/disp32
2741 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2742 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
2743 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
2744
2745 53/push-ebx
2746 68/push "l1"/imm32
2747 68/push Heap/imm32
2748 e8/call copy-array/disp32
2749 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2750 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
2751 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
2752
2753 52/push-edx
2754
2755 e8/call stream-add6/disp32
2756
2757 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x1c/imm32
2758
2759
2760
2761 52/push-edx
2762 68/push _test-output-buffered-file/imm32
2763 68/push _test-input-stream/imm32
2764
2765 e8/call emit-segments/disp32
2766
2767 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2768
2769
2770
2771 68/push _test-output-buffered-file/imm32
2772
2773 e8/call flush/disp32
2774
2775 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2776 +-- 33 lines: #? # dump output -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2809
2810
2811 68/push "F - test-emit-segments-code-label/0"/imm32
2812 68/push "ab cd "/imm32
2813 68/push _test-output-stream/imm32
2814
2815 e8/call check-next-stream-line-equal/disp32
2816
2817 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2818
2819
2820 68/push "F - test-emit-segments-code-label/1"/imm32
2821 68/push "ef gh "/imm32
2822 68/push _test-output-stream/imm32
2823
2824 e8/call check-next-stream-line-equal/disp32
2825
2826 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2827
2828
2829 68/push "F - test-emit-segments-code-label/2"/imm32
2830 68/push "ij f9 ff ff ff "/imm32
2831 68/push _test-output-stream/imm32
2832
2833 e8/call check-next-stream-line-equal/disp32
2834
2835 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2836
2837 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2838 5d/pop-to-ebp
2839 c3/return
2840
2841 test-emit-segments-code-label-absolute:
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860 55/push-ebp
2861 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2862
2863
2864
2865 68/push _test-input-stream/imm32
2866
2867 e8/call clear-stream/disp32
2868
2869 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2870
2871
2872 68/push _test-output-stream/imm32
2873
2874 e8/call clear-stream/disp32
2875
2876 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2877
2878
2879 68/push $_test-output-buffered-file->buffer/imm32
2880
2881 e8/call clear-stream/disp32
2882
2883 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2884
2885 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
2886 68/push 0xc0/imm32/size
2887 68/push 0/imm32/read
2888 68/push 0/imm32/write
2889 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
2890
2891 68/push 0/imm32
2892 68/push 0/imm32
2893 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
2894
2895
2896
2897 68/push "== code 0x1000\n"/imm32
2898 68/push _test-input-stream/imm32
2899
2900 e8/call write/disp32
2901
2902 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2903
2904
2905 68/push "ab cd\n"/imm32
2906 68/push _test-input-stream/imm32
2907
2908 e8/call write/disp32
2909
2910 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2911
2912
2913 68/push "l1:\n"/imm32
2914 68/push _test-input-stream/imm32
2915
2916 e8/call write/disp32
2917
2918 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2919
2920
2921 68/push " ef gh\n"/imm32
2922 68/push _test-input-stream/imm32
2923
2924 e8/call write/disp32
2925
2926 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2927
2928
2929 68/push " ij l1/imm32\n"/imm32
2930 68/push _test-input-stream/imm32
2931
2932 e8/call write/disp32
2933
2934 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2935
2936 68/push 0x1056/imm32/label-address
2937 68/push 2/imm32/segment-offset
2938
2939 53/push-ebx
2940 68/push "code"/imm32
2941 68/push Heap/imm32
2942 e8/call copy-array/disp32
2943 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2944 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
2945 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
2946
2947 53/push-ebx
2948 68/push "l1"/imm32
2949 68/push Heap/imm32
2950 e8/call copy-array/disp32
2951 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2952 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
2953 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
2954
2955 52/push-edx
2956
2957 e8/call stream-add6/disp32
2958
2959 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x1c/imm32
2960
2961
2962
2963 52/push-edx
2964 68/push _test-output-buffered-file/imm32
2965 68/push _test-input-stream/imm32
2966
2967 e8/call emit-segments/disp32
2968
2969 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2970
2971
2972
2973 68/push _test-output-buffered-file/imm32
2974
2975 e8/call flush/disp32
2976
2977 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2978 +-- 33 lines: #? # dump output -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3011
3012
3013 68/push "F - test-emit-segments-code-label-absolute/0"/imm32
3014 68/push "ab cd "/imm32
3015 68/push _test-output-stream/imm32
3016
3017 e8/call check-next-stream-line-equal/disp32
3018
3019 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3020
3021
3022 68/push "F - test-emit-segments-code-label-absolute/1"/imm32
3023 68/push "ef gh "/imm32
3024 68/push _test-output-stream/imm32
3025
3026 e8/call check-next-stream-line-equal/disp32
3027
3028 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3029
3030
3031 68/push "F - test-emit-segments-code-label-absolute/2"/imm32
3032 68/push "ij 56 10 00 00 "/imm32
3033 68/push _test-output-stream/imm32
3034
3035 e8/call check-next-stream-line-equal/disp32
3036
3037 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3038
3039 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3040 5d/pop-to-ebp
3041 c3/return
3042
3043 emit-headers:
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054 55/push-ebp
3055 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3056
3057 50/push-eax
3058 51/push-ecx
3059
3060
3061 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3062 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3063 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3064
3065 e8/call emit-elf-header/disp32
3066
3067 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3068
3069 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 .
3070
3071 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3072
3073 8d/copy-address 1/mod/*+disp8 0/rm32/eax . . . 0/r32/eax 0xc/disp8 .
3074
3075 01/add 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . .
3076 $emit-headers:loop:
3077
3078 39/compare 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . .
3079 0f 83/jump-if-addr>= $emit-headers:end/disp32
3080 +-- 63 lines: #? # dump curr-segment->name -------------------------------------------------------------------------------------------------------------------------------------------------------------------
3143 +-- 9 lines: #? # write(2/stderr, "emit-segment-header\n") --------------------------------------------------------------------------------------------------------------------------------------------------
3152
3153
3154 50/push-eax
3155 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3156
3157 e8/call emit-elf-program-header-entry/disp32
3158
3159 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3160
3161 81 0/subop/add 3/mod/direct 0/rm32/eax . . . . . 0x14/imm32
3162 e9/jump $emit-headers:loop/disp32
3163 $emit-headers:end:
3164
3165 59/pop-to-ecx
3166 58/pop-to-eax
3167
3168 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3169 5d/pop-to-ebp
3170 c3/return
3171
3172 emit-elf-header:
3173
3174
3175
3176
3177
3178
3179
3180 55/push-ebp
3181 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3182
3183 50/push-eax
3184 51/push-ecx
3185 52/push-edx
3186
3187
3188 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0x10/disp8 .
3189
3190
3191 68/push "label table"/imm32
3192 68/push 0x18/imm32/row-size
3193 68/push "Entry"/imm32
3194 50/push-eax
3195
3196 e8/call get/disp32
3197
3198 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
3199
3200 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 0/r32/eax 0xc/disp8 .
3201
3202 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax $Elf_e_entry/disp32
3203
3204
3205 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 .
3206
3207 8b/copy 0/mod/indirect 0/rm32/eax . . . 0/r32/eax . .
3208
3209 b9/copy-to-ecx 0x14/imm32
3210 31/xor 3/mod/direct 2/rm32/edx . . . 2/r32/edx . .
3211 f7 7/subop/idiv 3/mod/direct 1/rm32/ecx . . . . . .
3212
3213 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax $Elf_e_phnum/disp32
3214
3215
3216 68/push Elf_header/imm32
3217 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3218
3219 e8/call emit-hex-array/disp32
3220
3221 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3222
3223
3224 68/push Newline/imm32
3225 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3226
3227 e8/call write-buffered/disp32
3228
3229 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3230 $emit-elf-header:end:
3231
3232 5a/pop-to-edx
3233 59/pop-to-ecx
3234 58/pop-to-eax
3235
3236 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3237 5d/pop-to-ebp
3238 c3/return
3239
3240
3241
3242 emit-elf-program-header-entry:
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257 55/push-ebp
3258 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3259
3260 50/push-eax
3261 56/push-esi
3262
3263 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
3264
3265
3266 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 0xc/disp8 .
3267
3268 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax $Elf_p_offset/disp32
3269
3270
3271 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 8/disp8 .
3272
3273 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax $Elf_p_vaddr/disp32
3274
3275 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax $Elf_p_paddr/disp32
3276
3277
3278 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 0x10/disp8 .
3279
3280 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax $Elf_p_filesz/disp32
3281
3282 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax $Elf_p_memsz/disp32
3283
3284
3285
3286 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
3287 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
3288
3289 e8/call lookup/disp32
3290
3291 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3292
3293
3294 68/push "code"/imm32
3295 50/push-eax
3296
3297 e8/call string-equal?/disp32
3298
3299 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3300
3301 3d/compare-eax-and 0/imm32/false
3302 74/jump-if-= $emit-elf-program-header-entry:data/disp8
3303
3304 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . $Elf_p_flags/disp32 5/imm32
3305 eb/jump $emit-elf-program-header-entry:really-emit/disp8
3306 $emit-elf-program-header-entry:data:
3307
3308 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . $Elf_p_flags/disp32 6/imm32
3309 $emit-elf-program-header-entry:really-emit:
3310
3311
3312 68/push Elf_program_header_entry/imm32
3313 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3314
3315 e8/call emit-hex-array/disp32
3316
3317 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3318
3319
3320 68/push Newline/imm32
3321 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3322
3323 e8/call write-buffered/disp32
3324
3325 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3326 $emit-elf-program-header-entry:end:
3327
3328 5e/pop-to-esi
3329 58/pop-to-eax
3330
3331 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3332 5d/pop-to-ebp
3333 c3/return
3334
3335
3336
3337 stream-add4:
3338
3339 55/push-ebp
3340 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3341
3342 50/push-eax
3343 51/push-ecx
3344 52/push-edx
3345 56/push-esi
3346
3347 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
3348
3349
3350 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
3351
3352 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 0/r32/eax 0xc/disp8 .
3353
3354
3355 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 8/disp8 .
3356
3357 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 2/index/edx . 2/r32/edx 0xc/disp8 .
3358
3359 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3360 73/jump-if-addr>= $stream-add4:abort/disp8
3361
3362 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0xc/disp8 .
3363 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3364
3365 05/add-to-eax 4/imm32
3366
3367 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3368 73/jump-if-addr>= $stream-add4:abort/disp8
3369
3370 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x10/disp8 .
3371 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3372
3373 05/add-to-eax 4/imm32
3374
3375 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3376 73/jump-if-addr>= $stream-add4:abort/disp8
3377
3378 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x14/disp8 .
3379 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3380
3381 05/add-to-eax 4/imm32
3382
3383 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3384 73/jump-if-addr>= $stream-add4:abort/disp8
3385
3386 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x18/disp8 .
3387 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3388
3389 81 0/subop/add 0/mod/indirect 6/rm32/esi . . . . . 0x10/imm32
3390 $stream-add4:end:
3391
3392 5e/pop-to-esi
3393 5a/pop-to-edx
3394 59/pop-to-ecx
3395 58/pop-to-eax
3396
3397 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3398 5d/pop-to-ebp
3399 c3/return
3400
3401 $stream-add4:abort:
3402
3403
3404 68/push "overflow in stream-add4\n"/imm32
3405 68/push 2/imm32/stderr
3406
3407 e8/call _write/disp32
3408
3409 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3410
3411 bb/copy-to-ebx 1/imm32
3412 e8/call syscall_exit/disp32
3413
3414
3415 stream-add5:
3416
3417 55/push-ebp
3418 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3419
3420 50/push-eax
3421 51/push-ecx
3422 52/push-edx
3423 56/push-esi
3424
3425 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
3426
3427
3428 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
3429
3430 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 0/r32/eax 0xc/disp8 .
3431
3432
3433 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 8/disp8 .
3434
3435 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 2/index/edx . 2/r32/edx 0xc/disp8 .
3436
3437 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3438 73/jump-if-addr>= $stream-add5:abort/disp8
3439
3440 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0xc/disp8 .
3441 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3442
3443 05/add-to-eax 4/imm32
3444
3445 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3446 73/jump-if-addr>= $stream-add5:abort/disp8
3447
3448 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x10/disp8 .
3449 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3450
3451 05/add-to-eax 4/imm32
3452
3453 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3454 73/jump-if-addr>= $stream-add5:abort/disp8
3455
3456 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x14/disp8 .
3457 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3458
3459 05/add-to-eax 4/imm32
3460
3461 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3462 73/jump-if-addr>= $stream-add5:abort/disp8
3463
3464 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x18/disp8 .
3465 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3466
3467 05/add-to-eax 4/imm32
3468
3469 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3470 73/jump-if-addr>= $stream-add5:abort/disp8
3471
3472 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x1c/disp8 .
3473 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3474
3475 81 0/subop/add 0/mod/indirect 6/rm32/esi . . . . . 0x14/imm32
3476 $stream-add5:end:
3477
3478 5e/pop-to-esi
3479 5a/pop-to-edx
3480 59/pop-to-ecx
3481 58/pop-to-eax
3482
3483 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3484 5d/pop-to-ebp
3485 c3/return
3486
3487 $stream-add5:abort:
3488
3489
3490 68/push "overflow in stream-add5\n"/imm32
3491 68/push 2/imm32/stderr
3492
3493 e8/call _write/disp32
3494
3495 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3496
3497 bb/copy-to-ebx 1/imm32
3498 e8/call syscall_exit/disp32
3499
3500
3501 stream-add6:
3502
3503 55/push-ebp
3504 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3505
3506 50/push-eax
3507 51/push-ecx
3508 52/push-edx
3509 56/push-esi
3510
3511 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
3512
3513
3514 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
3515
3516 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 0/r32/eax 0xc/disp8 .
3517
3518
3519 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 8/disp8 .
3520
3521 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 2/index/edx . 2/r32/edx 0xc/disp8 .
3522
3523 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3524 73/jump-if-addr>= $stream-add6:abort/disp8
3525
3526 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0xc/disp8 .
3527 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3528
3529 05/add-to-eax 4/imm32
3530
3531 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3532 73/jump-if-addr>= $stream-add6:abort/disp8
3533
3534 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x10/disp8 .
3535 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3536
3537 05/add-to-eax 4/imm32
3538
3539 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3540 73/jump-if-addr>= $stream-add6:abort/disp8
3541
3542 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x14/disp8 .
3543 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3544
3545 05/add-to-eax 4/imm32
3546
3547 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3548 73/jump-if-addr>= $stream-add6:abort/disp8
3549
3550 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x18/disp8 .
3551 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3552
3553 05/add-to-eax 4/imm32
3554
3555 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3556 73/jump-if-addr>= $stream-add6:abort/disp8
3557 $aa-write-segment-offset:
3558
3559 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x1c/disp8 .
3560 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3561
3562 05/add-to-eax 4/imm32
3563
3564 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3565 73/jump-if-addr>= $stream-add6:abort/disp8
3566
3567 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x20/disp8 .
3568 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3569
3570 81 0/subop/add 0/mod/indirect 6/rm32/esi . . . . . 0x18/imm32
3571 $stream-add6:end:
3572
3573 5e/pop-to-esi
3574 5a/pop-to-edx
3575 59/pop-to-ecx
3576 58/pop-to-eax
3577
3578 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3579 5d/pop-to-ebp
3580 c3/return
3581
3582 $stream-add6:abort:
3583
3584
3585 68/push "overflow in stream-add6\n"/imm32
3586 68/push 2/imm32/stderr
3587
3588 e8/call _write/disp32
3589
3590 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3591
3592 bb/copy-to-ebx 1/imm32
3593 e8/call syscall_exit/disp32
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603 trace-sssns:
3604
3605 55/push-ebp
3606 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3607
3608
3609 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3610 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3611
3612 e8/call write/disp32
3613
3614 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3615
3616
3617 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3618 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3619
3620 e8/call write/disp32
3621
3622 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3623
3624
3625 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3626 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3627
3628 e8/call write/disp32
3629
3630 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3631
3632
3633 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
3634 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3635
3636 e8/call write-int32-hex/disp32
3637
3638 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3639
3640
3641 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
3642
3643 e8/call trace/disp32
3644
3645 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3646 $trace-sssns:end:
3647
3648 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3649 5d/pop-to-ebp
3650 c3/return
3651
3652 test-trace-sssns:
3653
3654 55/push-ebp
3655 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3656
3657
3658 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
3659 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
3660
3661
3662 68/push " e"/imm32
3663 68/push 3/imm32
3664 68/push "c "/imm32
3665 68/push "b"/imm32
3666 68/push "A"/imm32
3667
3668 e8/call trace-sssns/disp32
3669
3670 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
3671 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3697
3698
3699 68/push "F - test-trace-sssns"/imm32
3700 68/push "Abc 0x00000003 e"/imm32
3701
3702 e8/call check-trace-contains/disp32
3703
3704 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3705
3706 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3707 5d/pop-to-ebp
3708 c3/return
3709
3710 trace-snsns:
3711
3712 55/push-ebp
3713 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3714
3715
3716 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3717 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3718
3719 e8/call write/disp32
3720
3721 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3722
3723
3724 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3725 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3726
3727 e8/call write-int32-hex/disp32
3728
3729 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3730
3731
3732 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3733 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3734
3735 e8/call write/disp32
3736
3737 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3738
3739
3740 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
3741 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3742
3743 e8/call write-int32-hex/disp32
3744
3745 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3746
3747
3748 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
3749
3750 e8/call trace/disp32
3751
3752 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3753 $trace-snsns:end:
3754
3755 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3756 5d/pop-to-ebp
3757 c3/return
3758
3759 test-trace-snsns:
3760
3761 55/push-ebp
3762 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3763
3764
3765 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
3766 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
3767
3768
3769 68/push " e"/imm32
3770 68/push 3/imm32
3771 68/push " c "/imm32
3772 68/push 2/imm32
3773 68/push "A "/imm32
3774
3775 e8/call trace-snsns/disp32
3776
3777 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
3778 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3804
3805
3806 68/push "F - test-trace-snsns"/imm32
3807 68/push "A 0x00000002 c 0x00000003 e"/imm32
3808
3809 e8/call check-trace-contains/disp32
3810
3811 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3812
3813 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3814 5d/pop-to-ebp
3815 c3/return
3816
3817 trace-slsls:
3818
3819 55/push-ebp
3820 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3821
3822
3823 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3824 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3825
3826 e8/call write/disp32
3827
3828 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3829
3830
3831 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3832 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3833
3834 e8/call write-slice/disp32
3835
3836 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3837
3838
3839 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3840 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3841
3842 e8/call write/disp32
3843
3844 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3845
3846
3847 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
3848 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3849
3850 e8/call write-slice/disp32
3851
3852 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3853
3854
3855 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
3856
3857 e8/call trace/disp32
3858
3859 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3860 $trace-slsls:end:
3861
3862 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3863 5d/pop-to-ebp
3864 c3/return
3865
3866 test-trace-slsls:
3867
3868 55/push-ebp
3869 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3870
3871
3872 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
3873 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
3874
3875 b8/copy-to-eax "b"/imm32
3876 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3877 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
3878 05/add-to-eax 4/imm32
3879
3880 51/push-ecx
3881 50/push-eax
3882 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
3883
3884 b8/copy-to-eax "d"/imm32
3885 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3886 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
3887 05/add-to-eax 4/imm32
3888
3889 51/push-ecx
3890 50/push-eax
3891 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
3892
3893
3894 68/push "e"/imm32
3895 52/push-edx
3896 68/push "c"/imm32
3897 53/push-ebx
3898 68/push "A"/imm32
3899
3900 e8/call trace-slsls/disp32
3901
3902 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
3903 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3929
3930
3931 68/push "F - test-trace-slsls"/imm32
3932 68/push "Abcde"/imm32
3933
3934 e8/call check-trace-contains/disp32
3935
3936 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3937
3938 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3939 5d/pop-to-ebp
3940 c3/return
3941
3942 trace-slsns:
3943
3944 55/push-ebp
3945 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3946
3947
3948 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3949 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3950
3951 e8/call write/disp32
3952
3953 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3954
3955
3956 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3957 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3958
3959 e8/call write-slice/disp32
3960
3961 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3962
3963
3964 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3965 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3966
3967 e8/call write/disp32
3968
3969 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3970
3971
3972 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
3973 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3974
3975 e8/call write-int32-hex/disp32
3976
3977 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3978
3979
3980 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
3981
3982 e8/call trace/disp32
3983
3984 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3985 $trace-slsns:end:
3986
3987 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3988 5d/pop-to-ebp
3989 c3/return
3990
3991 test-trace-slsns:
3992
3993 55/push-ebp
3994 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3995
3996
3997 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
3998 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
3999
4000 b8/copy-to-eax "b"/imm32
4001 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
4002 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
4003 05/add-to-eax 4/imm32
4004
4005 51/push-ecx
4006 50/push-eax
4007 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
4008
4009
4010 68/push " e"/imm32
4011 68/push 3/imm32
4012 68/push "c "/imm32
4013 53/push-ebx
4014 68/push "A"/imm32
4015
4016 e8/call trace-slsns/disp32
4017
4018 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
4019 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4045
4046
4047 68/push "F - test-trace-slsls"/imm32
4048 68/push "Abc 0x00000003 e"/imm32
4049
4050 e8/call check-trace-contains/disp32
4051
4052 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4053
4054 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4055 5d/pop-to-ebp
4056 c3/return
4057
4058 trace-slsss:
4059
4060 55/push-ebp
4061 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4062
4063
4064 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
4065 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
4066
4067 e8/call write/disp32
4068
4069 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4070
4071
4072 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
4073 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
4074
4075 e8/call write-slice/disp32
4076
4077 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4078
4079
4080 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
4081 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
4082
4083 e8/call write/disp32
4084
4085 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4086
4087
4088 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
4089 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
4090
4091 e8/call write/disp32
4092
4093 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4094
4095
4096 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
4097
4098 e8/call trace/disp32
4099
4100 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4101 $trace-slsss:end:
4102
4103 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4104 5d/pop-to-ebp
4105 c3/return
4106
4107 test-trace-slsss:
4108
4109 55/push-ebp
4110 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4111
4112
4113 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
4114 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
4115
4116 b8/copy-to-eax "b"/imm32
4117 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
4118 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
4119 05/add-to-eax 4/imm32
4120
4121 51/push-ecx
4122 50/push-eax
4123 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
4124
4125
4126 68/push "e"/imm32
4127 68/push "d"/imm32
4128 68/push "c"/imm32
4129 53/push-ebx
4130 68/push "A"/imm32
4131
4132 e8/call trace-slsss/disp32
4133
4134 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
4135 +-- 26 lines: #? # dump *Trace-stream ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4161
4162
4163 68/push "F - test-trace-slsss"/imm32
4164 68/push "Abcde"/imm32
4165
4166 e8/call check-trace-contains/disp32
4167
4168 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4169
4170 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4171 5d/pop-to-ebp
4172 c3/return
4173
4174 num-bytes:
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191 55/push-ebp
4192 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4193
4194 51/push-ecx
4195 52/push-edx
4196 53/push-ebx
4197
4198 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
4199
4200 68/push 0/imm32/end
4201 68/push 0/imm32/start
4202 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
4203 +-- 26 lines: #? # dump line ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4229
4230
4231 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
4232
4233 e8/call rewind-stream/disp32
4234
4235 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4236 $num-bytes:loop:
4237
4238
4239 51/push-ecx
4240 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
4241
4242 e8/call next-word/disp32
4243
4244 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4245 +-- 40 lines: #? # dump word-slice ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4285 $num-bytes:check0:
4286
4287
4288 50/push-eax
4289
4290
4291 51/push-ecx
4292
4293 e8/call slice-empty?/disp32
4294
4295 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4296
4297 3d/compare-eax-and 0/imm32/false
4298
4299 58/pop-to-eax
4300 75/jump-if-!= $num-bytes:end/disp8
4301 $num-bytes:check-for-comment:
4302
4303
4304 8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . .
4305
4306 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
4307 8a/copy-byte 0/mod/indirect 2/rm32/edx . . . 3/r32/BL . .
4308
4309 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x23/imm32/hash
4310 74/jump-if-= $num-bytes:end/disp8
4311 $num-bytes:check-for-label:
4312
4313
4314 8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 4/disp8 .
4315
4316 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
4317 8a/copy-byte 1/mod/*+disp8 2/rm32/edx . . . 3/r32/BL -1/disp8 .
4318
4319 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x3a/imm32/colon
4320 74/jump-if-= $num-bytes:end/disp8
4321 $num-bytes:check-for-segment-header:
4322
4323
4324 50/push-eax
4325
4326
4327 68/push "=="/imm32
4328 51/push-ecx
4329
4330 e8/call slice-equal?/disp32
4331
4332 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4333
4334 3d/compare-eax-and 0/imm32/false
4335
4336 58/pop-to-eax
4337 75/jump-if-!= $num-bytes:end/disp8
4338 $num-bytes:loop-body:
4339
4340
4341 89/copy 3/mod/direct 2/rm32/edx . . . 0/r32/eax . .
4342
4343
4344 51/push-ecx
4345
4346 e8/call compute-width-of-slice/disp32
4347
4348 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4349
4350 01/add 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
4351 e9/jump $num-bytes:loop/disp32
4352 $num-bytes:end:
4353
4354
4355 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
4356
4357 e8/call rewind-stream/disp32
4358
4359 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4360
4361 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4362
4363 5b/pop-to-ebx
4364 5a/pop-to-edx
4365 59/pop-to-ecx
4366
4367 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4368 5d/pop-to-ebp
4369 c3/return
4370
4371 test-num-bytes-handles-empty-string:
4372
4373
4374 55/push-ebp
4375 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4376
4377
4378
4379 68/push _test-input-stream/imm32
4380
4381 e8/call clear-stream/disp32
4382
4383 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4384
4385
4386 68/push _test-output-stream/imm32
4387
4388 e8/call clear-stream/disp32
4389
4390 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4391
4392
4393
4394 68/push _test-input-stream/imm32
4395
4396 e8/call num-bytes/disp32
4397
4398 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4399
4400
4401 68/push "F - test-num-bytes-handles-empty-string"/imm32
4402 68/push 0/imm32/true
4403 50/push-eax
4404
4405 e8/call check-ints-equal/disp32
4406
4407 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4408
4409 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4410 5d/pop-to-ebp
4411 c3/return
4412
4413 test-num-bytes-ignores-comments:
4414
4415
4416 55/push-ebp
4417 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4418
4419
4420
4421 68/push _test-input-stream/imm32
4422
4423 e8/call clear-stream/disp32
4424
4425 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4426
4427
4428 68/push _test-output-stream/imm32
4429
4430 e8/call clear-stream/disp32
4431
4432 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4433
4434
4435
4436 68/push "# abcd"/imm32
4437 68/push _test-input-stream/imm32
4438
4439 e8/call write/disp32
4440
4441 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4442
4443
4444 68/push _test-input-stream/imm32
4445
4446 e8/call num-bytes/disp32
4447
4448 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4449
4450
4451 68/push "F - test-num-bytes-ignores-comments"/imm32
4452 68/push 0/imm32/true
4453 50/push-eax
4454
4455 e8/call check-ints-equal/disp32
4456
4457 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4458
4459 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4460 5d/pop-to-ebp
4461 c3/return
4462
4463 test-num-bytes-ignores-labels:
4464
4465
4466 55/push-ebp
4467 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4468
4469
4470
4471 68/push _test-input-stream/imm32
4472
4473 e8/call clear-stream/disp32
4474
4475 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4476
4477
4478 68/push _test-output-stream/imm32
4479
4480 e8/call clear-stream/disp32
4481
4482 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4483
4484
4485
4486 68/push "ab: # cd"/imm32
4487 68/push _test-input-stream/imm32
4488
4489 e8/call write/disp32
4490
4491 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4492
4493
4494 68/push _test-input-stream/imm32
4495
4496 e8/call num-bytes/disp32
4497
4498 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4499
4500
4501 68/push "F - test-num-bytes-ignores-labels"/imm32
4502 68/push 0/imm32/true
4503 50/push-eax
4504
4505 e8/call check-ints-equal/disp32
4506
4507 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4508
4509 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4510 5d/pop-to-ebp
4511 c3/return
4512
4513 test-num-bytes-ignores-segment-headers:
4514
4515
4516 55/push-ebp
4517 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4518
4519
4520
4521 68/push _test-input-stream/imm32
4522
4523 e8/call clear-stream/disp32
4524
4525 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4526
4527
4528 68/push _test-output-stream/imm32
4529
4530 e8/call clear-stream/disp32
4531
4532 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4533
4534
4535
4536 68/push "== ab cd"/imm32
4537 68/push _test-input-stream/imm32
4538
4539 e8/call write/disp32
4540
4541 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4542
4543
4544 68/push _test-input-stream/imm32
4545
4546 e8/call num-bytes/disp32
4547
4548 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4549
4550
4551 68/push "F - test-num-bytes-ignores-segment-headers"/imm32
4552 68/push 0/imm32/true
4553 50/push-eax
4554
4555 e8/call check-ints-equal/disp32
4556
4557 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4558
4559 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4560 5d/pop-to-ebp
4561 c3/return
4562
4563 test-num-bytes-counts-words-by-default:
4564
4565
4566 55/push-ebp
4567 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4568
4569
4570
4571 68/push _test-input-stream/imm32
4572
4573 e8/call clear-stream/disp32
4574
4575 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4576
4577
4578 68/push _test-output-stream/imm32
4579
4580 e8/call clear-stream/disp32
4581
4582 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4583
4584
4585
4586 68/push "ab cd ef"/imm32
4587 68/push _test-input-stream/imm32
4588
4589 e8/call write/disp32
4590
4591 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4592
4593
4594 68/push _test-input-stream/imm32
4595
4596 e8/call num-bytes/disp32
4597
4598 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4599
4600
4601 68/push "F - test-num-bytes-counts-words-by-default"/imm32
4602 68/push 3/imm32/true
4603 50/push-eax
4604
4605 e8/call check-ints-equal/disp32
4606
4607 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4608
4609 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4610 5d/pop-to-ebp
4611 c3/return
4612
4613 test-num-bytes-ignores-trailing-comment:
4614
4615
4616 55/push-ebp
4617 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4618
4619
4620
4621 68/push _test-input-stream/imm32
4622
4623 e8/call clear-stream/disp32
4624
4625 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4626
4627
4628 68/push _test-output-stream/imm32
4629
4630 e8/call clear-stream/disp32
4631
4632 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4633
4634
4635
4636 68/push "ab cd # ef"/imm32
4637 68/push _test-input-stream/imm32
4638
4639 e8/call write/disp32
4640
4641 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4642
4643
4644 68/push _test-input-stream/imm32
4645
4646 e8/call num-bytes/disp32
4647
4648 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4649
4650
4651 68/push "F - test-num-bytes-ignores-trailing-comment"/imm32
4652 68/push 2/imm32/true
4653 50/push-eax
4654
4655 e8/call check-ints-equal/disp32
4656
4657 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4658
4659 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4660 5d/pop-to-ebp
4661 c3/return
4662
4663 test-num-bytes-handles-imm32:
4664
4665
4666 55/push-ebp
4667 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4668
4669
4670
4671 68/push _test-input-stream/imm32
4672
4673 e8/call clear-stream/disp32
4674
4675 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4676
4677
4678 68/push _test-output-stream/imm32
4679
4680 e8/call clear-stream/disp32
4681
4682 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4683
4684
4685
4686 68/push "ab cd/imm32 ef"/imm32
4687 68/push _test-input-stream/imm32
4688
4689 e8/call write/disp32
4690
4691 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4692
4693
4694 68/push _test-input-stream/imm32
4695
4696 e8/call num-bytes/disp32
4697
4698 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4699
4700
4701 68/push "F - test-num-bytes-handles-imm32"/imm32
4702 68/push 6/imm32/true
4703 50/push-eax
4704
4705 e8/call check-ints-equal/disp32
4706
4707 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4708
4709 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4710 5d/pop-to-ebp
4711 c3/return
4712
4713 == data
4714
4715
4716
4717
4718 Elf_header:
4719
4720 0x34/imm32
4721
4722 $e_ident:
4723 7f 45/E 4c/L 46/F
4724 01/32-bit 01/little-endian 01/file-version 00/no-os-extensions
4725 00 00 00 00 00 00 00 00
4726 $e_type:
4727 02 00
4728 $e_machine:
4729 03 00
4730 $e_version:
4731 1/imm32
4732 $Elf_e_entry:
4733 0x09000000/imm32
4734 $e_phoff:
4735 0x34/imm32
4736 $e_shoff:
4737 0/imm32
4738 $e_flags:
4739 0/imm32
4740 $e_ehsize:
4741 0x34 00
4742 $e_phentsize:
4743 0x20 00
4744 $Elf_e_phnum:
4745 00 00
4746 $e_shentsize:
4747 00 00
4748 $e_shnum:
4749 00 00
4750 $e_shstrndx:
4751 00 00
4752
4753
4754
4755
4756 Elf_program_header_entry:
4757
4758 0x20/imm32
4759
4760 $p_type:
4761 1/imm32/PT_LOAD
4762 $Elf_p_offset:
4763 0/imm32
4764 $Elf_p_vaddr:
4765 0/imm32
4766 $Elf_p_paddr:
4767 0/imm32
4768 $Elf_p_filesz:
4769 0/imm32
4770 $Elf_p_memsz:
4771 0/imm32
4772 $Elf_p_flags:
4773 6/imm32/rw-
4774 $p_align:
4775
4776
4777 0x1000/imm32
4778
4779