https://github.com/akkartik/mu/blob/main/linux/survey_elf.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
498 51/push-ecx
499
500 e8/call clear-stream/disp32
501
502 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
503
504
505 51/push-ecx
506 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
507
508 e8/call read-line/disp32
509
510 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
511
512 8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . .
513 3d/compare-eax-and 0/imm32
514 0f 84/jump-if-= $compute-offsets:break-line-loop/disp32
515 +-- 33 lines: #? # dump line -------------------------------------------------------------------------------------------------------------------------------------------
548 $compute-offsets:word-loop:
549
550
551 52/push-edx
552 51/push-ecx
553
554 e8/call next-word/disp32
555
556 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
557 $compute-offsets:case-empty:
558
559
560
561 52/push-edx
562
563 e8/call slice-empty?/disp32
564
565 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
566
567 3d/compare-eax-and 0/imm32/false
568 0f 85/jump-if-!= $compute-offsets:line-loop/disp32
569 $compute-offsets:case-comment:
570
571
572 68/push "#"/imm32
573 52/push-edx
574
575 e8/call slice-starts-with?/disp32
576
577 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
578
579 3d/compare-eax-and 0/imm32/false
580 0f 85/jump-if-!= $compute-offsets:line-loop/disp32
581 $compute-offsets:case-segment-header:
582
583
584
585 68/push "=="/imm32
586 52/push-edx
587
588 e8/call slice-equal?/disp32
589
590 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
591
592 3d/compare-eax-and 0/imm32/false
593 0f 84/jump-if-= $compute-offsets:case-label/disp32
594
595 81 7/subop/compare 0/mod/indirect 6/rm32/esi . . . . . 0/imm32
596 74/jump-if-= $compute-offsets:construct-next-segment/disp8
597
598
599
600 68/push 0x14/imm32/row-size
601 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
602 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
603 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
604
605 e8/call get-or-insert-handle/disp32
606
607 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
608
609 89/copy 3/mod/direct 7/rm32/edi . . . 0/r32/eax . .
610
611
612 51/push-ecx
613
614 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx compute-offsets:file-offset/disp32
615
616 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 1/r32/ecx 4/disp8 .
617
618 29/subtract 3/mod/direct 3/rm32/ebx . . . 1/r32/ecx . .
619
620 89/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 8/disp8 .
621
622 59/pop-to-ecx
623
624
625
626 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
627 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
628
629 e8/call lookup/disp32
630
631 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
632
633
634 68/push "."/imm32
635 53/push-ebx
636 68/push "' has size "/imm32
637 50/push-eax
638 68/push "segment '"/imm32
639
640 e8/call trace-sssns/disp32
641
642 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
643 $compute-offsets:construct-next-segment:
644
645
646 68/push compute-offsets:segment-tmp/imm32
647 51/push-ecx
648
649 e8/call next-word/disp32
650
651 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
652
653
654
655 68/push compute-offsets:segment-tmp/imm32
656
657 e8/call slice-empty?/disp32
658
659 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
660
661 3d/compare-eax-and 0/imm32/false
662 0f 85/jump-if-!= $compute-offsets:abort/disp32
663 $compute-offsets:update-curr-segment-name:
664
665
666 56/push-esi
667 68/push compute-offsets:segment-tmp/imm32
668 68/push Heap/imm32
669
670 e8/call slice-to-string/disp32
671
672 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
673
674
675 68/push compute-offsets:segment-tmp/imm32
676 51/push-ecx
677
678 e8/call next-word/disp32
679
680 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
681
682
683
684 68/push compute-offsets:segment-tmp/imm32
685
686 e8/call slice-empty?/disp32
687
688 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
689
690 3d/compare-eax-and 0/imm32/false
691 0f 85/jump-if-!= $compute-offsets:abort/disp32
692
693
694
695 68/push 0x14/imm32/row-size
696 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
697 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
698 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
699
700 e8/call get-or-insert-handle/disp32
701
702 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
703
704 89/copy 3/mod/direct 7/rm32/edi . . . 0/r32/eax . .
705
706
707
708 68/push compute-offsets:segment-tmp/imm32
709
710 e8/call parse-hex-int-from-slice/disp32
711
712 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
713
714 89/copy 0/mod/indirect 7/rm32/edi . . . 0/r32/eax . .
715
716 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax compute-offsets:file-offset/disp32
717 89/copy 1/mod/*+disp8 7/rm32/edi . . . 0/r32/eax 4/disp8 .
718
719
720
721 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
722 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
723
724 e8/call lookup/disp32
725
726 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
727
728
729 68/push "."/imm32
730 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:file-offset/disp32
731 68/push "' is at file offset "/imm32
732 50/push-eax
733 68/push "segment '"/imm32
734
735 e8/call trace-sssns/disp32
736
737 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
738
739 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:segment-offset/disp32 0/imm32
740
741 e9/jump $compute-offsets:line-loop/disp32
742 $compute-offsets:case-label:
743
744
745
746 52/push-edx
747
748 e8/call label?/disp32
749
750 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
751
752 3d/compare-eax-and 0/imm32/false
753 0f 84/jump-if-= $compute-offsets:case-default/disp32
754
755 ff 1/subop/decrement 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
756
757
758
759 68/push Heap/imm32
760 68/push 0x18/imm32/row-size
761 52/push-edx
762 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
763
764 e8/call get-or-insert-slice/disp32
765
766 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
767
768 89/copy 3/mod/direct 7/rm32/edi . . . 0/r32/eax . .
769 $compute-offsets:save-label-offset:
770
771 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
772 89/copy 0/mod/indirect 7/rm32/edi . . . 0/r32/eax . .
773 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 4/disp8 .
774 89/copy 1/mod/*+disp8 7/rm32/edi . . . 0/r32/eax 4/disp8 .
775
776
777
778 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
779 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
780
781 e8/call lookup/disp32
782
783 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
784
785
786 68/push "'."/imm32
787 50/push-eax
788 68/push "' is in segment '"/imm32
789 52/push-edx
790 68/push "label '"/imm32
791
792 e8/call trace-slsss/disp32
793
794 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
795
796
797 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx compute-offsets:segment-offset/disp32
798
799 89/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 8/disp8 .
800
801
802 68/push "."/imm32
803 53/push-ebx
804 68/push "' is at segment offset "/imm32
805 52/push-edx
806 68/push "label '"/imm32
807
808 e8/call trace-slsns/disp32
809
810 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
811
812 e9/jump $compute-offsets:word-loop/disp32
813 $compute-offsets:case-default:
814
815
816 52/push-edx
817
818 e8/call compute-width-of-slice/disp32
819
820 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
821
822 01/add 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax compute-offsets:segment-offset/disp32
823
824 01/add 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax compute-offsets:file-offset/disp32
825 +-- 41 lines: #? # dump segment-offset ---------------------------------------------------------------------------------------------------------------------------------
866 e9/jump $compute-offsets:word-loop/disp32
867 $compute-offsets:break-line-loop:
868
869
870
871 68/push 0x14/imm32/row-size
872 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
873 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
874 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
875
876 e8/call get-or-insert-handle/disp32
877
878 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
879
880 89/copy 3/mod/direct 7/rm32/edi . . . 0/r32/eax . .
881
882
883 51/push-ecx
884
885 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx compute-offsets:file-offset/disp32
886
887 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 1/r32/ecx 4/disp8 .
888
889 29/subtract 3/mod/direct 3/rm32/ebx . . . 1/r32/ecx . .
890
891 89/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 8/disp8 .
892
893 59/pop-to-ecx
894
895
896
897 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
898 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
899
900 e8/call lookup/disp32
901
902 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
903
904
905 68/push "."/imm32
906 53/push-ebx
907 68/push "' has size "/imm32
908 50/push-eax
909 68/push "segment '"/imm32
910
911 e8/call trace-sssns/disp32
912
913 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
914 $compute-offsets:end:
915
916 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x21c/imm32
917
918 5f/pop-to-edi
919 5e/pop-to-esi
920 5b/pop-to-ebx
921 5a/pop-to-edx
922 59/pop-to-ecx
923 58/pop-to-eax
924
925 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
926 5d/pop-to-ebp
927 c3/return
928
929 $compute-offsets:abort:
930
931
932 68/push "'==' must be followed by segment name and optionally an address\n"/imm32
933 68/push 2/imm32/stderr
934
935 e8/call _write/disp32
936
937 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
938
939 bb/copy-to-ebx 1/imm32
940 e8/call syscall_exit/disp32
941
942
943 test-compute-offsets:
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961 55/push-ebp
962 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
963
964
965
966 68/push _test-input-stream/imm32
967
968 e8/call clear-stream/disp32
969
970 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
971
972 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x28/imm32
973 68/push 0x28/imm32/size
974 68/push 0/imm32/read
975 68/push 0/imm32/write
976 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
977
978 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x30/imm32
979 68/push 0x30/imm32/size
980 68/push 0/imm32/read
981 68/push 0/imm32/write
982 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
983
984
985
986 68/push "== code 0x1\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 "ab x/imm32 # skip comment\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 "== data 0x1000\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 "00\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 68/push "x:\n"/imm32
1019 68/push _test-input-stream/imm32
1020
1021 e8/call write/disp32
1022
1023 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1024
1025
1026 68/push "34\n"/imm32
1027 68/push _test-input-stream/imm32
1028
1029 e8/call write/disp32
1030
1031 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1032
1033
1034 52/push-edx
1035 51/push-ecx
1036 68/push _test-input-stream/imm32
1037
1038 e8/call compute-offsets/disp32
1039
1040 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1041 +-- 26 lines: #? # dump *Trace-stream ----------------------------------------------------------------------------------------------------------------------------------
1067
1068
1069
1070 68/push "F - test-compute-offsets/0"/imm32
1071 68/push "segment 'code' is at file offset 0x00000000."/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/1"/imm32
1079 68/push "segment 'code' has size 0x00000005."/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/2"/imm32
1087 68/push "segment 'data' is at file offset 0x00000005."/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/3"/imm32
1095 68/push "segment 'data' has size 0x00000002."/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/4"/imm32
1103 68/push "label 'x' is in segment 'data'."/imm32
1104
1105 e8/call check-trace-contains/disp32
1106
1107 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1108
1109
1110 68/push "F - test-compute-offsets/5"/imm32
1111 68/push "label 'x' is at segment offset 0x00000001."/imm32
1112
1113 e8/call check-trace-contains/disp32
1114
1115 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1116
1117
1118 68/push "F - test-compute-offsets-maintains-labels-write-index"/imm32
1119 68/push 0x18/imm32/1-entry
1120 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
1121
1122 e8/call check-ints-equal/disp32
1123
1124 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1125
1126 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1127 5d/pop-to-ebp
1128 c3/return
1129
1130
1131
1132
1133 compute-addresses:
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157 55/push-ebp
1158 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1159
1160 50/push-eax
1161 51/push-ecx
1162 52/push-edx
1163 53/push-ebx
1164 56/push-esi
1165 57/push-edi
1166
1167 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
1168
1169
1170 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
1171
1172 ba/copy-to-edx 0/imm32
1173
1174 b9/copy-to-ecx 0x14/imm32/row-size
1175
1176 f7 7/subop/divide 3/mod/direct 1/rm32/ecx . . . . . .
1177
1178 89/copy 3/mod/direct 7/rm32/edi . . . 0/r32/eax . .
1179
1180 c1/shift 4/subop/left 3/mod/direct 7/rm32/edi . . . . . 5/imm8
1181 81 0/subop/add 3/mod/direct 7/rm32/edi . . . . . 0x34/imm32
1182
1183 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . .
1184 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 1/index/ecx . 1/r32/ecx 0xc/disp8 .
1185
1186 8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 6/r32/esi 0xc/disp8 .
1187 $compute-addresses:segment-loop:
1188
1189 39/compare 3/mod/direct 6/rm32/esi . . . 1/r32/ecx . .
1190 73/jump-if-addr>= $compute-addresses:segment-break/disp8
1191
1192 01/add 1/mod/*+disp8 6/rm32/esi . . . 7/r32/edi 0xc/disp8 .
1193
1194
1195 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 8/disp8 .
1196
1197 81 4/subop/and 3/mod/direct 2/rm32/edx . . . . . 0xfffff000/imm32
1198
1199
1200 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 3/r32/ebx 0xc/disp8 .
1201
1202 81 4/subop/and 3/mod/direct 3/rm32/ebx . . . . . 0x00000fff/imm32
1203
1204 09/or 3/mod/direct 2/rm32/edx . . . 3/r32/ebx . .
1205 89/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 8/disp8 .
1206
1207
1208
1209 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
1210 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
1211
1212 e8/call lookup/disp32
1213
1214 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1215
1216
1217 68/push "."/imm32
1218 52/push-edx
1219 68/push "' starts at address "/imm32
1220 50/push-eax
1221 68/push "segment '"/imm32
1222
1223 e8/call trace-sssns/disp32
1224
1225 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1226
1227 81 0/subop/add 3/mod/direct 6/rm32/esi . . . . . 0x14/imm32
1228 eb/jump $compute-addresses:segment-loop/disp8
1229 $compute-addresses:segment-break:
1230 +-- 26 lines: #? # dump *Trace-stream ----------------------------------------------------------------------------------------------------------------------------------
1256
1257 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
1258
1259 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . .
1260 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 1/index/ecx . 1/r32/ecx 0xc/disp8 .
1261
1262 8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 6/r32/esi 0xc/disp8 .
1263 $compute-addresses:label-loop:
1264
1265 39/compare 3/mod/direct 6/rm32/esi . . . 1/r32/ecx . .
1266 0f 83/jump-if-addr>= $compute-addresses:end/disp32
1267 +-- 26 lines: #? # dump lrow->key --------------------------------------------------------------------------------------------------------------------------------------
1293
1294
1295
1296 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 0xc/disp8 .
1297 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 8/disp8 .
1298
1299 e8/call lookup/disp32
1300
1301 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1302
1303 89/copy 3/mod/direct 2/rm32/edx . . . 0/r32/eax . .
1304 +-- 26 lines: #? # dump seg-name ---------------------------------------------------------------------------------------------------------------------------------------
1330
1331
1332
1333 68/push "segment table"/imm32
1334 68/push 0x14/imm32/row-size
1335 52/push-edx
1336 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
1337
1338 e8/call get/disp32
1339
1340 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
1341
1342 89/copy 3/mod/direct 2/rm32/edx . . . 0/r32/eax . .
1343
1344 8b/copy 0/mod/indirect 2/rm32/edx . . . 3/r32/ebx . .
1345
1346 03/add 1/mod/*+disp8 6/rm32/esi . . . 3/r32/ebx 0x10/disp8 .
1347
1348 89/copy 1/mod/*+disp8 6/rm32/esi . . . 3/r32/ebx 0x14/disp8 .
1349
1350
1351
1352 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
1353 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
1354
1355 e8/call lookup/disp32
1356
1357 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1358
1359
1360 68/push "."/imm32
1361 53/push-ebx
1362 68/push "' is at address "/imm32
1363 50/push-eax
1364 68/push "label '"/imm32
1365
1366 e8/call trace-sssns/disp32
1367
1368 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1369
1370 81 0/subop/add 3/mod/direct 6/rm32/esi . . . . . 0x18/imm32
1371 e9/jump $compute-addresses:label-loop/disp32
1372 $compute-addresses:end:
1373
1374 5f/pop-to-edi
1375 5e/pop-to-esi
1376 5b/pop-to-ebx
1377 5a/pop-to-edx
1378 59/pop-to-ecx
1379 58/pop-to-eax
1380
1381 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1382 5d/pop-to-ebp
1383 c3/return
1384
1385 test-compute-addresses:
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403 55/push-ebp
1404 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1405
1406
1407 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc8/imm32
1408 68/push 0xc8/imm32/size
1409 68/push 0/imm32/read
1410 68/push 0/imm32/write
1411 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1412
1413 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
1414 68/push 0xc0/imm32/size
1415 68/push 0/imm32/read
1416 68/push 0/imm32/write
1417 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1418
1419 68/push 0/imm32
1420 68/push 0/imm32
1421 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
1422
1423
1424 53/push-ebx
1425 68/push "a"/imm32
1426 68/push Heap/imm32
1427
1428 e8/call copy-array/disp32
1429
1430 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1431
1432
1433 68/push 5/imm32/segment-size
1434 68/push 0/imm32/file-offset
1435 68/push 0x1000/imm32/start-address
1436 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1437 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1438 51/push-ecx
1439
1440 e8/call stream-add5/disp32
1441
1442 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x18/imm32
1443
1444
1445 53/push-ebx
1446 68/push "b"/imm32
1447 68/push Heap/imm32
1448
1449 e8/call copy-array/disp32
1450
1451 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1452
1453
1454 68/push 1/imm32/segment-size
1455 68/push 5/imm32/file-offset
1456 68/push 0x2018/imm32/start-address
1457 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1458 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1459 51/push-ecx
1460
1461 e8/call stream-add5/disp32
1462
1463 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x18/imm32
1464
1465
1466 53/push-ebx
1467 68/push "c"/imm32
1468 68/push Heap/imm32
1469
1470 e8/call copy-array/disp32
1471
1472 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1473
1474 68/push 0xc/imm32/segment-size
1475 68/push 6/imm32/file-offset
1476 68/push 0x5444/imm32/start-address
1477 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1478 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1479 51/push-ecx
1480
1481 e8/call stream-add5/disp32
1482
1483 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x18/imm32
1484
1485
1486 68/push 0/imm32/label-address
1487 68/push 3/imm32/segment-offset
1488
1489 53/push-ebx
1490 68/push "a"/imm32
1491 68/push Heap/imm32
1492 e8/call copy-array/disp32
1493 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1494 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1495 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1496
1497 53/push-ebx
1498 68/push "l1"/imm32
1499 68/push Heap/imm32
1500 e8/call copy-array/disp32
1501 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1502 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1503 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1504
1505 52/push-edx
1506
1507 e8/call stream-add6/disp32
1508
1509 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x1c/imm32
1510
1511
1512 68/push 0/imm32/label-address
1513 68/push 0/imm32/segment-offset
1514
1515 53/push-ebx
1516 68/push "b"/imm32
1517 68/push Heap/imm32
1518 e8/call copy-array/disp32
1519 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1520 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1521 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1522
1523 53/push-ebx
1524 68/push "l2"/imm32
1525 68/push Heap/imm32
1526 e8/call copy-array/disp32
1527 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1528 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1529 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1530
1531 52/push-edx
1532
1533 e8/call stream-add6/disp32
1534
1535 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x1c/imm32
1536
1537
1538
1539 52/push-edx
1540 51/push-ecx
1541
1542 e8/call compute-addresses/disp32
1543
1544 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1545
1546 +-- 26 lines: #? # dump *Trace-stream ----------------------------------------------------------------------------------------------------------------------------------
1572
1573
1574 68/push "F - test-compute-addresses/0"/imm32
1575 68/push "segment 'a' starts at address 0x00001094."/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/1"/imm32
1583 68/push "segment 'b' starts at address 0x00002099."/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/2"/imm32
1591 68/push "segment 'c' starts at address 0x0000509a."/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/3"/imm32
1599 68/push "label 'l1' is at address 0x00001097."/imm32
1600
1601 e8/call check-trace-contains/disp32
1602
1603 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1604
1605
1606 68/push "F - test-compute-addresses/4"/imm32
1607 68/push "label 'l2' is at address 0x00002099."/imm32
1608
1609 e8/call check-trace-contains/disp32
1610
1611 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1612
1613
1614 68/push "F - test-compute-addresses/maintains-labels-write-index"/imm32
1615 68/push 0x30/imm32/2-entries
1616 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
1617
1618 e8/call check-ints-equal/disp32
1619
1620 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1621
1622 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1623 5d/pop-to-ebp
1624 c3/return
1625
1626 test-compute-addresses-large-segments:
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640 55/push-ebp
1641 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1642
1643
1644 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc8/imm32
1645 68/push 0xc8/imm32/size
1646 68/push 0/imm32/read
1647 68/push 0/imm32/write
1648 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1649
1650 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
1651 68/push 0xc0/imm32/size
1652 68/push 0/imm32/read
1653 68/push 0/imm32/write
1654 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1655
1656 68/push 0/imm32
1657 68/push 0/imm32
1658 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
1659
1660
1661 53/push-ebx
1662 68/push "a"/imm32
1663 68/push Heap/imm32
1664
1665 e8/call copy-array/disp32
1666
1667 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1668
1669 68/push 0x5604/imm32/segment-size
1670 68/push 0/imm32/file-offset
1671 68/push 0x1000/imm32/start-address
1672 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1673 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1674 51/push-ecx
1675
1676 e8/call stream-add5/disp32
1677
1678 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x18/imm32
1679
1680
1681 53/push-ebx
1682 68/push "b"/imm32
1683 68/push Heap/imm32
1684
1685 e8/call copy-array/disp32
1686
1687 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1688
1689 68/push 1/imm32/segment-size
1690 68/push 0x5604/imm32/file-offset
1691 68/push 0x2018/imm32/start-address
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 51/push-ecx
1695
1696 e8/call stream-add5/disp32
1697
1698 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x18/imm32
1699
1700 68/push 0/imm32/label-address
1701 68/push 3/imm32/segment-offset
1702
1703 53/push-ebx
1704 68/push "a"/imm32
1705 68/push Heap/imm32
1706 e8/call copy-array/disp32
1707 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1708 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1709 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1710
1711 53/push-ebx
1712 68/push "l1"/imm32
1713 68/push Heap/imm32
1714 e8/call copy-array/disp32
1715 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1716 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1717 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1718
1719 52/push-edx
1720
1721 e8/call stream-add6/disp32
1722
1723 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x1c/imm32
1724
1725
1726
1727 52/push-edx
1728 51/push-ecx
1729
1730 e8/call compute-addresses/disp32
1731
1732 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1733
1734 +-- 26 lines: #? # dump *Trace-stream ----------------------------------------------------------------------------------------------------------------------------------
1760
1761
1762 68/push "F - test-compute-addresses-large-segments/0"/imm32
1763 68/push "segment 'a' starts at address 0x00001074."/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
1770 68/push "F - test-compute-addresses-large-segments/1"/imm32
1771 68/push "segment 'b' starts at address 0x00002678."/imm32
1772
1773 e8/call check-trace-contains/disp32
1774
1775 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1776
1777
1778 68/push "F - test-compute-addresses-large-segments/3"/imm32
1779 68/push "label 'l1' is at address 0x00001077."/imm32
1780
1781 e8/call check-trace-contains/disp32
1782
1783 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1784
1785 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1786 5d/pop-to-ebp
1787 c3/return
1788
1789 emit-output:
1790
1791
1792
1793
1794
1795 55/push-ebp
1796 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1797 +-- 9 lines: #? # write(2/stderr, "emit-headers\n") -------------------------------------------------------------------------------------------------------------------
1806
1807
1808 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
1809 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
1810 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1811
1812 e8/call emit-headers/disp32
1813
1814 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1815 +-- 9 lines: #? # write(2/stderr, "emit-segments\n") ------------------------------------------------------------------------------------------------------------------
1824
1825
1826 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
1827 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1828 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
1829
1830 e8/call emit-segments/disp32
1831
1832 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1833 $emit-output:end:
1834
1835 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1836 5d/pop-to-ebp
1837 c3/return
1838
1839
1840 == data
1841
1842 emit-segments:datum:
1843 0/imm32/start
1844 0/imm32/end
1845
1846 == code
1847
1848 emit-segments:
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
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902 55/push-ebp
1903 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1904
1905 50/push-eax
1906 51/push-ecx
1907 52/push-edx
1908 53/push-ebx
1909 56/push-esi
1910 57/push-edi
1911
1912 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32
1913 68/push 0x200/imm32/size
1914 68/push 0/imm32/read
1915 68/push 0/imm32/write
1916 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1917
1918 68/push 0/imm32/end
1919 68/push 0/imm32/start
1920 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1921
1922 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
1923 $emit-segments:line-loop:
1924
1925
1926 51/push-ecx
1927
1928 e8/call clear-stream/disp32
1929
1930 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1931
1932
1933 51/push-ecx
1934 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
1935
1936 e8/call read-line/disp32
1937
1938 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1939 +-- 33 lines: #? # dump line -------------------------------------------------------------------------------------------------------------------------------------------
1972 $emit-segments:check-for-end-of-input:
1973
1974 81 7/subop/compare 0/mod/indirect 1/rm32/ecx . . . . . 0/imm32
1975 0f 84/jump-if-= $emit-segments:end/disp32
1976
1977
1978
1979 51/push-ecx
1980
1981 e8/call num-bytes/disp32
1982
1983 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1984
1985 01/add 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . .
1986
1987
1988 51/push-ecx
1989
1990 e8/call far-jump-or-call?/disp32
1991
1992 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1993
1994
1995 51/push-ecx
1996
1997 e8/call rewind-stream/disp32
1998
1999 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2000 $emit-segments:word-loop:
2001
2002
2003 52/push-edx
2004 51/push-ecx
2005
2006 e8/call next-word/disp32
2007
2008 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2009 +-- 33 lines: #? # dump word-slice -------------------------------------------------------------------------------------------------------------------------------------
2042 $emit-segments:check-for-end-of-line:
2043
2044
2045
2046 52/push-edx
2047
2048 e8/call slice-empty?/disp32
2049
2050 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2051
2052 3d/compare-eax-and 0/imm32/false
2053 0f 85/jump-if-!= $emit-segments:next-line/disp32
2054 $emit-segments:check-for-comment:
2055
2056
2057 8b/copy 0/mod/indirect 2/rm32/edx . . . 6/r32/esi . .
2058
2059 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
2060 8a/copy-byte 0/mod/indirect 6/rm32/esi . . . 0/r32/AL . .
2061
2062 3d/compare-eax-and 0x23/imm32/hash
2063 0f 84/jump-if-= $emit-segments:next-line/disp32
2064 $emit-segments:check-for-label:
2065
2066
2067
2068 52/push-edx
2069
2070 e8/call label?/disp32
2071
2072 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2073
2074 3d/compare-eax-and 0/imm32/false
2075 0f 85/jump-if-!= $emit-segments:line-loop/disp32
2076 $emit-segments:check-for-segment-header:
2077
2078
2079
2080 68/push "=="/imm32
2081 52/push-edx
2082
2083 e8/call slice-equal?/disp32
2084
2085 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2086
2087 3d/compare-eax-and 0/imm32/false
2088 0f 85/jump-if-!= $emit-segments:line-loop/disp32
2089 $emit-segments:2-character:
2090
2091
2092 8b/copy 1/mod/*+disp8 2/rm32/edx . . . 0/r32/eax 4/disp8 .
2093 2b/subtract 0/mod/indirect 2/rm32/edx . . . 0/r32/eax . .
2094
2095 3d/compare-eax-and 2/imm32
2096 75/jump-if-!= $emit-segments:check-metadata/disp8
2097
2098
2099 52/push-edx
2100 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2101
2102 e8/call write-slice-buffered/disp32
2103
2104 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2105
2106
2107 68/push Space/imm32
2108 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2109
2110 e8/call write-buffered/disp32
2111
2112 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2113
2114 e9/jump $emit-segments:word-loop/disp32
2115 $emit-segments:check-metadata:
2116
2117
2118
2119 68/push emit-segments:datum/imm32
2120 68/push 0x2f/imm32/slash
2121 ff 6/subop/push 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
2122 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
2123
2124 e8/call next-token-from-slice/disp32
2125
2126 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
2127 +-- 33 lines: #? # dump datum ------------------------------------------------------------------------------------------------------------------------------------------
2160
2161
2162
2163 68/push "label table"/imm32
2164 68/push 0x18/imm32/row-size
2165 68/push emit-segments:datum/imm32
2166 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
2167
2168 e8/call get-slice/disp32
2169
2170 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
2171
2172 89/copy 3/mod/direct 6/rm32/esi . . . 0/r32/eax . .
2173 $emit-segments:check-imm8:
2174
2175
2176
2177 68/push "imm8"/imm32
2178 52/push-edx
2179
2180 e8/call has-metadata?/disp32
2181
2182 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2183
2184 3d/compare-eax-and 0/imm32/false
2185 0f 85/jump-if-!= $emit-segments:imm8-abort/disp32
2186 $emit-segments:check-imm32:
2187
2188
2189
2190 68/push "imm32"/imm32
2191 52/push-edx
2192
2193 e8/call has-metadata?/disp32
2194
2195 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2196
2197 3d/compare-eax-and 0/imm32/false
2198 74/jump-if-= $emit-segments:check-disp8/disp8
2199 +-- 33 lines: #? # dump info->address ----------------------------------------------------------------------------------------------------------------------------------
2232 $emit-segments:emit-imm32:
2233
2234
2235 68/push 4/imm32
2236 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 0xc/disp8 .
2237 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2238
2239 e8/call emit-hex/disp32
2240
2241 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2242
2243 e9/jump $emit-segments:word-loop/disp32
2244 $emit-segments:check-disp8:
2245
2246
2247
2248 68/push "disp8"/imm32
2249 52/push-edx
2250
2251 e8/call has-metadata?/disp32
2252
2253 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2254
2255 3d/compare-eax-and 0/imm32/false
2256 74/jump-if-= $emit-segments:check-disp32/disp8
2257 $emit-segments:emit-disp8:
2258
2259
2260 68/push 1/imm32
2261 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 8/disp8 .
2262 29/subtract 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
2263 50/push-eax
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-disp32:
2272
2273
2274
2275 68/push "disp32"/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 0f 84/jump-if-= $emit-segments:abort/disp32
2284 $emit-segments:emit-disp32:
2285
2286 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 0xc/disp8 .
2287
2288 81 7/subop/compare 3/mod/direct 7/rm32/edi . . . . . 0/imm32/false
2289 74/jump-if-= $emit-segments:really-emit-disp32/disp8
2290 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 8/disp8 .
2291 29/subtract 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
2292 $emit-segments:really-emit-disp32:
2293
2294
2295 68/push 4/imm32
2296 50/push-eax
2297 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2298
2299 e8/call emit-hex/disp32
2300
2301 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2302
2303 e9/jump $emit-segments:word-loop/disp32
2304 $emit-segments:next-line:
2305
2306
2307 68/push Newline/imm32
2308 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2309
2310 e8/call write-buffered/disp32
2311
2312 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2313
2314 e9/jump $emit-segments:line-loop/disp32
2315 $emit-segments:end:
2316
2317 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x214/imm32
2318
2319 5f/pop-to-edi
2320 5e/pop-to-esi
2321 5b/pop-to-ebx
2322 5a/pop-to-edx
2323 59/pop-to-ecx
2324 58/pop-to-eax
2325
2326 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2327 5d/pop-to-ebp
2328 c3/return
2329
2330 $emit-segments:imm8-abort:
2331
2332
2333 68/push "emit-segments: cannot refer to code labels with /imm8"/imm32
2334 68/push 2/imm32/stderr
2335
2336 e8/call _write/disp32
2337
2338 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2339
2340 bb/copy-to-ebx 1/imm32
2341 e8/call syscall_exit/disp32
2342
2343
2344 $emit-segments:abort:
2345
2346
2347
2348 68/push "emit-segments: missing metadata in "/imm32
2349 68/push 2/imm32/stderr
2350
2351 e8/call _write/disp32
2352
2353 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2354
2355
2356 52/push-edx
2357 68/push Stderr/imm32
2358
2359 e8/call write-slice-buffered/disp32
2360
2361 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2362
2363
2364 68/push Stderr/imm32
2365
2366 e8/call flush/disp32
2367
2368 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2369
2370 bb/copy-to-ebx 1/imm32
2371 e8/call syscall_exit/disp32
2372
2373
2374 test-emit-segments-non-far-control-flow:
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396 55/push-ebp
2397 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2398
2399
2400
2401 68/push _test-input-stream/imm32
2402
2403 e8/call clear-stream/disp32
2404
2405 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2406
2407
2408 68/push _test-output-stream/imm32
2409
2410 e8/call clear-stream/disp32
2411
2412 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2413
2414
2415 68/push $_test-output-buffered-file->buffer/imm32
2416
2417 e8/call clear-stream/disp32
2418
2419 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2420
2421 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
2422 68/push 0xc0/imm32/size
2423 68/push 0/imm32/read
2424 68/push 0/imm32/write
2425 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
2426
2427 68/push 0/imm32
2428 68/push 0/imm32
2429 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
2430
2431
2432
2433 68/push "== code 0x1000\n"/imm32
2434 68/push _test-input-stream/imm32
2435
2436 e8/call write/disp32
2437
2438 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2439
2440
2441 68/push "ab cd ef gh\n"/imm32
2442 68/push _test-input-stream/imm32
2443
2444 e8/call write/disp32
2445
2446 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2447
2448
2449 68/push "ij x/disp32\n"/imm32
2450 68/push _test-input-stream/imm32
2451
2452 e8/call write/disp32
2453
2454 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2455
2456
2457 68/push "== data 0x2000\n"/imm32
2458 68/push _test-input-stream/imm32
2459
2460 e8/call write/disp32
2461
2462 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2463
2464
2465 68/push "00\n"/imm32
2466 68/push _test-input-stream/imm32
2467
2468 e8/call write/disp32
2469
2470 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2471
2472
2473 68/push "x:\n"/imm32
2474 68/push _test-input-stream/imm32
2475
2476 e8/call write/disp32
2477
2478 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2479
2480
2481 68/push "34\n"/imm32
2482 68/push _test-input-stream/imm32
2483
2484 e8/call write/disp32
2485
2486 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2487
2488 68/push 0x207a/imm32/label-address
2489 68/push 1/imm32/segment-offset
2490
2491 53/push-ebx
2492 68/push "data"/imm32
2493 68/push Heap/imm32
2494 e8/call copy-array/disp32
2495 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2496 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
2497 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
2498
2499 53/push-ebx
2500 68/push "x"/imm32
2501 68/push Heap/imm32
2502 e8/call copy-array/disp32
2503 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2504 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
2505 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
2506
2507 52/push-edx
2508
2509 e8/call stream-add6/disp32
2510
2511 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x1c/imm32
2512
2513
2514
2515 52/push-edx
2516 68/push _test-output-buffered-file/imm32
2517 68/push _test-input-stream/imm32
2518
2519 e8/call emit-segments/disp32
2520
2521 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2522
2523
2524
2525 68/push _test-output-buffered-file/imm32
2526
2527 e8/call flush/disp32
2528
2529 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2530 +-- 33 lines: #? # dump output -----------------------------------------------------------------------------------------------------------------------------------------
2563
2564
2565 68/push "F - test-emit-segments-global-variable/0"/imm32
2566 68/push "ab cd ef gh "/imm32
2567 68/push _test-output-stream/imm32
2568
2569 e8/call check-next-stream-line-equal/disp32
2570
2571 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2572
2573
2574 68/push "F - test-emit-segments-global-variable/1"/imm32
2575 68/push "ij 7a 20 00 00 "/imm32
2576 68/push _test-output-stream/imm32
2577
2578 e8/call check-next-stream-line-equal/disp32
2579
2580 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2581
2582
2583 68/push "F - test-emit-segments-global-variable/2"/imm32
2584 68/push "00 "/imm32
2585 68/push _test-output-stream/imm32
2586
2587 e8/call check-next-stream-line-equal/disp32
2588
2589 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2590
2591
2592 68/push "F - test-emit-segments-global-variable/3"/imm32
2593 68/push "34 "/imm32
2594 68/push _test-output-stream/imm32
2595
2596 e8/call check-next-stream-line-equal/disp32
2597
2598 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2599
2600 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2601 5d/pop-to-ebp
2602 c3/return
2603
2604 test-emit-segments-code-label:
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623 55/push-ebp
2624 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2625
2626
2627
2628 68/push _test-input-stream/imm32
2629
2630 e8/call clear-stream/disp32
2631
2632 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2633
2634
2635 68/push _test-output-stream/imm32
2636
2637 e8/call clear-stream/disp32
2638
2639 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2640
2641
2642 68/push $_test-output-buffered-file->buffer/imm32
2643
2644 e8/call clear-stream/disp32
2645
2646 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2647
2648 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
2649 68/push 0xc0/imm32/size
2650 68/push 0/imm32/read
2651 68/push 0/imm32/write
2652 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
2653
2654 68/push 0/imm32
2655 68/push 0/imm32
2656 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
2657
2658
2659
2660 68/push "== code 0x1000\n"/imm32
2661 68/push _test-input-stream/imm32
2662
2663 e8/call write/disp32
2664
2665 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2666
2667
2668 68/push "ab cd\n"/imm32
2669 68/push _test-input-stream/imm32
2670
2671 e8/call write/disp32
2672
2673 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2674
2675
2676 68/push "l1:\n"/imm32
2677 68/push _test-input-stream/imm32
2678
2679 e8/call write/disp32
2680
2681 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2682
2683
2684 68/push " ef gh\n"/imm32
2685 68/push _test-input-stream/imm32
2686
2687 e8/call write/disp32
2688
2689 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2690
2691
2692 68/push " e8 l1/disp32\n"/imm32
2693 68/push _test-input-stream/imm32
2694
2695 e8/call write/disp32
2696
2697 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2698
2699 68/push 0x1056/imm32/label-address
2700 68/push 2/imm32/segment-offset
2701
2702 53/push-ebx
2703 68/push "code"/imm32
2704 68/push Heap/imm32
2705 e8/call copy-array/disp32
2706 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2707 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
2708 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
2709
2710 53/push-ebx
2711 68/push "l1"/imm32
2712 68/push Heap/imm32
2713 e8/call copy-array/disp32
2714 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2715 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
2716 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
2717
2718 52/push-edx
2719
2720 e8/call stream-add6/disp32
2721
2722 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x1c/imm32
2723
2724
2725
2726 52/push-edx
2727 68/push _test-output-buffered-file/imm32
2728 68/push _test-input-stream/imm32
2729
2730 e8/call emit-segments/disp32
2731
2732 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2733
2734
2735
2736 68/push _test-output-buffered-file/imm32
2737
2738 e8/call flush/disp32
2739
2740 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2741 +-- 33 lines: #? # dump output -----------------------------------------------------------------------------------------------------------------------------------------
2774
2775
2776 68/push "F - test-emit-segments-code-label/0"/imm32
2777 68/push "ab cd "/imm32
2778 68/push _test-output-stream/imm32
2779
2780 e8/call check-next-stream-line-equal/disp32
2781
2782 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2783
2784
2785 68/push "F - test-emit-segments-code-label/1"/imm32
2786 68/push "ef gh "/imm32
2787 68/push _test-output-stream/imm32
2788
2789 e8/call check-next-stream-line-equal/disp32
2790
2791 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2792
2793
2794 68/push "F - test-emit-segments-code-label/2"/imm32
2795 68/push "e8 f9 ff ff ff "/imm32
2796 68/push _test-output-stream/imm32
2797
2798 e8/call check-next-stream-line-equal/disp32
2799
2800 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2801
2802 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2803 5d/pop-to-ebp
2804 c3/return
2805
2806 test-emit-segments-code-label-absolute:
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825 55/push-ebp
2826 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2827
2828
2829
2830 68/push _test-input-stream/imm32
2831
2832 e8/call clear-stream/disp32
2833
2834 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2835
2836
2837 68/push _test-output-stream/imm32
2838
2839 e8/call clear-stream/disp32
2840
2841 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2842
2843
2844 68/push $_test-output-buffered-file->buffer/imm32
2845
2846 e8/call clear-stream/disp32
2847
2848 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2849
2850 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
2851 68/push 0xc0/imm32/size
2852 68/push 0/imm32/read
2853 68/push 0/imm32/write
2854 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
2855
2856 68/push 0/imm32
2857 68/push 0/imm32
2858 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
2859
2860
2861
2862 68/push "== code 0x1000\n"/imm32
2863 68/push _test-input-stream/imm32
2864
2865 e8/call write/disp32
2866
2867 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2868
2869
2870 68/push "ab cd\n"/imm32
2871 68/push _test-input-stream/imm32
2872
2873 e8/call write/disp32
2874
2875 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2876
2877
2878 68/push "l1:\n"/imm32
2879 68/push _test-input-stream/imm32
2880
2881 e8/call write/disp32
2882
2883 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2884
2885
2886 68/push " ef gh\n"/imm32
2887 68/push _test-input-stream/imm32
2888
2889 e8/call write/disp32
2890
2891 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2892
2893
2894 68/push " ij l1/imm32\n"/imm32
2895 68/push _test-input-stream/imm32
2896
2897 e8/call write/disp32
2898
2899 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2900
2901 68/push 0x1056/imm32/label-address
2902 68/push 2/imm32/segment-offset
2903
2904 53/push-ebx
2905 68/push "code"/imm32
2906 68/push Heap/imm32
2907 e8/call copy-array/disp32
2908 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2909 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
2910 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
2911
2912 53/push-ebx
2913 68/push "l1"/imm32
2914 68/push Heap/imm32
2915 e8/call copy-array/disp32
2916 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2917 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
2918 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
2919
2920 52/push-edx
2921
2922 e8/call stream-add6/disp32
2923
2924 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x1c/imm32
2925
2926
2927
2928 52/push-edx
2929 68/push _test-output-buffered-file/imm32
2930 68/push _test-input-stream/imm32
2931
2932 e8/call emit-segments/disp32
2933
2934 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2935
2936
2937
2938 68/push _test-output-buffered-file/imm32
2939
2940 e8/call flush/disp32
2941
2942 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2943 +-- 33 lines: #? # dump output -----------------------------------------------------------------------------------------------------------------------------------------
2976
2977
2978 68/push "F - test-emit-segments-code-label-absolute/0"/imm32
2979 68/push "ab cd "/imm32
2980 68/push _test-output-stream/imm32
2981
2982 e8/call check-next-stream-line-equal/disp32
2983
2984 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2985
2986
2987 68/push "F - test-emit-segments-code-label-absolute/1"/imm32
2988 68/push "ef gh "/imm32
2989 68/push _test-output-stream/imm32
2990
2991 e8/call check-next-stream-line-equal/disp32
2992
2993 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2994
2995
2996 68/push "F - test-emit-segments-code-label-absolute/2"/imm32
2997 68/push "ij 56 10 00 00 "/imm32
2998 68/push _test-output-stream/imm32
2999
3000 e8/call check-next-stream-line-equal/disp32
3001
3002 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3003
3004 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3005 5d/pop-to-ebp
3006 c3/return
3007
3008
3009
3010 far-jump-or-call?:
3011
3012 55/push-ebp
3013 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3014
3015 50/push-eax
3016 51/push-ecx
3017 52/push-edx
3018 53/push-ebx
3019
3020 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 .
3021
3022 68/push 0/imm32/end
3023 68/push 0/imm32/start
3024 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
3025
3026 68/push 0/imm32/end
3027 68/push 0/imm32/start
3028 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
3029
3030 bf/copy-to-edi 0/imm32/false
3031 $far-jump-or-call?:check-first-word:
3032
3033
3034 52/push-edx
3035 51/push-ecx
3036
3037 e8/call next-word/disp32
3038
3039 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3040
3041
3042
3043 52/push-edx
3044
3045 e8/call slice-empty?/disp32
3046
3047 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3048
3049 3d/compare-eax-and 0/imm32/false
3050 0f 85/jump-if-!= $far-jump-or-call?:end/disp32
3051
3052
3053 53/push-ebx
3054 68/push 0x2f/imm32/slash
3055 ff 6/subop/push 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
3056 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
3057
3058 e8/call next-token-from-slice/disp32
3059
3060 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
3061
3062
3063
3064 68/push "e8"/imm32
3065 53/push-ebx
3066
3067 e8/call slice-equal?/disp32
3068
3069 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3070
3071 3d/compare-eax-and 0/imm32/false
3072 75/jump-if-!= $far-jump-or-call?:return-true/disp8
3073
3074
3075
3076 68/push "e9"/imm32
3077 53/push-ebx
3078
3079 e8/call slice-equal?/disp32
3080
3081 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3082
3083 3d/compare-eax-and 0/imm32/false
3084 75/jump-if-!= $far-jump-or-call?:return-true/disp8
3085
3086
3087
3088 68/push "0f"/imm32
3089 53/push-ebx
3090
3091 e8/call slice-equal?/disp32
3092
3093 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3094
3095 3d/compare-eax-and 0/imm32/false
3096 74/jump-if-= $far-jump-or-call?:end/disp8
3097 $far-jump-or-call?:check-second-word:
3098
3099
3100 52/push-edx
3101 51/push-ecx
3102
3103 e8/call next-word/disp32
3104
3105 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3106
3107
3108
3109 52/push-edx
3110
3111 e8/call slice-empty?/disp32
3112
3113 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3114
3115 3d/compare-eax-and 0/imm32/false
3116 75/jump-if-!= $far-jump-or-call?:end/disp8
3117
3118
3119 8b/copy 0/mod/indirect 2/rm32/edx . . . 0/r32/eax . .
3120
3121 8a/copy-byte 0/mod/indirect 0/rm32/eax . . . 0/r32/AL . .
3122 25/and-eax-with 0xff/imm32
3123
3124 3d/compare-eax-and 0x38/imm32/8
3125 75/jump-if-!= $far-jump-or-call?:end/disp8
3126
3127 $far-jump-or-call?:return-true:
3128 bf/copy-to-edi 1/imm32/true
3129 $far-jump-or-call?:end:
3130
3131 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
3132
3133 5b/pop-to-ebx
3134 5a/pop-to-edx
3135 59/pop-to-ecx
3136 58/pop-to-eax
3137
3138 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3139 5d/pop-to-ebp
3140 c3/return
3141
3142 emit-headers:
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153 55/push-ebp
3154 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3155
3156 50/push-eax
3157 51/push-ecx
3158
3159
3160 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3161 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3162 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3163
3164 e8/call emit-elf-header/disp32
3165
3166 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3167
3168 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 .
3169
3170 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3171
3172 8d/copy-address 1/mod/*+disp8 0/rm32/eax . . . 0/r32/eax 0xc/disp8 .
3173
3174 01/add 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . .
3175 $emit-headers:loop:
3176
3177 39/compare 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . .
3178 0f 83/jump-if-addr>= $emit-headers:end/disp32
3179 +-- 63 lines: #? # dump curr-segment->name -----------------------------------------------------------------------------------------------------------------------------
3242 +-- 9 lines: #? # write(2/stderr, "emit-segment-header\n") ------------------------------------------------------------------------------------------------------------
3251
3252
3253 50/push-eax
3254 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3255
3256 e8/call emit-elf-program-header-entry/disp32
3257
3258 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3259
3260 05/add-to-eax 0x14/imm32
3261 e9/jump $emit-headers:loop/disp32
3262 $emit-headers:end:
3263
3264 59/pop-to-ecx
3265 58/pop-to-eax
3266
3267 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3268 5d/pop-to-ebp
3269 c3/return
3270
3271 emit-elf-header:
3272
3273
3274
3275
3276
3277
3278
3279 55/push-ebp
3280 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3281
3282 50/push-eax
3283 51/push-ecx
3284 52/push-edx
3285
3286
3287 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0x10/disp8 .
3288
3289
3290 68/push "label table"/imm32
3291 68/push 0x18/imm32/row-size
3292 68/push "Entry"/imm32
3293 50/push-eax
3294
3295 e8/call get/disp32
3296
3297 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
3298
3299 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 0/r32/eax 0xc/disp8 .
3300
3301 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax $Elf_e_entry/disp32
3302
3303
3304 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 .
3305
3306 8b/copy 0/mod/indirect 0/rm32/eax . . . 0/r32/eax . .
3307
3308 b9/copy-to-ecx 0x14/imm32
3309 31/xor 3/mod/direct 2/rm32/edx . . . 2/r32/edx . .
3310 f7 7/subop/idiv 3/mod/direct 1/rm32/ecx . . . . . .
3311
3312 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax $Elf_e_phnum/disp32
3313
3314
3315 68/push Elf_header/imm32
3316 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3317
3318 e8/call emit-hex-array/disp32
3319
3320 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3321
3322
3323 68/push Newline/imm32
3324 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3325
3326 e8/call write-buffered/disp32
3327
3328 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3329 $emit-elf-header:end:
3330
3331 5a/pop-to-edx
3332 59/pop-to-ecx
3333 58/pop-to-eax
3334
3335 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3336 5d/pop-to-ebp
3337 c3/return
3338
3339
3340
3341 emit-elf-program-header-entry:
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356 55/push-ebp
3357 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3358
3359 50/push-eax
3360 56/push-esi
3361
3362 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
3363
3364
3365 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 0xc/disp8 .
3366
3367 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax $Elf_p_offset/disp32
3368
3369
3370 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 8/disp8 .
3371
3372 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax $Elf_p_vaddr/disp32
3373
3374 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax $Elf_p_paddr/disp32
3375
3376
3377 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 0x10/disp8 .
3378
3379 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax $Elf_p_filesz/disp32
3380
3381 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax $Elf_p_memsz/disp32
3382
3383
3384
3385 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
3386 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
3387
3388 e8/call lookup/disp32
3389
3390 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3391
3392
3393 68/push "code"/imm32
3394 50/push-eax
3395
3396 e8/call string-equal?/disp32
3397
3398 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3399
3400 3d/compare-eax-and 0/imm32/false
3401 74/jump-if-= $emit-elf-program-header-entry:data/disp8
3402
3403 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . $Elf_p_flags/disp32 5/imm32
3404 eb/jump $emit-elf-program-header-entry:really-emit/disp8
3405 $emit-elf-program-header-entry:data:
3406
3407 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . $Elf_p_flags/disp32 6/imm32
3408 $emit-elf-program-header-entry:really-emit:
3409
3410
3411 68/push Elf_program_header_entry/imm32
3412 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3413
3414 e8/call emit-hex-array/disp32
3415
3416 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3417
3418
3419 68/push Newline/imm32
3420 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3421
3422 e8/call write-buffered/disp32
3423
3424 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3425 $emit-elf-program-header-entry:end:
3426
3427 5e/pop-to-esi
3428 58/pop-to-eax
3429
3430 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3431 5d/pop-to-ebp
3432 c3/return
3433
3434
3435
3436 stream-add5:
3437
3438 55/push-ebp
3439 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3440
3441 50/push-eax
3442 51/push-ecx
3443 52/push-edx
3444 56/push-esi
3445
3446 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
3447
3448
3449 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
3450
3451 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 0/r32/eax 0xc/disp8 .
3452
3453
3454 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 8/disp8 .
3455
3456 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 2/index/edx . 2/r32/edx 0xc/disp8 .
3457
3458 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3459 73/jump-if-addr>= $stream-add5:abort/disp8
3460
3461 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0xc/disp8 .
3462 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3463
3464 05/add-to-eax 4/imm32
3465
3466 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3467 73/jump-if-addr>= $stream-add5:abort/disp8
3468
3469 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x10/disp8 .
3470 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3471
3472 05/add-to-eax 4/imm32
3473
3474 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3475 73/jump-if-addr>= $stream-add5:abort/disp8
3476
3477 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x14/disp8 .
3478 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3479
3480 05/add-to-eax 4/imm32
3481
3482 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3483 73/jump-if-addr>= $stream-add5:abort/disp8
3484
3485 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x18/disp8 .
3486 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3487
3488 05/add-to-eax 4/imm32
3489
3490 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3491 73/jump-if-addr>= $stream-add5:abort/disp8
3492
3493 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x1c/disp8 .
3494 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3495
3496 81 0/subop/add 0/mod/indirect 6/rm32/esi . . . . . 0x14/imm32
3497 $stream-add5:end:
3498
3499 5e/pop-to-esi
3500 5a/pop-to-edx
3501 59/pop-to-ecx
3502 58/pop-to-eax
3503
3504 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3505 5d/pop-to-ebp
3506 c3/return
3507
3508 $stream-add5:abort:
3509
3510
3511 68/push "overflow in stream-add5\n"/imm32
3512 68/push 2/imm32/stderr
3513
3514 e8/call _write/disp32
3515
3516 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3517
3518 bb/copy-to-ebx 1/imm32
3519 e8/call syscall_exit/disp32
3520
3521
3522 stream-add6:
3523
3524 55/push-ebp
3525 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3526
3527 50/push-eax
3528 51/push-ecx
3529 52/push-edx
3530 56/push-esi
3531
3532 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
3533
3534
3535 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
3536
3537 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 0/r32/eax 0xc/disp8 .
3538
3539
3540 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 8/disp8 .
3541
3542 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 2/index/edx . 2/r32/edx 0xc/disp8 .
3543
3544 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3545 73/jump-if-addr>= $stream-add6:abort/disp8
3546
3547 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0xc/disp8 .
3548 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3549
3550 05/add-to-eax 4/imm32
3551
3552 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3553 73/jump-if-addr>= $stream-add6:abort/disp8
3554
3555 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x10/disp8 .
3556 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3557
3558 05/add-to-eax 4/imm32
3559
3560 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3561 73/jump-if-addr>= $stream-add6:abort/disp8
3562
3563 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x14/disp8 .
3564 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3565
3566 05/add-to-eax 4/imm32
3567
3568 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3569 73/jump-if-addr>= $stream-add6:abort/disp8
3570
3571 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x18/disp8 .
3572 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3573
3574 05/add-to-eax 4/imm32
3575
3576 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3577 73/jump-if-addr>= $stream-add6:abort/disp8
3578 $aa-write-segment-offset:
3579
3580 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x1c/disp8 .
3581 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3582
3583 05/add-to-eax 4/imm32
3584
3585 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3586 73/jump-if-addr>= $stream-add6:abort/disp8
3587
3588 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x20/disp8 .
3589 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3590
3591 81 0/subop/add 0/mod/indirect 6/rm32/esi . . . . . 0x18/imm32
3592 $stream-add6:end:
3593
3594 5e/pop-to-esi
3595 5a/pop-to-edx
3596 59/pop-to-ecx
3597 58/pop-to-eax
3598
3599 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3600 5d/pop-to-ebp
3601 c3/return
3602
3603 $stream-add6:abort:
3604
3605
3606 68/push "overflow in stream-add6\n"/imm32
3607 68/push 2/imm32/stderr
3608
3609 e8/call _write/disp32
3610
3611 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3612
3613 bb/copy-to-ebx 1/imm32
3614 e8/call syscall_exit/disp32
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624 trace-sssns:
3625
3626 55/push-ebp
3627 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3628
3629
3630 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3631 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3632
3633 e8/call write/disp32
3634
3635 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3636
3637
3638 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3639 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3640
3641 e8/call write/disp32
3642
3643 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3644
3645
3646 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3647 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3648
3649 e8/call write/disp32
3650
3651 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3652
3653
3654 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
3655 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3656
3657 e8/call write-int32-hex/disp32
3658
3659 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3660
3661
3662 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
3663
3664 e8/call trace/disp32
3665
3666 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3667 $trace-sssns:end:
3668
3669 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3670 5d/pop-to-ebp
3671 c3/return
3672
3673 test-trace-sssns:
3674
3675 55/push-ebp
3676 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3677
3678
3679 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
3680 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
3681
3682
3683 68/push " e"/imm32
3684 68/push 3/imm32
3685 68/push "c "/imm32
3686 68/push "b"/imm32
3687 68/push "A"/imm32
3688
3689 e8/call trace-sssns/disp32
3690
3691 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
3692 +-- 26 lines: #? # dump *Trace-stream ----------------------------------------------------------------------------------------------------------------------------------
3718
3719
3720 68/push "F - test-trace-sssns"/imm32
3721 68/push "Abc 0x00000003 e"/imm32
3722
3723 e8/call check-trace-contains/disp32
3724
3725 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3726
3727 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3728 5d/pop-to-ebp
3729 c3/return
3730
3731 trace-slsls:
3732
3733 55/push-ebp
3734 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3735
3736
3737 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3738 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3739
3740 e8/call write/disp32
3741
3742 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3743
3744
3745 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3746 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3747
3748 e8/call write-slice/disp32
3749
3750 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3751
3752
3753 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3754 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3755
3756 e8/call write/disp32
3757
3758 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3759
3760
3761 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
3762 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3763
3764 e8/call write-slice/disp32
3765
3766 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3767
3768
3769 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
3770
3771 e8/call trace/disp32
3772
3773 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3774 $trace-slsls:end:
3775
3776 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3777 5d/pop-to-ebp
3778 c3/return
3779
3780 test-trace-slsls:
3781
3782 55/push-ebp
3783 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3784
3785
3786 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
3787 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
3788
3789 b8/copy-to-eax "b"/imm32
3790 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3791 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
3792 05/add-to-eax 4/imm32
3793
3794 51/push-ecx
3795 50/push-eax
3796 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
3797
3798 b8/copy-to-eax "d"/imm32
3799 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3800 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
3801 05/add-to-eax 4/imm32
3802
3803 51/push-ecx
3804 50/push-eax
3805 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
3806
3807
3808 68/push "e"/imm32
3809 52/push-edx
3810 68/push "c"/imm32
3811 53/push-ebx
3812 68/push "A"/imm32
3813
3814 e8/call trace-slsls/disp32
3815
3816 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
3817 +-- 26 lines: #? # dump *Trace-stream ----------------------------------------------------------------------------------------------------------------------------------
3843
3844
3845 68/push "F - test-trace-slsls"/imm32
3846 68/push "Abcde"/imm32
3847
3848 e8/call check-trace-contains/disp32
3849
3850 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3851
3852 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3853 5d/pop-to-ebp
3854 c3/return
3855
3856 trace-slsns:
3857
3858 55/push-ebp
3859 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3860
3861
3862 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3863 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3864
3865 e8/call write/disp32
3866
3867 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3868
3869
3870 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3871 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3872
3873 e8/call write-slice/disp32
3874
3875 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3876
3877
3878 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3879 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3880
3881 e8/call write/disp32
3882
3883 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3884
3885
3886 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
3887 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3888
3889 e8/call write-int32-hex/disp32
3890
3891 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3892
3893
3894 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
3895
3896 e8/call trace/disp32
3897
3898 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3899 $trace-slsns:end:
3900
3901 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3902 5d/pop-to-ebp
3903 c3/return
3904
3905 test-trace-slsns:
3906
3907 55/push-ebp
3908 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3909
3910
3911 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
3912 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
3913
3914 b8/copy-to-eax "b"/imm32
3915 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3916 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
3917 05/add-to-eax 4/imm32
3918
3919 51/push-ecx
3920 50/push-eax
3921 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
3922
3923
3924 68/push " e"/imm32
3925 68/push 3/imm32
3926 68/push "c "/imm32
3927 53/push-ebx
3928 68/push "A"/imm32
3929
3930 e8/call trace-slsns/disp32
3931
3932 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
3933 +-- 26 lines: #? # dump *Trace-stream ----------------------------------------------------------------------------------------------------------------------------------
3959
3960
3961 68/push "F - test-trace-slsls"/imm32
3962 68/push "Abc 0x00000003 e"/imm32
3963
3964 e8/call check-trace-contains/disp32
3965
3966 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3967
3968 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3969 5d/pop-to-ebp
3970 c3/return
3971
3972 trace-slsss:
3973
3974 55/push-ebp
3975 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3976
3977
3978 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3979 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3980
3981 e8/call write/disp32
3982
3983 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3984
3985
3986 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3987 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3988
3989 e8/call write-slice/disp32
3990
3991 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3992
3993
3994 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3995 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3996
3997 e8/call write/disp32
3998
3999 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4000
4001
4002 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
4003 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
4004
4005 e8/call write/disp32
4006
4007 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4008
4009
4010 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
4011
4012 e8/call trace/disp32
4013
4014 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4015 $trace-slsss:end:
4016
4017 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4018 5d/pop-to-ebp
4019 c3/return
4020
4021 test-trace-slsss:
4022
4023 55/push-ebp
4024 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4025
4026
4027 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
4028 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
4029
4030 b8/copy-to-eax "b"/imm32
4031 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
4032 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
4033 05/add-to-eax 4/imm32
4034
4035 51/push-ecx
4036 50/push-eax
4037 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
4038
4039
4040 68/push "e"/imm32
4041 68/push "d"/imm32
4042 68/push "c"/imm32
4043 53/push-ebx
4044 68/push "A"/imm32
4045
4046 e8/call trace-slsss/disp32
4047
4048 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
4049 +-- 26 lines: #? # dump *Trace-stream ----------------------------------------------------------------------------------------------------------------------------------
4075
4076
4077 68/push "F - test-trace-slsss"/imm32
4078 68/push "Abcde"/imm32
4079
4080 e8/call check-trace-contains/disp32
4081
4082 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4083
4084 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4085 5d/pop-to-ebp
4086 c3/return
4087
4088 num-bytes:
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105 55/push-ebp
4106 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4107
4108 51/push-ecx
4109 52/push-edx
4110 53/push-ebx
4111
4112 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
4113
4114 68/push 0/imm32/end
4115 68/push 0/imm32/start
4116 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
4117 +-- 26 lines: #? # dump line -------------------------------------------------------------------------------------------------------------------------------------------
4143
4144
4145 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
4146
4147 e8/call rewind-stream/disp32
4148
4149 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4150 $num-bytes:loop:
4151
4152
4153 51/push-ecx
4154 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
4155
4156 e8/call next-word/disp32
4157
4158 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4159 +-- 40 lines: #? # dump word-slice -------------------------------------------------------------------------------------------------------------------------------------
4199 $num-bytes:check0:
4200
4201
4202 50/push-eax
4203
4204
4205 51/push-ecx
4206
4207 e8/call slice-empty?/disp32
4208
4209 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4210
4211 3d/compare-eax-and 0/imm32/false
4212
4213 58/pop-to-eax
4214 75/jump-if-!= $num-bytes:end/disp8
4215 $num-bytes:check-for-comment:
4216
4217
4218 8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . .
4219
4220 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
4221 8a/copy-byte 0/mod/indirect 2/rm32/edx . . . 3/r32/BL . .
4222
4223 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x23/imm32/hash
4224 74/jump-if-= $num-bytes:end/disp8
4225 $num-bytes:check-for-label:
4226
4227
4228 8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 4/disp8 .
4229
4230 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
4231 8a/copy-byte 1/mod/*+disp8 2/rm32/edx . . . 3/r32/BL -1/disp8 .
4232
4233 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x3a/imm32/colon
4234 74/jump-if-= $num-bytes:end/disp8
4235 $num-bytes:check-for-segment-header:
4236
4237
4238 50/push-eax
4239
4240
4241 68/push "=="/imm32
4242 51/push-ecx
4243
4244 e8/call slice-equal?/disp32
4245
4246 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4247
4248 3d/compare-eax-and 0/imm32/false
4249
4250 58/pop-to-eax
4251 75/jump-if-!= $num-bytes:end/disp8
4252 $num-bytes:loop-body:
4253
4254
4255 89/copy 3/mod/direct 2/rm32/edx . . . 0/r32/eax . .
4256
4257
4258 51/push-ecx
4259
4260 e8/call compute-width-of-slice/disp32
4261
4262 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4263
4264 01/add 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
4265 e9/jump $num-bytes:loop/disp32
4266 $num-bytes:end:
4267
4268
4269 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
4270
4271 e8/call rewind-stream/disp32
4272
4273 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4274
4275 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4276
4277 5b/pop-to-ebx
4278 5a/pop-to-edx
4279 59/pop-to-ecx
4280
4281 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4282 5d/pop-to-ebp
4283 c3/return
4284
4285 test-num-bytes-handles-empty-string:
4286
4287
4288 55/push-ebp
4289 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4290
4291
4292
4293 68/push _test-input-stream/imm32
4294
4295 e8/call clear-stream/disp32
4296
4297 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4298
4299
4300 68/push _test-output-stream/imm32
4301
4302 e8/call clear-stream/disp32
4303
4304 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4305
4306
4307
4308 68/push _test-input-stream/imm32
4309
4310 e8/call num-bytes/disp32
4311
4312 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4313
4314
4315 68/push "F - test-num-bytes-handles-empty-string"/imm32
4316 68/push 0/imm32/true
4317 50/push-eax
4318
4319 e8/call check-ints-equal/disp32
4320
4321 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4322
4323 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4324 5d/pop-to-ebp
4325 c3/return
4326
4327 test-num-bytes-ignores-comments:
4328
4329
4330 55/push-ebp
4331 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4332
4333
4334
4335 68/push _test-input-stream/imm32
4336
4337 e8/call clear-stream/disp32
4338
4339 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4340
4341
4342 68/push _test-output-stream/imm32
4343
4344 e8/call clear-stream/disp32
4345
4346 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4347
4348
4349
4350 68/push "# abcd"/imm32
4351 68/push _test-input-stream/imm32
4352
4353 e8/call write/disp32
4354
4355 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4356
4357
4358 68/push _test-input-stream/imm32
4359
4360 e8/call num-bytes/disp32
4361
4362 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4363
4364
4365 68/push "F - test-num-bytes-ignores-comments"/imm32
4366 68/push 0/imm32/true
4367 50/push-eax
4368
4369 e8/call check-ints-equal/disp32
4370
4371 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4372
4373 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4374 5d/pop-to-ebp
4375 c3/return
4376
4377 test-num-bytes-ignores-labels:
4378
4379
4380 55/push-ebp
4381 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4382
4383
4384
4385 68/push _test-input-stream/imm32
4386
4387 e8/call clear-stream/disp32
4388
4389 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4390
4391
4392 68/push _test-output-stream/imm32
4393
4394 e8/call clear-stream/disp32
4395
4396 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4397
4398
4399
4400 68/push "ab: # cd"/imm32
4401 68/push _test-input-stream/imm32
4402
4403 e8/call write/disp32
4404
4405 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4406
4407
4408 68/push _test-input-stream/imm32
4409
4410 e8/call num-bytes/disp32
4411
4412 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4413
4414
4415 68/push "F - test-num-bytes-ignores-labels"/imm32
4416 68/push 0/imm32/true
4417 50/push-eax
4418
4419 e8/call check-ints-equal/disp32
4420
4421 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4422
4423 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4424 5d/pop-to-ebp
4425 c3/return
4426
4427 test-num-bytes-ignores-segment-headers:
4428
4429
4430 55/push-ebp
4431 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4432
4433
4434
4435 68/push _test-input-stream/imm32
4436
4437 e8/call clear-stream/disp32
4438
4439 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4440
4441
4442 68/push _test-output-stream/imm32
4443
4444 e8/call clear-stream/disp32
4445
4446 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4447
4448
4449
4450 68/push "== ab cd"/imm32
4451 68/push _test-input-stream/imm32
4452
4453 e8/call write/disp32
4454
4455 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4456
4457
4458 68/push _test-input-stream/imm32
4459
4460 e8/call num-bytes/disp32
4461
4462 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4463
4464
4465 68/push "F - test-num-bytes-ignores-segment-headers"/imm32
4466 68/push 0/imm32/true
4467 50/push-eax
4468
4469 e8/call check-ints-equal/disp32
4470
4471 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4472
4473 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4474 5d/pop-to-ebp
4475 c3/return
4476
4477 test-num-bytes-counts-words-by-default:
4478
4479
4480 55/push-ebp
4481 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4482
4483
4484
4485 68/push _test-input-stream/imm32
4486
4487 e8/call clear-stream/disp32
4488
4489 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4490
4491
4492 68/push _test-output-stream/imm32
4493
4494 e8/call clear-stream/disp32
4495
4496 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4497
4498
4499
4500 68/push "ab cd ef"/imm32
4501 68/push _test-input-stream/imm32
4502
4503 e8/call write/disp32
4504
4505 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4506
4507
4508 68/push _test-input-stream/imm32
4509
4510 e8/call num-bytes/disp32
4511
4512 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4513
4514
4515 68/push "F - test-num-bytes-counts-words-by-default"/imm32
4516 68/push 3/imm32/true
4517 50/push-eax
4518
4519 e8/call check-ints-equal/disp32
4520
4521 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4522
4523 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4524 5d/pop-to-ebp
4525 c3/return
4526
4527 test-num-bytes-ignores-trailing-comment:
4528
4529
4530 55/push-ebp
4531 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4532
4533
4534
4535 68/push _test-input-stream/imm32
4536
4537 e8/call clear-stream/disp32
4538
4539 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4540
4541
4542 68/push _test-output-stream/imm32
4543
4544 e8/call clear-stream/disp32
4545
4546 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4547
4548
4549
4550 68/push "ab cd # ef"/imm32
4551 68/push _test-input-stream/imm32
4552
4553 e8/call write/disp32
4554
4555 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4556
4557
4558 68/push _test-input-stream/imm32
4559
4560 e8/call num-bytes/disp32
4561
4562 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4563
4564
4565 68/push "F - test-num-bytes-ignores-trailing-comment"/imm32
4566 68/push 2/imm32/true
4567 50/push-eax
4568
4569 e8/call check-ints-equal/disp32
4570
4571 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4572
4573 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4574 5d/pop-to-ebp
4575 c3/return
4576
4577 test-num-bytes-handles-imm32:
4578
4579
4580 55/push-ebp
4581 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4582
4583
4584
4585 68/push _test-input-stream/imm32
4586
4587 e8/call clear-stream/disp32
4588
4589 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4590
4591
4592 68/push _test-output-stream/imm32
4593
4594 e8/call clear-stream/disp32
4595
4596 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4597
4598
4599
4600 68/push "ab cd/imm32 ef"/imm32
4601 68/push _test-input-stream/imm32
4602
4603 e8/call write/disp32
4604
4605 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4606
4607
4608 68/push _test-input-stream/imm32
4609
4610 e8/call num-bytes/disp32
4611
4612 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4613
4614
4615 68/push "F - test-num-bytes-handles-imm32"/imm32
4616 68/push 6/imm32/true
4617 50/push-eax
4618
4619 e8/call check-ints-equal/disp32
4620
4621 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4622
4623 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4624 5d/pop-to-ebp
4625 c3/return
4626
4627 == data
4628
4629
4630
4631
4632 Elf_header:
4633
4634 0x34/imm32
4635
4636 $e_ident:
4637 7f 45/E 4c/L 46/F
4638 01/32-bit 01/little-endian 01/file-version 00/no-os-extensions
4639 00 00 00 00 00 00 00 00
4640 $e_type:
4641 02 00
4642 $e_machine:
4643 03 00
4644 $e_version:
4645 1/imm32
4646 $Elf_e_entry:
4647 0x09000000/imm32
4648 $e_phoff:
4649 0x34/imm32
4650 $e_shoff:
4651 0/imm32
4652 $e_flags:
4653 0/imm32
4654 $e_ehsize:
4655 0x34 00
4656 $e_phentsize:
4657 0x20 00
4658 $Elf_e_phnum:
4659 00 00
4660 $e_shentsize:
4661 00 00
4662 $e_shnum:
4663 00 00
4664 $e_shstrndx:
4665 00 00
4666
4667
4668
4669
4670 Elf_program_header_entry:
4671
4672 0x20/imm32
4673
4674 $p_type:
4675 1/imm32/PT_LOAD
4676 $Elf_p_offset:
4677 0/imm32
4678 $Elf_p_vaddr:
4679 0/imm32
4680 $Elf_p_paddr:
4681 0/imm32
4682 $Elf_p_filesz:
4683 0/imm32
4684 $Elf_p_memsz:
4685 0/imm32
4686 $Elf_p_flags:
4687 6/imm32/rw-
4688 $p_align:
4689
4690
4691 0x1000/imm32
4692
4693