https://github.com/akkartik/mu/blob/master/apps/survey.subx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 == code
40
41
42
43
44 Entry:
45
46 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
47
48
49
50 68/push Heap/imm32
51 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Heap-size/disp32
52
53 e8/call new-segment/disp32
54
55 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
56
57
58 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-size/disp32
59
60 e8/call initialize-trace-stream/disp32
61
62 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
63
64
65
66 81 7/subop/compare 1/mod/*+disp8 5/rm32/ebp . . . . 0/disp8 1/imm32
67 7e/jump-if-lesser-or-equal $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
79 74/jump-if-equal $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 b8/copy-to-eax 1/imm32/exit
107 cd/syscall 0x80/imm8
108
109
110
111
112
113
114
115
116 subx-survey:
117
118
119
120
121
122
123
124
125
126
127
128 55/push-ebp
129 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
130
131 51/push-ecx
132 52/push-edx
133 56/push-esi
134
135 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32
136 68/push 0xa0/imm32/length
137 68/push 0/imm32/read
138 68/push 0/imm32/write
139 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
140
141
142 2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Max-labels/disp32
143
144 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Max-labels/disp32
145
146 68/push 0/imm32/read
147
148 68/push 0/imm32/write
149 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
150
151
152 2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Input-size/disp32
153
154 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Input-size/disp32
155
156 68/push 0/imm32/read
157
158 68/push 0/imm32/write
159 89/copy 3/mod/direct 6/rm32/esi . . . 4/r32/esp . .
160 +-- 41 lines: #? # dump labels->write --------------------------------------------------------------------------------------------------------------------
201 +-- 9 lines: #? # write(2/stderr, "slurp in\n") ---------------------------------------------------------------------------------------------------------
210
211
212 56/push-esi
213 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
214
215 e8/call slurp/disp32
216
217 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
218 +-- 40 lines: #? # dump labels->write --------------------------------------------------------------------------------------------------------------------
258 +-- 33 lines: #? # dump in -------------------------------------------------------------------------------------------------------------------------------
291 +-- 9 lines: #? # write(2/stderr, "compute-offsets\n") --------------------------------------------------------------------------------------------------
300
301
302 52/push-edx
303 51/push-ecx
304 56/push-esi
305
306 e8/call compute-offsets/disp32
307
308 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
309 +-- 9 lines: #? # write(2/stderr, "compute-addresses\n") ------------------------------------------------------------------------------------------------
318
319
320 52/push-edx
321 51/push-ecx
322
323 e8/call compute-addresses/disp32
324
325 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
326
327
328 56/push-esi
329
330 e8/call rewind-stream/disp32
331
332 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
333 +-- 9 lines: #? # write(2/stderr, "emit-output\n") ------------------------------------------------------------------------------------------------------
342 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
368 +-- 40 lines: #? # dump labels->write --------------------------------------------------------------------------------------------------------------------
408
409
410 52/push-edx
411 51/push-ecx
412 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
413 56/push-esi
414
415 e8/call emit-output/disp32
416
417 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
418
419
420 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
421
422 e8/call flush/disp32
423
424 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
425 $subx-survey:end:
426
427 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x30a0/imm32
428
429 5e/pop-to-esi
430 5a/pop-to-edx
431 59/pop-to-ecx
432
433 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
434 5d/pop-to-ebp
435 c3/return
436
437 test-subx-survey-computes-addresses:
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453 55/push-ebp
454 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
455
456
457
458 68/push _test-input-stream/imm32
459
460 e8/call clear-stream/disp32
461
462 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
463
464
465 68/push _test-input-buffered-file->buffer/imm32
466
467 e8/call clear-stream/disp32
468
469 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
470
471
472 68/push _test-output-stream/imm32
473
474 e8/call clear-stream/disp32
475
476 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
477
478
479 68/push _test-output-buffered-file->buffer/imm32
480
481 e8/call clear-stream/disp32
482
483 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
484
485
486
487 68/push "== code 0x1\n"/imm32
488 68/push _test-input-stream/imm32
489
490 e8/call write/disp32
491
492 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
493
494
495 68/push "Entry:\n"/imm32
496 68/push _test-input-stream/imm32
497
498 e8/call write/disp32
499
500 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
501
502
503 68/push "ab x/imm32\n"/imm32
504 68/push _test-input-stream/imm32
505
506 e8/call write/disp32
507
508 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
509
510
511 68/push "== data 0x1000\n"/imm32
512 68/push _test-input-stream/imm32
513
514 e8/call write/disp32
515
516 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
517
518
519 68/push "x:\n"/imm32
520 68/push _test-input-stream/imm32
521
522 e8/call write/disp32
523
524 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
525
526
527 68/push "01\n"/imm32
528 68/push _test-input-stream/imm32
529
530 e8/call write/disp32
531
532 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
533
534
535 68/push _test-output-buffered-file/imm32
536 68/push _test-input-buffered-file/imm32
537
538 e8/call subx-survey/disp32
539
540 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
541
542 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
568
569
570 68/push "F - test-subx-survey-computes-addresses/0"/imm32
571 68/push "label 'x' is at address 0x00001079."/imm32
572
573 e8/call check-trace-contains/disp32
574
575 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
576
577
578 68/push "F - test-subx-survey-computes-addresses/1"/imm32
579 68/push "segment 'code' starts at address 0x00000074."/imm32
580
581 e8/call check-trace-contains/disp32
582
583 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
584
585
586 68/push "F - test-subx-survey-computes-addresses/2"/imm32
587 68/push "segment 'code' has size 0x00000005."/imm32
588
589 e8/call check-trace-contains/disp32
590
591 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
592
593
594 68/push "F - test-subx-survey-computes-addresses/3"/imm32
595 68/push "segment 'data' starts at address 0x00001079."/imm32
596
597 e8/call check-trace-contains/disp32
598
599 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
600
601 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
602 5d/pop-to-ebp
603 c3/return
604
605
606 == data
607
608 compute-offsets:file-offset:
609 0/imm32
610 compute-offsets:segment-offset:
611 0/imm32
612 compute-offsets:word-slice:
613 0/imm32/start
614 0/imm32/end
615 compute-offsets:segment-tmp:
616 0/imm32/start
617 0/imm32/end
618
619 == code
620
621 compute-offsets:
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676 55/push-ebp
677 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
678
679 50/push-eax
680 51/push-ecx
681 52/push-edx
682 53/push-ebx
683 56/push-esi
684 57/push-edi
685
686 31/xor 3/mod/direct 6/rm32/esi . . . 6/r32/esi . .
687
688 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:file-offset/disp32 0/imm32
689
690 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:segment-offset/disp32 0/imm32
691
692 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32
693 68/push 0x200/imm32/length
694 68/push 0/imm32/read
695 68/push 0/imm32/write
696 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
697 $compute-offsets:line-loop:
698
699 51/push-ecx
700 e8/call clear-stream/disp32
701
702 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
703
704 51/push-ecx
705 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
706 e8/call read-line/disp32
707
708 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
709
710 8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . .
711 3d/compare-eax-and 0/imm32
712 0f 84/jump-if-equal $compute-offsets:break-line-loop/disp32
713 +-- 33 lines: #? # dump line -----------------------------------------------------------------------------------------------------------------------------
746 $compute-offsets:word-loop:
747
748 ba/copy-to-edx compute-offsets:word-slice/imm32
749
750 52/push-edx
751 51/push-ecx
752 e8/call next-word/disp32
753
754 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
755 +-- 74 lines: #? # dump word-slice and maybe curr-segment-name -------------------------------------------------------------------------------------------
829 $compute-offsets:case-empty:
830
831
832 52/push-edx
833 e8/call slice-empty?/disp32
834
835 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
836
837 3d/compare-eax-and 0/imm32
838 0f 85/jump-if-not-equal $compute-offsets:line-loop/disp32
839 $compute-offsets:case-comment:
840
841 68/push "#"/imm32
842 52/push-edx
843 e8/call slice-starts-with?/disp32
844
845 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
846
847 3d/compare-eax-and 0/imm32
848 0f 85/jump-if-not-equal $compute-offsets:line-loop/disp32
849 $compute-offsets:case-segment-header:
850
851
852 68/push "=="/imm32
853 52/push-edx
854 e8/call slice-equal?/disp32
855
856 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
857
858 3d/compare-eax-and 0/imm32
859 0f 84/jump-if-equal $compute-offsets:case-label/disp32
860
861 81 7/subop/compare 3/mod/direct 6/rm32/esi . . . . . 0/imm32
862 74/jump-if-equal $compute-offsets:construct-next-segment/disp8
863
864
865 68/push 0x10/imm32/row-size
866 56/push-esi
867 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
868
869 e8/call get-or-insert/disp32
870
871 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
872
873
874 51/push-ecx
875
876 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx compute-offsets:file-offset/disp32
877
878 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 1/r32/ecx 4/disp8 .
879
880 29/subtract 3/mod/direct 3/rm32/ebx . . . 1/r32/ecx . .
881
882 89/copy 1/mod/*+disp8 0/rm32/eax . . . 3/r32/ebx 8/disp8 .
883
884 59/pop-to-ecx
885
886
887 68/push "."/imm32
888 53/push-ebx
889 68/push "' has size "/imm32
890 56/push-esi
891 68/push "segment '"/imm32
892
893 e8/call trace-sssns/disp32
894
895 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
896 $compute-offsets:construct-next-segment:
897
898 68/push compute-offsets:segment-tmp/imm32
899 51/push-ecx
900 e8/call next-word/disp32
901
902 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
903 +-- 45 lines: #? # dump curr-segment-name if not null (clobbering eax) -----------------------------------------------------------------------------------
948 $compute-offsets:update-curr-segment-name:
949
950
951
952 68/push compute-offsets:segment-tmp/imm32
953 68/push Heap/imm32
954
955 e8/call slice-to-string/disp32
956
957 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
958
959 89/copy 3/mod/direct 6/rm32/esi . . . 0/r32/eax . .
960
961
962 3d/compare-eax-and 0/imm32
963 0f 84/jump-if-equal $compute-offsets:abort/disp32
964
965 68/push compute-offsets:segment-tmp/imm32
966 51/push-ecx
967 e8/call next-word/disp32
968
969 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
970
971
972 68/push compute-offsets:segment-tmp/imm32
973 e8/call slice-empty?/disp32
974
975 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
976
977 3d/compare-eax-and 0/imm32
978 0f 85/jump-if-not-equal $compute-offsets:abort/disp32
979
980
981 68/push 0x10/imm32/row-size
982 56/push-esi
983 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
984
985 e8/call get-or-insert/disp32
986
987 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
988
989 89/copy 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . .
990
991
992 68/push compute-offsets:segment-tmp/imm32
993 e8/call parse-hex-int/disp32
994
995 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
996
997 89/copy 0/mod/indirect 3/rm32/ebx . . . 0/r32/eax . .
998
999 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax compute-offsets:file-offset/disp32
1000 89/copy 1/mod/*+disp8 3/rm32/ebx . . . 0/r32/eax 4/disp8 .
1001
1002
1003 68/push "."/imm32
1004 50/push-eax
1005 68/push "' is at file offset "/imm32
1006 56/push-esi
1007 68/push "segment '"/imm32
1008
1009 e8/call trace-sssns/disp32
1010
1011 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1012
1013 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:segment-offset/disp32 0/imm32
1014
1015 e9/jump $compute-offsets:line-loop/disp32
1016 $compute-offsets:case-label:
1017
1018
1019
1020 52/push-edx
1021
1022 e8/call is-label?/disp32
1023
1024 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1025
1026 3d/compare-eax-and 0/imm32
1027 74/jump-if-equal $compute-offsets:case-default/disp8
1028
1029 ff 1/subop/decrement 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
1030
1031
1032 68/push 0x10/imm32/row-size
1033 52/push-edx
1034 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
1035
1036 e8/call leaky-get-or-insert-slice/disp32
1037
1038 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1039 $compute-offsets:save-label-offset:
1040
1041 89/copy 0/mod/indirect 0/rm32/eax . . . 6/r32/esi . .
1042
1043
1044 68/push "'."/imm32
1045 56/push-esi
1046 68/push "' is in segment '"/imm32
1047 52/push-edx
1048 68/push "label '"/imm32
1049
1050 e8/call trace-slsss/disp32
1051
1052 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1053
1054
1055 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx compute-offsets:segment-offset/disp32
1056
1057 89/copy 1/mod/*+disp8 0/rm32/eax . . . 3/r32/ebx 4/disp8 .
1058
1059
1060 b8/copy-to-eax compute-offsets:segment-offset/imm32
1061
1062 8b/copy 0/mod/indirect 0/rm32/eax . . . 0/r32/eax . .
1063
1064 68/push "."/imm32
1065 50/push-eax
1066 68/push "' is at segment offset "/imm32
1067 52/push-edx
1068 68/push "label '"/imm32
1069
1070 e8/call trace-slsns/disp32
1071
1072 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1073
1074 e9/jump $compute-offsets:word-loop/disp32
1075 $compute-offsets:case-default:
1076
1077
1078 52/push-edx
1079
1080 e8/call compute-width-of-slice/disp32
1081
1082 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1083
1084 01/add 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax compute-offsets:segment-offset/disp32
1085
1086 01/add 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax compute-offsets:file-offset/disp32
1087 +-- 41 lines: #? # dump segment-offset -------------------------------------------------------------------------------------------------------------------
1128 e9/jump $compute-offsets:word-loop/disp32
1129 $compute-offsets:break-line-loop:
1130
1131
1132 68/push 0x10/imm32/row-size
1133 56/push-esi
1134 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1135
1136 e8/call get-or-insert/disp32
1137
1138 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1139
1140
1141 51/push-ecx
1142
1143 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx compute-offsets:file-offset/disp32
1144
1145 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 1/r32/ecx 4/disp8 .
1146
1147 29/subtract 3/mod/direct 3/rm32/ebx . . . 1/r32/ecx . .
1148
1149 89/copy 1/mod/*+disp8 0/rm32/eax . . . 3/r32/ebx 8/disp8 .
1150
1151 59/pop-to-ecx
1152
1153
1154
1155 68/push "."/imm32
1156 53/push-ebx
1157 68/push "' has size "/imm32
1158 56/push-esi
1159 68/push "segment '"/imm32
1160
1161 e8/call trace-sssns/disp32
1162
1163 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1164 $compute-offsets:end:
1165
1166 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x20c/imm32
1167
1168 5f/pop-to-edi
1169 5e/pop-to-esi
1170 5b/pop-to-ebx
1171 5a/pop-to-edx
1172 59/pop-to-ecx
1173 58/pop-to-eax
1174
1175 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1176 5d/pop-to-ebp
1177 c3/return
1178
1179 $compute-offsets:abort:
1180
1181
1182 68/push "'==' must be followed by segment name and segment-start\n"/imm32
1183 68/push 2/imm32/stderr
1184
1185 e8/call _write/disp32
1186
1187 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1188
1189 bb/copy-to-ebx 1/imm32
1190 b8/copy-to-eax 1/imm32/exit
1191 cd/syscall 0x80/imm8
1192
1193
1194 test-compute-offsets:
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212 55/push-ebp
1213 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1214
1215
1216
1217 68/push _test-input-stream/imm32
1218
1219 e8/call clear-stream/disp32
1220
1221 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1222
1223 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x20/imm32
1224 68/push 0x20/imm32/length
1225 68/push 0/imm32/read
1226 68/push 0/imm32/write
1227 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1228
1229 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x20/imm32
1230 68/push 0x20/imm32/length
1231 68/push 0/imm32/read
1232 68/push 0/imm32/write
1233 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1234
1235
1236
1237 68/push "== code 0x1\n"/imm32
1238 68/push _test-input-stream/imm32
1239
1240 e8/call write/disp32
1241
1242 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1243
1244
1245 68/push "ab x/imm32 # skip comment\n"/imm32
1246 68/push _test-input-stream/imm32
1247
1248 e8/call write/disp32
1249
1250 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1251
1252
1253 68/push "== data 0x1000\n"/imm32
1254 68/push _test-input-stream/imm32
1255
1256 e8/call write/disp32
1257
1258 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1259
1260
1261 68/push "00\n"/imm32
1262 68/push _test-input-stream/imm32
1263
1264 e8/call write/disp32
1265
1266 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1267
1268
1269 68/push "x:\n"/imm32
1270 68/push _test-input-stream/imm32
1271
1272 e8/call write/disp32
1273
1274 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1275
1276
1277 68/push "34\n"/imm32
1278 68/push _test-input-stream/imm32
1279
1280 e8/call write/disp32
1281
1282 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1283
1284
1285 52/push-edx
1286 51/push-ecx
1287 68/push _test-input-stream/imm32
1288
1289 e8/call compute-offsets/disp32
1290
1291 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1292 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
1318
1319
1320
1321 68/push "F - test-compute-offsets/0"/imm32
1322 68/push "segment 'code' is at file offset 0x00000000."/imm32
1323
1324 e8/call check-trace-contains/disp32
1325
1326 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1327
1328
1329 68/push "F - test-compute-offsets/1"/imm32
1330 68/push "segment 'code' has size 0x00000005."/imm32
1331
1332 e8/call check-trace-contains/disp32
1333
1334 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1335
1336
1337 68/push "F - test-compute-offsets/2"/imm32
1338 68/push "segment 'data' is at file offset 0x00000005."/imm32
1339
1340 e8/call check-trace-contains/disp32
1341
1342 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1343
1344
1345 68/push "F - test-compute-offsets/3"/imm32
1346 68/push "segment 'data' has size 0x00000002."/imm32
1347
1348 e8/call check-trace-contains/disp32
1349
1350 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1351
1352
1353 68/push "F - test-compute-offsets/4"/imm32
1354 68/push "label 'x' is in segment 'data'."/imm32
1355
1356 e8/call check-trace-contains/disp32
1357
1358 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1359
1360
1361 68/push "F - test-compute-offsets/5"/imm32
1362 68/push "label 'x' is at segment offset 0x00000001."/imm32
1363
1364 e8/call check-trace-contains/disp32
1365
1366 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1367
1368
1369 68/push "F - test-compute-offsets-maintains-labels-write-index"/imm32
1370 68/push 0x10/imm32/1-entry
1371 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
1372
1373 e8/call check-ints-equal/disp32
1374
1375 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1376
1377 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1378 5d/pop-to-ebp
1379 c3/return
1380
1381 compute-addresses:
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405 55/push-ebp
1406 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1407
1408 50/push-eax
1409 51/push-ecx
1410 52/push-edx
1411 53/push-ebx
1412 56/push-esi
1413 57/push-edi
1414
1415 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
1416
1417
1418 8b/copy 0/mod/indirect 6/rm32/esi . . . 7/r32/edi . .
1419 c1/shift 5/subop/logic-right 3/mod/direct 7/rm32/edi . . . . . 4/imm8
1420
1421 c1/shift 4/subop/left 3/mod/direct 7/rm32/edi . . . . . 5/imm8
1422 81 0/subop/add 3/mod/direct 7/rm32/edi . . . . . 0x34/imm32
1423
1424 8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 0xc/disp8 .
1425
1426 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . .
1427 01/add 3/mod/direct 1/rm32/ecx . . . 6/r32/esi . .
1428 $compute-addresses:segment-loop:
1429
1430 39/compare 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . .
1431 73/jump-if-greater-or-equal-unsigned $compute-addresses:segment-break/disp8
1432
1433 01/add 1/mod/*+disp8 0/rm32/eax . . . 7/r32/edi 8/disp8 .
1434
1435
1436 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 2/r32/edx 4/disp8 .
1437
1438 81 4/subop/and 3/mod/direct 2/rm32/edx . . . . . 0xfffff000/imm32
1439
1440
1441 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 3/r32/ebx 8/disp8 .
1442
1443 81 4/subop/and 3/mod/direct 3/rm32/ebx . . . . . 0x00000fff/imm32
1444
1445 09/or 3/mod/direct 2/rm32/edx . . . 3/r32/ebx . .
1446 89/copy 1/mod/*+disp8 0/rm32/eax . . . 2/r32/edx 4/disp8 .
1447
1448
1449 68/push "."/imm32
1450 52/push-edx
1451 68/push "' starts at address "/imm32
1452 ff 6/subop/push 0/mod/indirect 0/rm32/eax . . . . . .
1453 68/push "segment '"/imm32
1454
1455 e8/call trace-sssns/disp32
1456
1457 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1458
1459 05/add-to-eax 0x10/imm32
1460 eb/jump $compute-addresses:segment-loop/disp8
1461 $compute-addresses:segment-break:
1462 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
1488
1489 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
1490
1491 8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 0xc/disp8 .
1492
1493 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . .
1494 01/add 3/mod/direct 1/rm32/ecx . . . 6/r32/esi . .
1495 $compute-addresses:label-loop:
1496
1497 39/compare 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . .
1498 0f 83/jump-if-greater-or-equal-unsigned $compute-addresses:end/disp32
1499 +-- 26 lines: #? # dump lrow->key ------------------------------------------------------------------------------------------------------------------------
1525
1526 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 2/r32/edx 4/disp8 .
1527 +-- 26 lines: #? # dump seg-name -------------------------------------------------------------------------------------------------------------------------
1553
1554
1555 50/push-eax
1556
1557
1558 68/push "segment table"/imm32
1559 68/push 0x10/imm32/row-size
1560 52/push-edx
1561 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
1562
1563 e8/call get/disp32
1564
1565 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
1566
1567 89/copy 3/mod/direct 2/rm32/edx . . . 0/r32/eax . .
1568
1569 58/pop-to-eax
1570
1571 8b/copy 0/mod/indirect 2/rm32/edx . . . 3/r32/ebx . .
1572
1573 03/add 1/mod/*+disp8 0/rm32/eax . . . 3/r32/ebx 8/disp8 .
1574
1575 89/copy 1/mod/*+disp8 0/rm32/eax . . . 3/r32/ebx 0xc/disp8 .
1576
1577
1578 68/push "."/imm32
1579 53/push-ebx
1580 68/push "' is at address "/imm32
1581 ff 6/subop/push 0/mod/indirect 0/rm32/eax . . . . . .
1582 68/push "label '"/imm32
1583
1584 e8/call trace-sssns/disp32
1585
1586 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1587
1588 05/add-to-eax 0x10/imm32
1589 e9/jump $compute-addresses:label-loop/disp32
1590 $compute-addresses:end:
1591
1592 5f/pop-to-edi
1593 5e/pop-to-esi
1594 5b/pop-to-ebx
1595 5a/pop-to-edx
1596 59/pop-to-ecx
1597 58/pop-to-eax
1598
1599 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1600 5d/pop-to-ebp
1601 c3/return
1602
1603 test-compute-addresses:
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621 55/push-ebp
1622 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1623
1624
1625 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32
1626 68/push 0xa0/imm32/length
1627 68/push 0/imm32/read
1628 68/push 0/imm32/write
1629 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1630
1631 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32
1632 68/push 0x2000/imm32/length
1633 68/push 0/imm32/read
1634 68/push 0/imm32/write
1635 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1636
1637 68/push 5/imm32/segment-size
1638 68/push 0/imm32/file-offset
1639 68/push 0x1000/imm32/start-address
1640 68/push "a"/imm32/segment-name
1641 51/push-ecx
1642
1643 e8/call stream-add4/disp32
1644
1645 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1646
1647 68/push 1/imm32/segment-size
1648 68/push 5/imm32/file-offset
1649 68/push 0x2018/imm32/start-address
1650 68/push "b"/imm32/segment-name
1651 51/push-ecx
1652
1653 e8/call stream-add4/disp32
1654
1655 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1656
1657 68/push 0xc/imm32/segment-size
1658 68/push 6/imm32/file-offset
1659 68/push 0x5444/imm32/start-address
1660 68/push "c"/imm32/segment-name
1661 51/push-ecx
1662
1663 e8/call stream-add4/disp32
1664
1665 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1666
1667 68/push 0/imm32/label-address
1668 68/push 3/imm32/segment-offset
1669 68/push "a"/imm32/segment-name
1670 68/push "l1"/imm32/label-name
1671 52/push-edx
1672
1673 e8/call stream-add4/disp32
1674
1675 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1676
1677 68/push 0/imm32/label-address
1678 68/push 0/imm32/segment-offset
1679 68/push "b"/imm32/segment-name
1680 68/push "l2"/imm32/label-name
1681 52/push-edx
1682
1683 e8/call stream-add4/disp32
1684
1685 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1686
1687
1688
1689 52/push-edx
1690 51/push-ecx
1691
1692 e8/call compute-addresses/disp32
1693
1694 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1695
1696 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
1722
1723
1724 68/push "F - test-compute-addresses/0"/imm32
1725 68/push "segment 'a' starts at address 0x00001094."/imm32
1726
1727 e8/call check-trace-contains/disp32
1728
1729 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1730
1731
1732 68/push "F - test-compute-addresses/1"/imm32
1733 68/push "segment 'b' starts at address 0x00002099."/imm32
1734
1735 e8/call check-trace-contains/disp32
1736
1737 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1738
1739
1740 68/push "F - test-compute-addresses/2"/imm32
1741 68/push "segment 'c' starts at address 0x0000509a."/imm32
1742
1743 e8/call check-trace-contains/disp32
1744
1745 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1746
1747
1748 68/push "F - test-compute-addresses/3"/imm32
1749 68/push "label 'l1' is at address 0x00001097."/imm32
1750
1751 e8/call check-trace-contains/disp32
1752
1753 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1754
1755
1756 68/push "F - test-compute-addresses/4"/imm32
1757 68/push "label 'l2' is at address 0x00002099."/imm32
1758
1759 e8/call check-trace-contains/disp32
1760
1761 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1762
1763
1764 68/push "F - test-compute-addresses/maintains-labels-write-index"/imm32
1765 68/push 0x20/imm32/2-entries
1766 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
1767
1768 e8/call check-ints-equal/disp32
1769
1770 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1771
1772 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1773 5d/pop-to-ebp
1774 c3/return
1775
1776 test-compute-addresses-large-segments:
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790 55/push-ebp
1791 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1792
1793
1794 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32
1795 68/push 0xa0/imm32/length
1796 68/push 0/imm32/read
1797 68/push 0/imm32/write
1798 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1799
1800 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32
1801 68/push 0x2000/imm32/length
1802 68/push 0/imm32/read
1803 68/push 0/imm32/write
1804 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1805
1806 68/push 0x5604/imm32/segment-size
1807 68/push 0/imm32/file-offset
1808 68/push 0x1000/imm32/start-address
1809 68/push "a"/imm32/segment-name
1810 51/push-ecx
1811
1812 e8/call stream-add4/disp32
1813
1814 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1815
1816 68/push 1/imm32/segment-size
1817 68/push 0x5604/imm32/file-offset
1818 68/push 0x2018/imm32/start-address
1819 68/push "b"/imm32/segment-name
1820 51/push-ecx
1821
1822 e8/call stream-add4/disp32
1823
1824 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1825
1826 68/push 0/imm32/label-address
1827 68/push 3/imm32/segment-offset
1828 68/push "a"/imm32/segment-name
1829 68/push "l1"/imm32/label-name
1830 52/push-edx
1831
1832 e8/call stream-add4/disp32
1833
1834 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1835
1836
1837
1838 52/push-edx
1839 51/push-ecx
1840
1841 e8/call compute-addresses/disp32
1842
1843 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1844
1845
1846
1847 68/push "F - test-compute-addresses-large-segments/0"/imm32
1848 68/push "segment 'a' starts at address 0x00001074."/imm32
1849
1850 e8/call check-trace-contains/disp32
1851
1852 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1853
1854
1855 68/push "F - test-compute-addresses-large-segments/1"/imm32
1856 68/push "segment 'b' starts at address 0x00002678."/imm32
1857
1858 e8/call check-trace-contains/disp32
1859
1860 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1861
1862
1863 68/push "F - test-compute-addresses-large-segments/3"/imm32
1864 68/push "label 'l1' is at address 0x00001077."/imm32
1865
1866 e8/call check-trace-contains/disp32
1867
1868 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1869
1870 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1871 5d/pop-to-ebp
1872 c3/return
1873
1874 emit-output:
1875
1876
1877
1878
1879
1880 55/push-ebp
1881 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1882 +-- 9 lines: #? # write(2/stderr, "emit-headers\n") -----------------------------------------------------------------------------------------------------
1891
1892
1893 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
1894 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
1895 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1896
1897 e8/call emit-headers/disp32
1898
1899 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1900 +-- 9 lines: #? # write(2/stderr, "emit-segments\n") ----------------------------------------------------------------------------------------------------
1909
1910
1911 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
1912 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
1913 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1914 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
1915
1916 e8/call emit-segments/disp32
1917
1918 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
1919 $emit-output:end:
1920
1921 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1922 5d/pop-to-ebp
1923 c3/return
1924
1925 emit-segments:
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981 55/push-ebp
1982 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1983
1984 50/push-eax
1985 51/push-ecx
1986 52/push-edx
1987 53/push-ebx
1988 56/push-esi
1989 57/push-edi
1990
1991 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32
1992 68/push 0x200/imm32/length
1993 68/push 0/imm32/read
1994 68/push 0/imm32/write
1995 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1996
1997 68/push 0/imm32/end
1998 68/push 0/imm32/start
1999 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
2000
2001 68/push 0/imm32/end
2002 68/push 0/imm32/start
2003 89/copy 3/mod/direct 7/rm32/edi . . . 4/r32/esp . .
2004
2005 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
2006 $emit-segments:line-loop:
2007
2008
2009 51/push-ecx
2010
2011 e8/call clear-stream/disp32
2012
2013 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2014
2015
2016 51/push-ecx
2017 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
2018
2019 e8/call read-line/disp32
2020
2021 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2022 +-- 33 lines: #? # dump line -----------------------------------------------------------------------------------------------------------------------------
2055 $emit-segments:check-for-end-of-input:
2056
2057 81 7/subop/compare 0/mod/indirect 1/rm32/ecx . . . . . 0/imm32
2058 0f 84/jump-if-equal $emit-segments:end/disp32
2059
2060
2061
2062 51/push-ecx
2063
2064 e8/call num-bytes/disp32
2065
2066 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2067
2068 01/add 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . .
2069 $emit-segments:word-loop:
2070
2071
2072 52/push-edx
2073 51/push-ecx
2074
2075 e8/call next-word/disp32
2076
2077 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2078 +-- 33 lines: #? # dump word-slice -----------------------------------------------------------------------------------------------------------------------
2111 $emit-segments:check-for-end-of-line:
2112
2113
2114
2115 52/push-edx
2116
2117 e8/call slice-empty?/disp32
2118
2119 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2120
2121 3d/compare-eax-and 0/imm32
2122 0f 85/jump-if-not-equal $emit-segments:next-line/disp32
2123 $emit-segments:check-for-comment:
2124
2125
2126 8b/copy 0/mod/indirect 2/rm32/edx . . . 6/r32/esi . .
2127
2128 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
2129 8a/copy-byte 0/mod/indirect 6/rm32/esi . . . 0/r32/AL . .
2130
2131 3d/compare-eax-and 0x23/imm32/hash
2132 0f 84/jump-if-equal $emit-segments:next-line/disp32
2133 $emit-segments:check-for-label:
2134
2135
2136
2137 52/push-edx
2138
2139 e8/call is-label?/disp32
2140
2141 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2142
2143 3d/compare-eax-and 0/imm32
2144 0f 85/jump-if-not-equal $emit-segments:line-loop/disp32
2145 $emit-segments:check-for-segment-header:
2146
2147
2148
2149 68/push "=="/imm32
2150 52/push-edx
2151
2152 e8/call slice-equal?/disp32
2153
2154 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2155
2156 3d/compare-eax-and 0/imm32
2157 0f 85/jump-if-not-equal $emit-segments:line-loop/disp32
2158 $emit-segments:2-character:
2159
2160
2161 8b/copy 1/mod/*+disp8 2/rm32/edx . . . 0/r32/eax 4/disp8 .
2162 2b/subtract 0/mod/indirect 2/rm32/edx . . . 0/r32/eax . .
2163
2164 3d/compare-eax-and 2/imm32
2165 75/jump-if-not-equal $emit-segments:check-metadata/disp8
2166
2167
2168 52/push-edx
2169 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2170
2171 e8/call write-slice-buffered/disp32
2172
2173 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2174
2175
2176 68/push Space/imm32
2177 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2178
2179 e8/call write-buffered/disp32
2180
2181 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2182
2183 e9/jump $emit-segments:word-loop/disp32
2184 $emit-segments:check-metadata:
2185
2186
2187
2188 57/push-edi
2189 68/push 0x2f/imm32/slash
2190 ff 6/subop/push 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
2191 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
2192
2193 e8/call next-token-from-slice/disp32
2194
2195 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
2196 +-- 33 lines: #? # dump word-slice -----------------------------------------------------------------------------------------------------------------------
2229
2230
2231
2232 68/push "label table"/imm32
2233 68/push 0x10/imm32/row-size
2234 57/push-edi
2235 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
2236
2237 e8/call get-slice/disp32
2238
2239 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
2240
2241 89/copy 3/mod/direct 6/rm32/esi . . . 0/r32/eax . .
2242 $emit-segments:check-global-variable:
2243 +-- 26 lines: #? # dump info->segment-name ---------------------------------------------------------------------------------------------------------------
2269
2270
2271
2272 68/push "code"/imm32
2273 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
2274
2275 e8/call string-equal?/disp32
2276
2277 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2278
2279 3d/compare-eax-and 0/imm32
2280 0f 85/jump-if-not-equal $emit-segments:check-code-label-for-imm8/disp32
2281 $emit-segments:check-global-variable-for-disp8:
2282
2283
2284
2285 68/push "disp8"/imm32
2286 52/push-edx
2287
2288 e8/call has-metadata?/disp32
2289
2290 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2291
2292 3d/compare-eax-and 0/imm32
2293 0f 85/jump-if-not-equal $emit-segments:global-variable-abort/disp32
2294 $emit-segments:check-global-variable-for-imm8:
2295
2296
2297
2298 68/push "imm8"/imm32
2299 52/push-edx
2300
2301 e8/call has-metadata?/disp32
2302
2303 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2304
2305 3d/compare-eax-and 0/imm32
2306 0f 85/jump-if-not-equal $emit-segments:global-variable-abort/disp32
2307 $emit-segments:emit-global-variable:
2308
2309
2310 68/push 4/imm32
2311 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 8/disp8 .
2312 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2313
2314 e8/call emit-hex/disp32
2315
2316 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2317
2318 e9/jump $emit-segments:word-loop/disp32
2319 $emit-segments:check-code-label-for-imm8:
2320
2321
2322
2323 68/push "imm8"/imm32
2324 52/push-edx
2325
2326 e8/call has-metadata?/disp32
2327
2328 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2329
2330 3d/compare-eax-and 0/imm32
2331 0f 85/jump-if-not-equal $emit-segments:imm8-abort/disp32
2332 $emit-segments:check-code-label-for-imm32:
2333
2334
2335
2336 68/push "imm32"/imm32
2337 52/push-edx
2338
2339 e8/call has-metadata?/disp32
2340
2341 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2342
2343 3d/compare-eax-and 0/imm32
2344 74/jump-if-equal $emit-segments:check-code-label-for-disp8/disp8
2345 +-- 33 lines: #? # dump info->address --------------------------------------------------------------------------------------------------------------------
2378 $emit-segments:emit-code-label-imm32:
2379
2380
2381 68/push 4/imm32
2382 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 8/disp8 .
2383 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2384
2385 e8/call emit-hex/disp32
2386
2387 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2388
2389 e9/jump $emit-segments:word-loop/disp32
2390 $emit-segments:check-code-label-for-disp8:
2391
2392
2393
2394 68/push "disp8"/imm32
2395 52/push-edx
2396
2397 e8/call has-metadata?/disp32
2398
2399 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2400
2401 3d/compare-eax-and 0/imm32
2402 74/jump-if-equal $emit-segments:check-code-label-for-disp32/disp8
2403 $emit-segments:emit-code-label-disp8:
2404
2405
2406 68/push 1/imm32
2407 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 4/disp8 .
2408 29/subtract 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
2409 50/push-eax
2410 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2411
2412 e8/call emit-hex/disp32
2413
2414 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2415
2416 e9/jump $emit-segments:word-loop/disp32
2417 $emit-segments:check-code-label-for-disp32:
2418
2419
2420
2421 68/push "disp32"/imm32
2422 52/push-edx
2423
2424 e8/call has-metadata?/disp32
2425
2426 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2427
2428 3d/compare-eax-and 0/imm32
2429 0f 84/jump-if-equal $emit-segments:abort/disp32
2430 $emit-segments:emit-code-label-disp32:
2431
2432
2433 68/push 4/imm32
2434 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 4/disp8 .
2435 29/subtract 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
2436 50/push-eax
2437 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2438
2439 e8/call emit-hex/disp32
2440
2441 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2442
2443 e9/jump $emit-segments:word-loop/disp32
2444 $emit-segments:next-line:
2445
2446
2447 68/push Newline/imm32
2448 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2449
2450 e8/call write-buffered/disp32
2451
2452 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2453
2454 e9/jump $emit-segments:line-loop/disp32
2455 $emit-segments:end:
2456
2457 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x21c/imm32
2458
2459 5f/pop-to-edi
2460 5e/pop-to-esi
2461 5b/pop-to-ebx
2462 5a/pop-to-edx
2463 59/pop-to-ecx
2464 58/pop-to-eax
2465
2466 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2467 5d/pop-to-ebp
2468 c3/return
2469
2470 $emit-segments:global-variable-abort:
2471
2472
2473 68/push "emit-segments: must refer to global variables with /disp32 or /imm32"/imm32
2474 68/push 2/imm32/stderr
2475
2476 e8/call _write/disp32
2477
2478 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2479
2480 bb/copy-to-ebx 1/imm32
2481 b8/copy-to-eax 1/imm32/exit
2482 cd/syscall 0x80/imm8
2483
2484
2485 $emit-segments:imm8-abort:
2486
2487
2488 68/push "emit-segments: cannot refer to code labels with /imm8"/imm32
2489 68/push 2/imm32/stderr
2490
2491 e8/call _write/disp32
2492
2493 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2494
2495 bb/copy-to-ebx 1/imm32
2496 b8/copy-to-eax 1/imm32/exit
2497 cd/syscall 0x80/imm8
2498
2499
2500 $emit-segments:abort:
2501
2502
2503
2504 68/push "emit-segments: missing metadata in "/imm32
2505 68/push 2/imm32/stderr
2506
2507 e8/call _write/disp32
2508
2509 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2510
2511
2512 52/push-edx
2513 68/push Stderr/imm32
2514
2515 e8/call write-slice-buffered/disp32
2516
2517 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2518
2519
2520 68/push Stderr/imm32
2521
2522 e8/call flush/disp32
2523
2524 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2525
2526 bb/copy-to-ebx 1/imm32
2527 b8/copy-to-eax 1/imm32/exit
2528 cd/syscall 0x80/imm8
2529
2530
2531 test-emit-segments-global-variable:
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556 55/push-ebp
2557 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2558
2559
2560
2561 68/push _test-input-stream/imm32
2562
2563 e8/call clear-stream/disp32
2564
2565 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2566
2567
2568 68/push _test-output-stream/imm32
2569
2570 e8/call clear-stream/disp32
2571
2572 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2573
2574
2575 68/push _test-output-buffered-file->buffer/imm32
2576
2577 e8/call clear-stream/disp32
2578
2579 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2580
2581 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32
2582 68/push 0xa0/imm32/length
2583 68/push 0/imm32/read
2584 68/push 0/imm32/write
2585 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
2586
2587 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32
2588 68/push 0x2000/imm32/length
2589 68/push 0/imm32/read
2590 68/push 0/imm32/write
2591 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
2592
2593
2594
2595 68/push "== code 0x1000\n"/imm32
2596 68/push _test-input-stream/imm32
2597
2598 e8/call write/disp32
2599
2600 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2601
2602
2603 68/push "ab cd ef gh\n"/imm32
2604 68/push _test-input-stream/imm32
2605
2606 e8/call write/disp32
2607
2608 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2609
2610
2611 68/push "ij x/disp32\n"/imm32
2612 68/push _test-input-stream/imm32
2613
2614 e8/call write/disp32
2615
2616 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2617
2618
2619 68/push "== data 0x2000\n"/imm32
2620 68/push _test-input-stream/imm32
2621
2622 e8/call write/disp32
2623
2624 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2625
2626
2627 68/push "00\n"/imm32
2628 68/push _test-input-stream/imm32
2629
2630 e8/call write/disp32
2631
2632 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2633
2634
2635 68/push "x:\n"/imm32
2636 68/push _test-input-stream/imm32
2637
2638 e8/call write/disp32
2639
2640 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2641
2642
2643 68/push "34\n"/imm32
2644 68/push _test-input-stream/imm32
2645
2646 e8/call write/disp32
2647
2648 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2649
2650 68/push 9/imm32/segment-size
2651 68/push 0/imm32/file-offset
2652 68/push 0x1074/imm32/start-address
2653 68/push "code"/imm32/segment-name
2654 51/push-ecx
2655
2656 e8/call stream-add4/disp32
2657
2658 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
2659
2660 68/push 1/imm32/segment-size
2661 68/push 5/imm32/file-offset
2662 68/push 0x2079/imm32/start-address
2663 68/push "data"/imm32/segment-name
2664 51/push-ecx
2665
2666 e8/call stream-add4/disp32
2667
2668 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
2669
2670 68/push 0x207a/imm32/label-address
2671 68/push 1/imm32/segment-offset
2672 68/push "data"/imm32/segment-name
2673 68/push "x"/imm32/label-name
2674 52/push-edx
2675
2676 e8/call stream-add4/disp32
2677
2678 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
2679
2680
2681
2682 52/push-edx
2683 51/push-ecx
2684 68/push _test-output-buffered-file/imm32
2685 68/push _test-input-stream/imm32
2686
2687 e8/call emit-segments/disp32
2688
2689 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
2690
2691
2692
2693 68/push _test-output-buffered-file/imm32
2694
2695 e8/call flush/disp32
2696
2697 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2698 +-- 33 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
2731
2732
2733 68/push "F - test-emit-segments-global-variable/0"/imm32
2734 68/push "ab cd ef gh "/imm32
2735 68/push _test-output-stream/imm32
2736
2737 e8/call check-next-stream-line-equal/disp32
2738
2739 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2740
2741
2742 68/push "F - test-emit-segments-global-variable/1"/imm32
2743 68/push "ij 7a 20 00 00 "/imm32
2744 68/push _test-output-stream/imm32
2745
2746 e8/call check-next-stream-line-equal/disp32
2747
2748 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2749
2750
2751 68/push "F - test-emit-segments-global-variable/2"/imm32
2752 68/push "00 "/imm32
2753 68/push _test-output-stream/imm32
2754
2755 e8/call check-next-stream-line-equal/disp32
2756
2757 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2758
2759
2760 68/push "F - test-emit-segments-global-variable/3"/imm32
2761 68/push "34 "/imm32
2762 68/push _test-output-stream/imm32
2763
2764 e8/call check-next-stream-line-equal/disp32
2765
2766 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2767
2768 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2769 5d/pop-to-ebp
2770 c3/return
2771
2772 test-emit-segments-code-label:
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793 55/push-ebp
2794 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2795
2796
2797
2798 68/push _test-input-stream/imm32
2799
2800 e8/call clear-stream/disp32
2801
2802 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2803
2804
2805 68/push _test-output-stream/imm32
2806
2807 e8/call clear-stream/disp32
2808
2809 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2810
2811
2812 68/push _test-output-buffered-file->buffer/imm32
2813
2814 e8/call clear-stream/disp32
2815
2816 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2817
2818 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32
2819 68/push 0xa0/imm32/length
2820 68/push 0/imm32/read
2821 68/push 0/imm32/write
2822 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
2823
2824 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32
2825 68/push 0x2000/imm32/length
2826 68/push 0/imm32/read
2827 68/push 0/imm32/write
2828 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
2829
2830
2831
2832 68/push "== code 0x1000\n"/imm32
2833 68/push _test-input-stream/imm32
2834
2835 e8/call write/disp32
2836
2837 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2838
2839
2840 68/push "ab cd\n"/imm32
2841 68/push _test-input-stream/imm32
2842
2843 e8/call write/disp32
2844
2845 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2846
2847
2848 68/push "l1:\n"/imm32
2849 68/push _test-input-stream/imm32
2850
2851 e8/call write/disp32
2852
2853 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2854
2855
2856 68/push " ef gh\n"/imm32
2857 68/push _test-input-stream/imm32
2858
2859 e8/call write/disp32
2860
2861 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2862
2863
2864 68/push " ij l1/disp32\n"/imm32
2865 68/push _test-input-stream/imm32
2866
2867 e8/call write/disp32
2868
2869 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2870
2871 68/push 9/imm32/segment-size
2872 68/push 0/imm32/file-offset
2873 68/push 0x1054/imm32/start-address
2874 68/push "code"/imm32/segment-name
2875 51/push-ecx
2876
2877 e8/call stream-add4/disp32
2878
2879 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
2880
2881 68/push 0x1056/imm32/label-address
2882 68/push 2/imm32/segment-offset
2883 68/push "code"/imm32/segment-name
2884 68/push "l1"/imm32/label-name
2885 52/push-edx
2886
2887 e8/call stream-add4/disp32
2888
2889 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
2890
2891
2892
2893 52/push-edx
2894 51/push-ecx
2895 68/push _test-output-buffered-file/imm32
2896 68/push _test-input-stream/imm32
2897
2898 e8/call emit-segments/disp32
2899
2900 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
2901
2902
2903
2904 68/push _test-output-buffered-file/imm32
2905
2906 e8/call flush/disp32
2907
2908 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2909 +-- 33 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
2942
2943
2944 68/push "F - test-emit-segments-code-label/0"/imm32
2945 68/push "ab cd "/imm32
2946 68/push _test-output-stream/imm32
2947
2948 e8/call check-next-stream-line-equal/disp32
2949
2950 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2951
2952
2953 68/push "F - test-emit-segments-code-label/1"/imm32
2954 68/push "ef gh "/imm32
2955 68/push _test-output-stream/imm32
2956
2957 e8/call check-next-stream-line-equal/disp32
2958
2959 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2960
2961
2962 68/push "F - test-emit-segments-code-label/2"/imm32
2963 68/push "ij f9 ff ff ff "/imm32
2964 68/push _test-output-stream/imm32
2965
2966 e8/call check-next-stream-line-equal/disp32
2967
2968 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2969
2970 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2971 5d/pop-to-ebp
2972 c3/return
2973
2974 test-emit-segments-code-label-absolute:
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995 55/push-ebp
2996 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2997
2998
2999
3000 68/push _test-input-stream/imm32
3001
3002 e8/call clear-stream/disp32
3003
3004 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3005
3006
3007 68/push _test-output-stream/imm32
3008
3009 e8/call clear-stream/disp32
3010
3011 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3012
3013
3014 68/push _test-output-buffered-file->buffer/imm32
3015
3016 e8/call clear-stream/disp32
3017
3018 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3019
3020 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32
3021 68/push 0xa0/imm32/length
3022 68/push 0/imm32/read
3023 68/push 0/imm32/write
3024 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
3025
3026 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32
3027 68/push 0x2000/imm32/length
3028 68/push 0/imm32/read
3029 68/push 0/imm32/write
3030 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
3031
3032
3033
3034 68/push "== code 0x1000\n"/imm32
3035 68/push _test-input-stream/imm32
3036
3037 e8/call write/disp32
3038
3039 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3040
3041
3042 68/push "ab cd\n"/imm32
3043 68/push _test-input-stream/imm32
3044
3045 e8/call write/disp32
3046
3047 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3048
3049
3050 68/push "l1:\n"/imm32
3051 68/push _test-input-stream/imm32
3052
3053 e8/call write/disp32
3054
3055 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3056
3057
3058 68/push " ef gh\n"/imm32
3059 68/push _test-input-stream/imm32
3060
3061 e8/call write/disp32
3062
3063 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3064
3065
3066 68/push " ij l1/imm32\n"/imm32
3067 68/push _test-input-stream/imm32
3068
3069 e8/call write/disp32
3070
3071 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3072
3073 68/push 9/imm32/segment-size
3074 68/push 0/imm32/file-offset
3075 68/push 0x1054/imm32/start-address
3076 68/push "code"/imm32/segment-name
3077 51/push-ecx
3078
3079 e8/call stream-add4/disp32
3080
3081 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
3082
3083 68/push 0x1056/imm32/label-address
3084 68/push 2/imm32/segment-offset
3085 68/push "code"/imm32/segment-name
3086 68/push "l1"/imm32/label-name
3087 52/push-edx
3088
3089 e8/call stream-add4/disp32
3090
3091 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
3092
3093
3094
3095 52/push-edx
3096 51/push-ecx
3097 68/push _test-output-buffered-file/imm32
3098 68/push _test-input-stream/imm32
3099
3100 e8/call emit-segments/disp32
3101
3102 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
3103
3104
3105
3106 68/push _test-output-buffered-file/imm32
3107
3108 e8/call flush/disp32
3109
3110 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3111 +-- 33 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
3144
3145
3146 68/push "F - test-emit-segments-code-label-absolute/0"/imm32
3147 68/push "ab cd "/imm32
3148 68/push _test-output-stream/imm32
3149
3150 e8/call check-next-stream-line-equal/disp32
3151
3152 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3153
3154
3155 68/push "F - test-emit-segments-code-label-absolute/1"/imm32
3156 68/push "ef gh "/imm32
3157 68/push _test-output-stream/imm32
3158
3159 e8/call check-next-stream-line-equal/disp32
3160
3161 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3162
3163
3164 68/push "F - test-emit-segments-code-label-absolute/2"/imm32
3165 68/push "ij 56 10 00 00 "/imm32
3166 68/push _test-output-stream/imm32
3167
3168 e8/call check-next-stream-line-equal/disp32
3169
3170 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3171
3172 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3173 5d/pop-to-ebp
3174 c3/return
3175
3176 emit-headers:
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187 55/push-ebp
3188 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3189
3190 50/push-eax
3191 51/push-ecx
3192 +-- 9 lines: #? # write(2/stderr, "emit-elf-header\n") --------------------------------------------------------------------------------------------------
3201
3202
3203 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3204 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3205 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3206
3207 e8/call emit-elf-header/disp32
3208
3209 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3210
3211 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 .
3212
3213 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3214
3215 8d/copy-address 1/mod/*+disp8 0/rm32/eax . . . 0/r32/eax 0xc/disp8 .
3216
3217 01/add 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . .
3218 $emit-headers:loop:
3219
3220 39/compare 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . .
3221 0f 83/jump-if-greater-or-equal-unsigned $emit-headers:end/disp32
3222 +-- 63 lines: #? # dump curr-segment->name ---------------------------------------------------------------------------------------------------------------
3285 +-- 9 lines: #? # write(2/stderr, "emit-segment-header\n") ----------------------------------------------------------------------------------------------
3294
3295
3296 50/push-eax
3297 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3298
3299 e8/call emit-elf-program-header-entry/disp32
3300
3301 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3302
3303 81 0/subop/add 3/mod/direct 0/rm32/eax . . . . . 0x10/imm32
3304 e9/jump $emit-headers:loop/disp32
3305 $emit-headers:end:
3306
3307 59/pop-to-ecx
3308 58/pop-to-eax
3309
3310 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3311 5d/pop-to-ebp
3312 c3/return
3313
3314 emit-elf-header:
3315
3316
3317
3318
3319
3320
3321
3322 55/push-ebp
3323 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3324
3325 50/push-eax
3326 51/push-ecx
3327 52/push-edx
3328
3329
3330 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0x10/disp8 .
3331
3332
3333 68/push "label table"/imm32
3334 68/push 0x10/imm32/row-size
3335 68/push "Entry"/imm32
3336 50/push-eax
3337
3338 e8/call get/disp32
3339
3340 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
3341
3342 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 0/r32/eax 8/disp8 .
3343
3344 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Elf_e_entry/disp32
3345
3346
3347 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 .
3348
3349 8b/copy 0/mod/indirect 0/rm32/eax . . . 0/r32/eax . .
3350
3351 b9/copy-to-ecx 0x10/imm32
3352 31/xor 3/mod/direct 2/rm32/edx . . . 2/r32/edx . .
3353 f7 7/subop/idiv 3/mod/direct 1/rm32/ecx . . . . . .
3354
3355 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Elf_e_phnum/disp32
3356
3357
3358 68/push Elf_header/imm32
3359 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3360
3361 e8/call emit-hex-array/disp32
3362
3363 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3364
3365
3366 68/push Newline/imm32
3367 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3368
3369 e8/call write-buffered/disp32
3370
3371 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3372 $emit-elf-header:end:
3373
3374 5a/pop-to-edx
3375 59/pop-to-ecx
3376 58/pop-to-eax
3377
3378 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3379 5d/pop-to-ebp
3380 c3/return
3381
3382 emit-elf-program-header-entry:
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397 55/push-ebp
3398 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3399
3400 50/push-eax
3401 56/push-esi
3402
3403 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
3404
3405
3406 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 8/disp8 .
3407
3408 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Elf_p_offset/disp32
3409
3410
3411 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 4/disp8 .
3412
3413 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Elf_p_vaddr/disp32
3414
3415 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Elf_p_paddr/disp32
3416
3417
3418 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 0xc/disp8 .
3419
3420 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Elf_p_filesz/disp32
3421
3422 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Elf_p_memsz/disp32
3423
3424
3425 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
3426
3427
3428 68/push "code"/imm32
3429 50/push-eax
3430
3431 e8/call string-equal?/disp32
3432
3433 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3434
3435 3d/compare-eax-and 0/imm32
3436 74/jump-if-equal $emit-elf-program-header-entry:data/disp8
3437
3438 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Elf_p_flags/disp32 5/imm32
3439 eb/jump $emit-elf-program-header-entry:really-emit/disp8
3440 $emit-elf-program-header-entry:data:
3441
3442 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Elf_p_flags/disp32 6/imm32
3443 $emit-elf-program-header-entry:really-emit:
3444
3445
3446 68/push Elf_program_header_entry/imm32
3447 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3448
3449 e8/call emit-hex-array/disp32
3450
3451 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3452
3453
3454 68/push Newline/imm32
3455 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3456
3457 e8/call write-buffered/disp32
3458
3459 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3460 $emit-elf-program-header-entry:end:
3461
3462 5e/pop-to-esi
3463 58/pop-to-eax
3464
3465 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3466 5d/pop-to-ebp
3467 c3/return
3468
3469
3470
3471 stream-add4:
3472
3473 55/push-ebp
3474 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3475
3476 50/push-eax
3477 51/push-ecx
3478 52/push-edx
3479 56/push-esi
3480
3481 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
3482
3483
3484 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
3485
3486 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 0/r32/eax 0xc/disp8 .
3487
3488
3489 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 8/disp8 .
3490
3491 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 2/index/edx . 2/r32/edx 0xc/disp8 .
3492
3493 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3494 73/jump-if-greater-or-equal-unsigned $stream-add4:abort/disp8
3495
3496 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0xc/disp8 .
3497 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3498
3499 05/add-to-eax 4/imm32
3500
3501 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3502 73/jump-if-greater-or-equal-unsigned $stream-add4:abort/disp8
3503
3504 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x10/disp8 .
3505 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3506
3507 05/add-to-eax 4/imm32
3508
3509 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3510 73/jump-if-greater-or-equal-unsigned $stream-add4:abort/disp8
3511
3512 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x14/disp8 .
3513 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3514
3515 05/add-to-eax 4/imm32
3516
3517 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3518 73/jump-if-greater-or-equal-unsigned $stream-add4:abort/disp8
3519
3520 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x18/disp8 .
3521 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3522
3523 81 0/subop/add 0/mod/indirect 6/rm32/esi . . . . . 0x10/imm32
3524 $stream-add4:end:
3525
3526 5e/pop-to-esi
3527 5a/pop-to-edx
3528 59/pop-to-ecx
3529 58/pop-to-eax
3530
3531 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3532 5d/pop-to-ebp
3533 c3/return
3534
3535 $stream-add4:abort:
3536
3537
3538 68/push "overflow in stream-add4\n"/imm32
3539 68/push 2/imm32/stderr
3540
3541 e8/call _write/disp32
3542
3543 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3544
3545 bb/copy-to-ebx 1/imm32
3546 b8/copy-to-eax 1/imm32/exit
3547 cd/syscall 0x80/imm8
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557 trace-sssns:
3558
3559 55/push-ebp
3560 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3561
3562
3563 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3564 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3565
3566 e8/call write/disp32
3567
3568 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3569
3570
3571 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3572 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3573
3574 e8/call write/disp32
3575
3576 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3577
3578
3579 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3580 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3581
3582 e8/call write/disp32
3583
3584 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3585
3586
3587 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
3588 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3589
3590 e8/call print-int32/disp32
3591
3592 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3593
3594
3595 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
3596
3597 e8/call trace/disp32
3598
3599 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3600 $trace-sssns:end:
3601
3602 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3603 5d/pop-to-ebp
3604 c3/return
3605
3606 test-trace-sssns:
3607
3608 55/push-ebp
3609 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3610
3611
3612 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
3613 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
3614
3615
3616 68/push " e"/imm32
3617 68/push 3/imm32
3618 68/push "c "/imm32
3619 68/push "b"/imm32
3620 68/push "A"/imm32
3621
3622 e8/call trace-sssns/disp32
3623
3624 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
3625 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
3651
3652
3653 68/push "F - test-trace-sssns"/imm32
3654 68/push "Abc 0x00000003 e"/imm32
3655
3656 e8/call check-trace-contains/disp32
3657
3658 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3659
3660 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3661 5d/pop-to-ebp
3662 c3/return
3663
3664 trace-snsns:
3665
3666 55/push-ebp
3667 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3668
3669
3670 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3671 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3672
3673 e8/call write/disp32
3674
3675 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3676
3677
3678 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3679 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3680
3681 e8/call print-int32/disp32
3682
3683 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3684
3685
3686 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3687 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3688
3689 e8/call write/disp32
3690
3691 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3692
3693
3694 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
3695 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3696
3697 e8/call print-int32/disp32
3698
3699 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3700
3701
3702 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
3703
3704 e8/call trace/disp32
3705
3706 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3707 $trace-snsns:end:
3708
3709 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3710 5d/pop-to-ebp
3711 c3/return
3712
3713 test-trace-snsns:
3714
3715 55/push-ebp
3716 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3717
3718
3719 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
3720 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
3721
3722
3723 68/push " e"/imm32
3724 68/push 3/imm32
3725 68/push " c "/imm32
3726 68/push 2/imm32
3727 68/push "A "/imm32
3728
3729 e8/call trace-snsns/disp32
3730
3731 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
3732 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
3758
3759
3760 68/push "F - test-trace-snsns"/imm32
3761 68/push "A 0x00000002 c 0x00000003 e"/imm32
3762
3763 e8/call check-trace-contains/disp32
3764
3765 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3766
3767 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3768 5d/pop-to-ebp
3769 c3/return
3770
3771 trace-slsls:
3772
3773 55/push-ebp
3774 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3775
3776
3777 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3778 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3779
3780 e8/call write/disp32
3781
3782 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3783
3784
3785 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3786 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3787
3788 e8/call write-slice/disp32
3789
3790 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3791
3792
3793 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3794 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3795
3796 e8/call write/disp32
3797
3798 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3799
3800
3801 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
3802 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3803
3804 e8/call write-slice/disp32
3805
3806 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3807
3808
3809 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
3810
3811 e8/call trace/disp32
3812
3813 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3814 $trace-slsls:end:
3815
3816 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3817 5d/pop-to-ebp
3818 c3/return
3819
3820 test-trace-slsls:
3821
3822 55/push-ebp
3823 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3824
3825
3826 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
3827 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
3828
3829 b8/copy-to-eax "b"/imm32
3830 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3831 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
3832 05/add-to-eax 4/imm32
3833
3834 51/push-ecx
3835 50/push-eax
3836 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
3837
3838 b8/copy-to-eax "d"/imm32
3839 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3840 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
3841 05/add-to-eax 4/imm32
3842
3843 51/push-ecx
3844 50/push-eax
3845 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
3846
3847
3848 68/push "e"/imm32
3849 52/push-edx
3850 68/push "c"/imm32
3851 53/push-ebx
3852 68/push "A"/imm32
3853
3854 e8/call trace-slsls/disp32
3855
3856 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
3857 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
3883
3884
3885 68/push "F - test-trace-slsls"/imm32
3886 68/push "Abcde"/imm32
3887
3888 e8/call check-trace-contains/disp32
3889
3890 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3891
3892 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3893 5d/pop-to-ebp
3894 c3/return
3895
3896 trace-slsns:
3897
3898 55/push-ebp
3899 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3900
3901
3902 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3903 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3904
3905 e8/call write/disp32
3906
3907 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3908
3909
3910 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3911 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3912
3913 e8/call write-slice/disp32
3914
3915 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3916
3917
3918 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3919 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3920
3921 e8/call write/disp32
3922
3923 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3924
3925
3926 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
3927 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3928
3929 e8/call print-int32/disp32
3930
3931 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3932
3933
3934 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
3935
3936 e8/call trace/disp32
3937
3938 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3939 $trace-slsns:end:
3940
3941 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3942 5d/pop-to-ebp
3943 c3/return
3944
3945 test-trace-slsns:
3946
3947 55/push-ebp
3948 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3949
3950
3951 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
3952 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
3953
3954 b8/copy-to-eax "b"/imm32
3955 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3956 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
3957 05/add-to-eax 4/imm32
3958
3959 51/push-ecx
3960 50/push-eax
3961 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
3962
3963
3964 68/push " e"/imm32
3965 68/push 3/imm32
3966 68/push "c "/imm32
3967 53/push-ebx
3968 68/push "A"/imm32
3969
3970 e8/call trace-slsns/disp32
3971
3972 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
3973 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
3999
4000
4001 68/push "F - test-trace-slsls"/imm32
4002 68/push "Abc 0x00000003 e"/imm32
4003
4004 e8/call check-trace-contains/disp32
4005
4006 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4007
4008 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4009 5d/pop-to-ebp
4010 c3/return
4011
4012 trace-slsss:
4013
4014 55/push-ebp
4015 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4016
4017
4018 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
4019 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
4020
4021 e8/call write/disp32
4022
4023 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4024
4025
4026 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
4027 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
4028
4029 e8/call write-slice/disp32
4030
4031 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4032
4033
4034 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
4035 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
4036
4037 e8/call write/disp32
4038
4039 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4040
4041
4042 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
4043 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
4044
4045 e8/call write/disp32
4046
4047 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4048
4049
4050 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
4051
4052 e8/call trace/disp32
4053
4054 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4055 $trace-slsss:end:
4056
4057 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4058 5d/pop-to-ebp
4059 c3/return
4060
4061 test-trace-slsss:
4062
4063 55/push-ebp
4064 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4065
4066
4067 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
4068 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
4069
4070 b8/copy-to-eax "b"/imm32
4071 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
4072 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
4073 05/add-to-eax 4/imm32
4074
4075 51/push-ecx
4076 50/push-eax
4077 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
4078
4079
4080 68/push "e"/imm32
4081 68/push "d"/imm32
4082 68/push "c"/imm32
4083 53/push-ebx
4084 68/push "A"/imm32
4085
4086 e8/call trace-slsss/disp32
4087
4088 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
4089 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
4115
4116
4117 68/push "F - test-trace-slsss"/imm32
4118 68/push "Abcde"/imm32
4119
4120 e8/call check-trace-contains/disp32
4121
4122 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4123
4124 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4125 5d/pop-to-ebp
4126 c3/return
4127
4128 num-bytes:
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145 55/push-ebp
4146 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4147
4148 51/push-ecx
4149 52/push-edx
4150 53/push-ebx
4151
4152 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
4153
4154 68/push 0/imm32/end
4155 68/push 0/imm32/start
4156 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
4157 +-- 26 lines: #? # dump line -----------------------------------------------------------------------------------------------------------------------------
4183
4184
4185 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
4186
4187 e8/call rewind-stream/disp32
4188
4189 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4190 $num-bytes:loop:
4191
4192
4193 51/push-ecx
4194 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
4195
4196 e8/call next-word/disp32
4197
4198 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4199 +-- 40 lines: #? # dump word-slice -----------------------------------------------------------------------------------------------------------------------
4239 $num-bytes:check0:
4240
4241
4242 50/push-eax
4243
4244
4245 51/push-ecx
4246
4247 e8/call slice-empty?/disp32
4248
4249 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4250
4251 3d/compare-eax-and 0/imm32
4252
4253 58/pop-to-eax
4254 75/jump-if-not-equal $num-bytes:end/disp8
4255 $num-bytes:check-for-comment:
4256
4257
4258 8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . .
4259
4260 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
4261 8a/copy-byte 0/mod/indirect 2/rm32/edx . . . 3/r32/BL . .
4262
4263 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x23/imm32/hash
4264 74/jump-if-equal $num-bytes:end/disp8
4265 $num-bytes:check-for-label:
4266
4267
4268 8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 4/disp8 .
4269
4270 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
4271 8a/copy-byte 1/mod/*+disp8 2/rm32/edx . . . 3/r32/BL -1/disp8 .
4272
4273 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x3a/imm32/colon
4274 74/jump-if-equal $num-bytes:end/disp8
4275 $num-bytes:check-for-segment-header:
4276
4277
4278 50/push-eax
4279
4280
4281 68/push "=="/imm32
4282 51/push-ecx
4283
4284 e8/call slice-equal?/disp32
4285
4286 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4287
4288 3d/compare-eax-and 0/imm32
4289
4290 58/pop-to-eax
4291 75/jump-if-not-equal $num-bytes:end/disp8
4292 $num-bytes:loop-body:
4293
4294
4295 89/copy 3/mod/direct 2/rm32/edx . . . 0/r32/eax . .
4296
4297
4298 51/push-ecx
4299
4300 e8/call compute-width-of-slice/disp32
4301
4302 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4303
4304 01/add 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
4305 e9/jump $num-bytes:loop/disp32
4306 $num-bytes:end:
4307
4308
4309 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
4310
4311 e8/call rewind-stream/disp32
4312
4313 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4314
4315 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4316
4317 5b/pop-to-ebx
4318 5a/pop-to-edx
4319 59/pop-to-ecx
4320
4321 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4322 5d/pop-to-ebp
4323 c3/return
4324
4325 test-num-bytes-handles-empty-string:
4326
4327
4328 55/push-ebp
4329 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4330
4331
4332
4333 68/push _test-input-stream/imm32
4334
4335 e8/call clear-stream/disp32
4336
4337 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4338
4339
4340 68/push _test-output-stream/imm32
4341
4342 e8/call clear-stream/disp32
4343
4344 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4345
4346
4347
4348 68/push _test-input-stream/imm32
4349
4350 e8/call num-bytes/disp32
4351
4352 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4353
4354
4355 68/push "F - test-num-bytes-handles-empty-string"/imm32
4356 68/push 0/imm32/true
4357 50/push-eax
4358
4359 e8/call check-ints-equal/disp32
4360
4361 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4362
4363 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4364 5d/pop-to-ebp
4365 c3/return
4366
4367 test-num-bytes-ignores-comments:
4368
4369
4370 55/push-ebp
4371 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4372
4373
4374
4375 68/push _test-input-stream/imm32
4376
4377 e8/call clear-stream/disp32
4378
4379 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4380
4381
4382 68/push _test-output-stream/imm32
4383
4384 e8/call clear-stream/disp32
4385
4386 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4387
4388
4389
4390 68/push "# abcd"/imm32
4391 68/push _test-input-stream/imm32
4392
4393 e8/call write/disp32
4394
4395 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4396
4397
4398 68/push _test-input-stream/imm32
4399
4400 e8/call num-bytes/disp32
4401
4402 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4403
4404
4405 68/push "F - test-num-bytes-ignores-comments"/imm32
4406 68/push 0/imm32/true
4407 50/push-eax
4408
4409 e8/call check-ints-equal/disp32
4410
4411 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4412
4413 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4414 5d/pop-to-ebp
4415 c3/return
4416
4417 test-num-bytes-ignores-labels:
4418
4419
4420 55/push-ebp
4421 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4422
4423
4424
4425 68/push _test-input-stream/imm32
4426
4427 e8/call clear-stream/disp32
4428
4429 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4430
4431
4432 68/push _test-output-stream/imm32
4433
4434 e8/call clear-stream/disp32
4435
4436 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4437
4438
4439
4440 68/push "ab: # cd"/imm32
4441 68/push _test-input-stream/imm32
4442
4443 e8/call write/disp32
4444
4445 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4446
4447
4448 68/push _test-input-stream/imm32
4449
4450 e8/call num-bytes/disp32
4451
4452 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4453
4454
4455 68/push "F - test-num-bytes-ignores-labels"/imm32
4456 68/push 0/imm32/true
4457 50/push-eax
4458
4459 e8/call check-ints-equal/disp32
4460
4461 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4462
4463 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4464 5d/pop-to-ebp
4465 c3/return
4466
4467 test-num-bytes-ignores-segment-headers:
4468
4469
4470 55/push-ebp
4471 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4472
4473
4474
4475 68/push _test-input-stream/imm32
4476
4477 e8/call clear-stream/disp32
4478
4479 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4480
4481
4482 68/push _test-output-stream/imm32
4483
4484 e8/call clear-stream/disp32
4485
4486 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4487
4488
4489
4490 68/push "== ab cd"/imm32
4491 68/push _test-input-stream/imm32
4492
4493 e8/call write/disp32
4494
4495 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4496
4497
4498 68/push _test-input-stream/imm32
4499
4500 e8/call num-bytes/disp32
4501
4502 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4503
4504
4505 68/push "F - test-num-bytes-ignores-segment-headers"/imm32
4506 68/push 0/imm32/true
4507 50/push-eax
4508
4509 e8/call check-ints-equal/disp32
4510
4511 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4512
4513 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4514 5d/pop-to-ebp
4515 c3/return
4516
4517 test-num-bytes-counts-words-by-default:
4518
4519
4520 55/push-ebp
4521 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4522
4523
4524
4525 68/push _test-input-stream/imm32
4526
4527 e8/call clear-stream/disp32
4528
4529 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4530
4531
4532 68/push _test-output-stream/imm32
4533
4534 e8/call clear-stream/disp32
4535
4536 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4537
4538
4539
4540 68/push "ab cd ef"/imm32
4541 68/push _test-input-stream/imm32
4542
4543 e8/call write/disp32
4544
4545 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4546
4547
4548 68/push _test-input-stream/imm32
4549
4550 e8/call num-bytes/disp32
4551
4552 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4553
4554
4555 68/push "F - test-num-bytes-counts-words-by-default"/imm32
4556 68/push 3/imm32/true
4557 50/push-eax
4558
4559 e8/call check-ints-equal/disp32
4560
4561 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4562
4563 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4564 5d/pop-to-ebp
4565 c3/return
4566
4567 test-num-bytes-ignores-trailing-comment:
4568
4569
4570 55/push-ebp
4571 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4572
4573
4574
4575 68/push _test-input-stream/imm32
4576
4577 e8/call clear-stream/disp32
4578
4579 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4580
4581
4582 68/push _test-output-stream/imm32
4583
4584 e8/call clear-stream/disp32
4585
4586 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4587
4588
4589
4590 68/push "ab cd # ef"/imm32
4591 68/push _test-input-stream/imm32
4592
4593 e8/call write/disp32
4594
4595 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4596
4597
4598 68/push _test-input-stream/imm32
4599
4600 e8/call num-bytes/disp32
4601
4602 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4603
4604
4605 68/push "F - test-num-bytes-ignores-trailing-comment"/imm32
4606 68/push 2/imm32/true
4607 50/push-eax
4608
4609 e8/call check-ints-equal/disp32
4610
4611 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4612
4613 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4614 5d/pop-to-ebp
4615 c3/return
4616
4617 test-num-bytes-handles-imm32:
4618
4619
4620 55/push-ebp
4621 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4622
4623
4624
4625 68/push _test-input-stream/imm32
4626
4627 e8/call clear-stream/disp32
4628
4629 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4630
4631
4632 68/push _test-output-stream/imm32
4633
4634 e8/call clear-stream/disp32
4635
4636 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4637
4638
4639
4640 68/push "ab cd/imm32 ef"/imm32
4641 68/push _test-input-stream/imm32
4642
4643 e8/call write/disp32
4644
4645 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4646
4647
4648 68/push _test-input-stream/imm32
4649
4650 e8/call num-bytes/disp32
4651
4652 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4653
4654
4655 68/push "F - test-num-bytes-handles-imm32"/imm32
4656 68/push 6/imm32/true
4657 50/push-eax
4658
4659 e8/call check-ints-equal/disp32
4660
4661 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4662
4663 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4664 5d/pop-to-ebp
4665 c3/return
4666
4667 == data
4668
4669
4670
4671
4672 Elf_header:
4673
4674 0x34/imm32
4675
4676 $e_ident:
4677 7f 45/E 4c/L 46/F
4678 01/32-bit 01/little-endian 01/file-version 00/no-os-extensions
4679 00 00 00 00 00 00 00 00
4680 $e_type:
4681 02 00
4682 $e_machine:
4683 03 00
4684 $e_version:
4685 1/imm32
4686 Elf_e_entry:
4687 0x09000000/imm32
4688 $e_phoff:
4689 0x34/imm32
4690 $e_shoff:
4691 0/imm32
4692 $e_flags:
4693 0/imm32
4694 $e_ehsize:
4695 0x34 00
4696 $e_phentsize:
4697 0x20 00
4698 Elf_e_phnum:
4699 00 00
4700 $e_shentsize:
4701 00 00
4702 $e_shnum:
4703 00 00
4704 $e_shstrndx:
4705 00 00
4706
4707
4708
4709
4710 Elf_program_header_entry:
4711
4712 0x20/imm32
4713
4714 $p_type:
4715 1/imm32/PT_LOAD
4716 Elf_p_offset:
4717 0/imm32
4718 Elf_p_vaddr:
4719 0/imm32
4720 Elf_p_paddr:
4721 0/imm32
4722 Elf_p_filesz:
4723 0/imm32
4724 Elf_p_memsz:
4725 0/imm32
4726 Elf_p_flags:
4727 6/imm32/rw-
4728 $p_align:
4729
4730
4731 0x1000/imm32
4732
4733