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 68/push 0x40000/imm32/256KB
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 $run-main/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 $run-main/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 $main:end/disp8
85 $run-main:
86
87
88
89 68/push Stdout/imm32
90 68/push Stdin/imm32
91
92 e8/call convert/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 $main:end:
106 b8/copy-to-eax 1/imm32/exit
107 cd/syscall 0x80/imm8
108
109
110
111
112
113
114
115
116 convert:
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 +-- 47 lines: #? # dump labels->write --------------------------------------------------------------------------------------------------------------------
207 +-- 9 lines: #? # write(2/stderr, "slurp in\n") ---------------------------------------------------------------------------------------------------------
216
217
218 56/push-esi
219 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
220
221 e8/call slurp/disp32
222
223 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
224 +-- 46 lines: #? # dump labels->write --------------------------------------------------------------------------------------------------------------------
270 +-- 33 lines: #? # dump in -------------------------------------------------------------------------------------------------------------------------------
303 +-- 9 lines: #? # write(2/stderr, "compute-offsets\n") --------------------------------------------------------------------------------------------------
312
313
314 52/push-edx
315 51/push-ecx
316 56/push-esi
317
318 e8/call compute-offsets/disp32
319
320 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
321 +-- 9 lines: #? # write(2/stderr, "compute-addresses\n") ------------------------------------------------------------------------------------------------
330
331
332 52/push-edx
333 51/push-ecx
334
335 e8/call compute-addresses/disp32
336
337 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
338
339
340 56/push-esi
341
342 e8/call rewind-stream/disp32
343
344 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
345 +-- 9 lines: #? # write(2/stderr, "emit-output\n") ------------------------------------------------------------------------------------------------------
354 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
380 +-- 46 lines: #? # dump labels->write --------------------------------------------------------------------------------------------------------------------
426
427
428 52/push-edx
429 51/push-ecx
430 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
431 56/push-esi
432
433 e8/call emit-output/disp32
434
435 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
436
437
438 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
439
440 e8/call flush/disp32
441
442 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
443 $convert:end:
444
445 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x30a0/imm32
446
447 5e/pop-to-esi
448 5a/pop-to-edx
449 59/pop-to-ecx
450
451 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
452 5d/pop-to-ebp
453 c3/return
454
455 test-convert-computes-addresses:
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471 55/push-ebp
472 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
473
474
475
476 68/push _test-input-stream/imm32
477
478 e8/call clear-stream/disp32
479
480 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
481
482
483 b8/copy-to-eax _test-input-buffered-file/imm32
484 05/add-to-eax 4/imm32
485 50/push-eax
486
487 e8/call clear-stream/disp32
488
489 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
490
491
492 68/push _test-output-stream/imm32
493
494 e8/call clear-stream/disp32
495
496 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
497
498
499 b8/copy-to-eax _test-output-buffered-file/imm32
500 05/add-to-eax 4/imm32
501 50/push-eax
502
503 e8/call clear-stream/disp32
504
505 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
506
507
508
509 68/push "== code 0x1\n"/imm32
510 68/push _test-input-stream/imm32
511
512 e8/call write/disp32
513
514 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
515
516
517 68/push "Entry:\n"/imm32
518 68/push _test-input-stream/imm32
519
520 e8/call write/disp32
521
522 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
523
524
525 68/push "ab x/imm32\n"/imm32
526 68/push _test-input-stream/imm32
527
528 e8/call write/disp32
529
530 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
531
532
533 68/push "== data 0x1000\n"/imm32
534 68/push _test-input-stream/imm32
535
536 e8/call write/disp32
537
538 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
539
540
541 68/push "x:\n"/imm32
542 68/push _test-input-stream/imm32
543
544 e8/call write/disp32
545
546 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
547
548
549 68/push "01\n"/imm32
550 68/push _test-input-stream/imm32
551
552 e8/call write/disp32
553
554 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
555
556
557 68/push _test-output-buffered-file/imm32
558 68/push _test-input-buffered-file/imm32
559
560 e8/call convert/disp32
561
562 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
563
564 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
590
591
592 68/push "F - test-convert-computes-addresses/0"/imm32
593 68/push "label 'x' is at address 0x00001079."/imm32
594
595 e8/call check-trace-contains/disp32
596
597 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
598
599
600 68/push "F - test-convert-computes-addresses/1"/imm32
601 68/push "segment 'code' starts at address 0x00000074."/imm32
602
603 e8/call check-trace-contains/disp32
604
605 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
606
607
608 68/push "F - test-convert-computes-addresses/2"/imm32
609 68/push "segment 'code' has size 0x00000005."/imm32
610
611 e8/call check-trace-contains/disp32
612
613 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
614
615
616 68/push "F - test-convert-computes-addresses/3"/imm32
617 68/push "segment 'data' starts at address 0x00001079."/imm32
618
619 e8/call check-trace-contains/disp32
620
621 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
622
623 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
624 5d/pop-to-ebp
625 c3/return
626
627
628 == data
629
630 compute-offsets:file-offset:
631 0/imm32
632 compute-offsets:segment-offset:
633 0/imm32
634 compute-offsets:word-slice:
635 0/imm32/start
636 0/imm32/end
637 compute-offsets:segment-tmp:
638 0/imm32/start
639 0/imm32/end
640
641 == code
642
643 compute-offsets:
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
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698 55/push-ebp
699 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
700
701 50/push-eax
702 51/push-ecx
703 52/push-edx
704 53/push-ebx
705 56/push-esi
706 57/push-edi
707
708 31/xor 3/mod/direct 6/rm32/esi . . . 6/r32/esi . .
709
710 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:file-offset/disp32 0/imm32
711
712 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:segment-offset/disp32 0/imm32
713
714
715
716 68/push 1/imm32
717 68/push 0x200/imm32
718 68/push Heap/imm32
719
720 e8/call new-stream/disp32
721
722 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
723
724 89/copy 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . .
725 $compute-offsets:line-loop:
726
727 51/push-ecx
728 e8/call clear-stream/disp32
729
730 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
731
732 51/push-ecx
733 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
734 e8/call read-line/disp32
735
736 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
737
738 8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . .
739 3d/compare-eax-and 0/imm32
740 0f 84/jump-if-equal $compute-offsets:break-line-loop/disp32
741 +-- 33 lines: #? # dump line -----------------------------------------------------------------------------------------------------------------------------
774 $compute-offsets:word-loop:
775
776 ba/copy-to-edx compute-offsets:word-slice/imm32
777
778 52/push-edx
779 51/push-ecx
780 e8/call next-word/disp32
781
782 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
783 +-- 80 lines: #? # dump word-slice and maybe curr-segment-name -------------------------------------------------------------------------------------------
863 $compute-offsets:case-empty:
864
865
866 52/push-edx
867 e8/call slice-empty?/disp32
868
869 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
870
871 3d/compare-eax-and 0/imm32
872 0f 85/jump-if-not-equal $compute-offsets:line-loop/disp32
873 $compute-offsets:case-comment:
874
875 68/push "#"/imm32
876 52/push-edx
877 e8/call slice-starts-with?/disp32
878
879 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
880
881 3d/compare-eax-and 0/imm32
882 0f 85/jump-if-not-equal $compute-offsets:line-loop/disp32
883 $compute-offsets:case-segment-header:
884
885
886 68/push "=="/imm32
887 52/push-edx
888 e8/call slice-equal?/disp32
889
890 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
891
892 3d/compare-eax-and 0/imm32
893 0f 84/jump-if-equal $compute-offsets:case-label/disp32
894
895 81 7/subop/compare 3/mod/direct 6/rm32/esi . . . . . 0/imm32
896 74/jump-if-equal $compute-offsets:construct-next-segment/disp8
897
898
899 68/push 0x10/imm32/row-size
900 56/push-esi
901 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
902
903 e8/call get-or-insert/disp32
904
905 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
906
907
908 51/push-ecx
909
910 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx compute-offsets:file-offset/disp32
911
912 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 1/r32/ecx 4/disp8 .
913
914 29/subtract 3/mod/direct 3/rm32/ebx . . . 1/r32/ecx . .
915
916 89/copy 1/mod/*+disp8 0/rm32/eax . . . 3/r32/ebx 8/disp8 .
917
918 59/pop-to-ecx
919
920
921 68/push "."/imm32
922 53/push-ebx
923 68/push "' has size "/imm32
924 56/push-esi
925 68/push "segment '"/imm32
926
927 e8/call trace-sssns/disp32
928
929 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
930 $compute-offsets:construct-next-segment:
931
932 68/push compute-offsets:segment-tmp/imm32
933 51/push-ecx
934 e8/call next-word/disp32
935
936 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
937 +-- 47 lines: #? # dump curr-segment-name if not null (clobbering eax) -----------------------------------------------------------------------------------
984 $compute-offsets:update-curr-segment-name:
985
986
987
988 68/push compute-offsets:segment-tmp/imm32
989 68/push Heap/imm32
990
991 e8/call slice-to-string/disp32
992
993 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
994
995 89/copy 3/mod/direct 6/rm32/esi . . . 0/r32/eax . .
996
997
998 3d/compare-eax-and 0/imm32
999 0f 84/jump-if-equal $compute-offsets:abort/disp32
1000
1001 68/push compute-offsets:segment-tmp/imm32
1002 51/push-ecx
1003 e8/call next-word/disp32
1004
1005 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1006
1007
1008 68/push compute-offsets:segment-tmp/imm32
1009 e8/call slice-empty?/disp32
1010
1011 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1012
1013 3d/compare-eax-and 0/imm32
1014 0f 85/jump-if-not-equal $compute-offsets:abort/disp32
1015
1016
1017 68/push 0x10/imm32/row-size
1018 56/push-esi
1019 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1020
1021 e8/call get-or-insert/disp32
1022
1023 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1024
1025 89/copy 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . .
1026
1027
1028 68/push compute-offsets:segment-tmp/imm32
1029 e8/call parse-hex-int/disp32
1030
1031 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1032
1033 89/copy 0/mod/indirect 3/rm32/ebx . . . 0/r32/eax . .
1034
1035 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax compute-offsets:file-offset/disp32
1036 89/copy 1/mod/*+disp8 3/rm32/ebx . . . 0/r32/eax 4/disp8 .
1037
1038
1039 68/push "."/imm32
1040 50/push-eax
1041 68/push "' is at file offset "/imm32
1042 56/push-esi
1043 68/push "segment '"/imm32
1044
1045 e8/call trace-sssns/disp32
1046
1047 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1048
1049 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:segment-offset/disp32 0/imm32
1050
1051 e9/jump $compute-offsets:line-loop/disp32
1052 $compute-offsets:case-label:
1053
1054
1055
1056 52/push-edx
1057
1058 e8/call is-label?/disp32
1059
1060 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1061
1062 3d/compare-eax-and 0/imm32
1063 74/jump-if-equal $compute-offsets:case-default/disp8
1064
1065 ff 1/subop/decrement 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
1066
1067
1068 68/push 0x10/imm32/row-size
1069 52/push-edx
1070 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
1071
1072 e8/call leaky-get-or-insert-slice/disp32
1073
1074 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1075 $compute-offsets:save-label-offset:
1076
1077 89/copy 0/mod/indirect 0/rm32/eax . . . 6/r32/esi . .
1078
1079
1080 68/push "'."/imm32
1081 56/push-esi
1082 68/push "' is in segment '"/imm32
1083 52/push-edx
1084 68/push "label '"/imm32
1085
1086 e8/call trace-slsss/disp32
1087
1088 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1089
1090
1091 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx compute-offsets:segment-offset/disp32
1092
1093 89/copy 1/mod/*+disp8 0/rm32/eax . . . 3/r32/ebx 4/disp8 .
1094
1095
1096 b8/copy-to-eax compute-offsets:segment-offset/imm32
1097
1098 8b/copy 0/mod/indirect 0/rm32/eax . . . 0/r32/eax . .
1099
1100 68/push "."/imm32
1101 50/push-eax
1102 68/push "' is at segment offset "/imm32
1103 52/push-edx
1104 68/push "label '"/imm32
1105
1106 e8/call trace-slsns/disp32
1107
1108 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1109
1110 e9/jump $compute-offsets:word-loop/disp32
1111 $compute-offsets:case-default:
1112
1113
1114 52/push-edx
1115
1116 e8/call compute-width-of-slice/disp32
1117
1118 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1119
1120 01/add 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax compute-offsets:segment-offset/disp32
1121
1122 01/add 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax compute-offsets:file-offset/disp32
1123 +-- 47 lines: #? # dump segment-offset -------------------------------------------------------------------------------------------------------------------
1170 e9/jump $compute-offsets:word-loop/disp32
1171 $compute-offsets:break-line-loop:
1172
1173
1174 68/push 0x10/imm32/row-size
1175 56/push-esi
1176 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1177
1178 e8/call get-or-insert/disp32
1179
1180 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1181
1182
1183 51/push-ecx
1184
1185 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx compute-offsets:file-offset/disp32
1186
1187 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 1/r32/ecx 4/disp8 .
1188
1189 29/subtract 3/mod/direct 3/rm32/ebx . . . 1/r32/ecx . .
1190
1191 89/copy 1/mod/*+disp8 0/rm32/eax . . . 3/r32/ebx 8/disp8 .
1192
1193 59/pop-to-ecx
1194
1195
1196
1197 68/push "."/imm32
1198 53/push-ebx
1199 68/push "' has size "/imm32
1200 56/push-esi
1201 68/push "segment '"/imm32
1202
1203 e8/call trace-sssns/disp32
1204
1205 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1206 $compute-offsets:end:
1207
1208
1209 5f/pop-to-edi
1210 5e/pop-to-esi
1211 5b/pop-to-ebx
1212 5a/pop-to-edx
1213 59/pop-to-ecx
1214 58/pop-to-eax
1215
1216 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1217 5d/pop-to-ebp
1218 c3/return
1219
1220 $compute-offsets:abort:
1221
1222
1223 68/push "'==' must be followed by segment name and segment-start\n"/imm32
1224 68/push 2/imm32/stderr
1225
1226 e8/call _write/disp32
1227
1228 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1229
1230 bb/copy-to-ebx 1/imm32
1231 b8/copy-to-eax 1/imm32/exit
1232 cd/syscall 0x80/imm8
1233
1234
1235 test-compute-offsets:
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253 55/push-ebp
1254 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1255
1256
1257
1258 68/push _test-input-stream/imm32
1259
1260 e8/call clear-stream/disp32
1261
1262 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1263
1264 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x20/imm32
1265 68/push 0x20/imm32/length
1266 68/push 0/imm32/read
1267 68/push 0/imm32/write
1268 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1269
1270 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x20/imm32
1271 68/push 0x20/imm32/length
1272 68/push 0/imm32/read
1273 68/push 0/imm32/write
1274 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1275
1276
1277
1278 68/push "== code 0x1\n"/imm32
1279 68/push _test-input-stream/imm32
1280
1281 e8/call write/disp32
1282
1283 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1284
1285
1286 68/push "ab x/imm32 # skip comment\n"/imm32
1287 68/push _test-input-stream/imm32
1288
1289 e8/call write/disp32
1290
1291 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1292
1293
1294 68/push "== data 0x1000\n"/imm32
1295 68/push _test-input-stream/imm32
1296
1297 e8/call write/disp32
1298
1299 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1300
1301
1302 68/push "00\n"/imm32
1303 68/push _test-input-stream/imm32
1304
1305 e8/call write/disp32
1306
1307 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1308
1309
1310 68/push "x:\n"/imm32
1311 68/push _test-input-stream/imm32
1312
1313 e8/call write/disp32
1314
1315 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1316
1317
1318 68/push "34\n"/imm32
1319 68/push _test-input-stream/imm32
1320
1321 e8/call write/disp32
1322
1323 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1324
1325
1326 52/push-edx
1327 51/push-ecx
1328 68/push _test-input-stream/imm32
1329
1330 e8/call compute-offsets/disp32
1331
1332 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1333 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
1359
1360
1361
1362 68/push "F - test-compute-offsets/0"/imm32
1363 68/push "segment 'code' is at file offset 0x00000000."/imm32
1364
1365 e8/call check-trace-contains/disp32
1366
1367 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1368
1369
1370 68/push "F - test-compute-offsets/1"/imm32
1371 68/push "segment 'code' has size 0x00000005."/imm32
1372
1373 e8/call check-trace-contains/disp32
1374
1375 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1376
1377
1378 68/push "F - test-compute-offsets/2"/imm32
1379 68/push "segment 'data' is at file offset 0x00000005."/imm32
1380
1381 e8/call check-trace-contains/disp32
1382
1383 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1384
1385
1386 68/push "F - test-compute-offsets/3"/imm32
1387 68/push "segment 'data' has size 0x00000002."/imm32
1388
1389 e8/call check-trace-contains/disp32
1390
1391 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1392
1393
1394 68/push "F - test-compute-offsets/4"/imm32
1395 68/push "label 'x' is in segment 'data'."/imm32
1396
1397 e8/call check-trace-contains/disp32
1398
1399 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1400
1401
1402 68/push "F - test-compute-offsets/5"/imm32
1403 68/push "label 'x' is at segment offset 0x00000001."/imm32
1404
1405 e8/call check-trace-contains/disp32
1406
1407 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1408
1409
1410 68/push "F - test-compute-offsets-maintains-labels-write-index"/imm32
1411 68/push 0x10/imm32/1-entry
1412 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
1413
1414 e8/call check-ints-equal/disp32
1415
1416 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1417
1418 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1419 5d/pop-to-ebp
1420 c3/return
1421
1422 compute-addresses:
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446 55/push-ebp
1447 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1448
1449 50/push-eax
1450 51/push-ecx
1451 52/push-edx
1452 53/push-ebx
1453 56/push-esi
1454 57/push-edi
1455
1456 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
1457
1458
1459 8b/copy 0/mod/indirect 6/rm32/esi . . . 7/r32/edi . .
1460 c1/shift 5/subop/logic-right 3/mod/direct 7/rm32/edi . . . . . 4/imm8
1461
1462 c1/shift 4/subop/left 3/mod/direct 7/rm32/edi . . . . . 5/imm8
1463 81 0/subop/add 3/mod/direct 7/rm32/edi . . . . . 0x34/imm32
1464
1465 8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 0xc/disp8 .
1466
1467 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . .
1468 01/add 3/mod/direct 1/rm32/ecx . . . 6/r32/esi . .
1469 $compute-addresses:segment-loop:
1470
1471 39/compare 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . .
1472 73/jump-if-greater-or-equal-unsigned $compute-addresses:segment-break/disp8
1473
1474 01/add 1/mod/*+disp8 0/rm32/eax . . . 7/r32/edi 8/disp8 .
1475
1476
1477 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 2/r32/edx 4/disp8 .
1478
1479 81 4/subop/and 3/mod/direct 2/rm32/edx . . . . . 0xfffff000/imm32
1480
1481
1482 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 3/r32/ebx 8/disp8 .
1483
1484 81 4/subop/and 3/mod/direct 3/rm32/ebx . . . . . 0x00000fff/imm32
1485
1486 09/or 3/mod/direct 2/rm32/edx . . . 3/r32/ebx . .
1487 89/copy 1/mod/*+disp8 0/rm32/eax . . . 2/r32/edx 4/disp8 .
1488
1489
1490 68/push "."/imm32
1491 52/push-edx
1492 68/push "' starts at address "/imm32
1493 ff 6/subop/push 0/mod/indirect 0/rm32/eax . . . . . .
1494 68/push "segment '"/imm32
1495
1496 e8/call trace-sssns/disp32
1497
1498 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1499
1500 05/add-to-eax 0x10/imm32
1501 eb/jump $compute-addresses:segment-loop/disp8
1502 $compute-addresses:segment-break:
1503 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
1529
1530 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
1531
1532 8d/copy-address 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 0xc/disp8 .
1533
1534 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . .
1535 01/add 3/mod/direct 1/rm32/ecx . . . 6/r32/esi . .
1536 $compute-addresses:label-loop:
1537
1538 39/compare 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . .
1539 0f 83/jump-if-greater-or-equal-unsigned $compute-addresses:end/disp32
1540 +-- 26 lines: #? # dump lrow->key ------------------------------------------------------------------------------------------------------------------------
1566
1567 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 2/r32/edx 4/disp8 .
1568 +-- 26 lines: #? # dump seg-name -------------------------------------------------------------------------------------------------------------------------
1594
1595
1596 50/push-eax
1597
1598
1599 68/push "segment table"/imm32
1600 68/push 0x10/imm32/row-size
1601 52/push-edx
1602 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
1603
1604 e8/call get/disp32
1605
1606 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
1607
1608 89/copy 3/mod/direct 2/rm32/edx . . . 0/r32/eax . .
1609
1610 58/pop-to-eax
1611
1612 8b/copy 0/mod/indirect 2/rm32/edx . . . 3/r32/ebx . .
1613
1614 03/add 1/mod/*+disp8 0/rm32/eax . . . 3/r32/ebx 8/disp8 .
1615
1616 89/copy 1/mod/*+disp8 0/rm32/eax . . . 3/r32/ebx 0xc/disp8 .
1617
1618
1619 68/push "."/imm32
1620 53/push-ebx
1621 68/push "' is at address "/imm32
1622 ff 6/subop/push 0/mod/indirect 0/rm32/eax . . . . . .
1623 68/push "label '"/imm32
1624
1625 e8/call trace-sssns/disp32
1626
1627 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1628
1629 05/add-to-eax 0x10/imm32
1630 e9/jump $compute-addresses:label-loop/disp32
1631 $compute-addresses:end:
1632
1633 5f/pop-to-edi
1634 5e/pop-to-esi
1635 5b/pop-to-ebx
1636 5a/pop-to-edx
1637 59/pop-to-ecx
1638 58/pop-to-eax
1639
1640 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1641 5d/pop-to-ebp
1642 c3/return
1643
1644 test-compute-addresses:
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662 55/push-ebp
1663 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1664
1665
1666 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32
1667 68/push 0xa0/imm32/length
1668 68/push 0/imm32/read
1669 68/push 0/imm32/write
1670 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1671
1672 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32
1673 68/push 0x2000/imm32/length
1674 68/push 0/imm32/read
1675 68/push 0/imm32/write
1676 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1677
1678 68/push 5/imm32/segment-size
1679 68/push 0/imm32/file-offset
1680 68/push 0x1000/imm32/start-address
1681 68/push "a"/imm32/segment-name
1682 51/push-ecx
1683
1684 e8/call stream-add4/disp32
1685
1686 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1687
1688 68/push 1/imm32/segment-size
1689 68/push 5/imm32/file-offset
1690 68/push 0x2018/imm32/start-address
1691 68/push "b"/imm32/segment-name
1692 51/push-ecx
1693
1694 e8/call stream-add4/disp32
1695
1696 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1697
1698 68/push 0xc/imm32/segment-size
1699 68/push 6/imm32/file-offset
1700 68/push 0x5444/imm32/start-address
1701 68/push "c"/imm32/segment-name
1702 51/push-ecx
1703
1704 e8/call stream-add4/disp32
1705
1706 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1707
1708 68/push 0/imm32/label-address
1709 68/push 3/imm32/segment-offset
1710 68/push "a"/imm32/segment-name
1711 68/push "l1"/imm32/label-name
1712 52/push-edx
1713
1714 e8/call stream-add4/disp32
1715
1716 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1717
1718 68/push 0/imm32/label-address
1719 68/push 0/imm32/segment-offset
1720 68/push "b"/imm32/segment-name
1721 68/push "l2"/imm32/label-name
1722 52/push-edx
1723
1724 e8/call stream-add4/disp32
1725
1726 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1727
1728
1729
1730 52/push-edx
1731 51/push-ecx
1732
1733 e8/call compute-addresses/disp32
1734
1735 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1736
1737 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
1763
1764
1765 68/push "F - test-compute-addresses/0"/imm32
1766 68/push "segment 'a' starts at address 0x00001094."/imm32
1767
1768 e8/call check-trace-contains/disp32
1769
1770 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1771
1772
1773 68/push "F - test-compute-addresses/1"/imm32
1774 68/push "segment 'b' starts at address 0x00002099."/imm32
1775
1776 e8/call check-trace-contains/disp32
1777
1778 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1779
1780
1781 68/push "F - test-compute-addresses/2"/imm32
1782 68/push "segment 'c' starts at address 0x0000509a."/imm32
1783
1784 e8/call check-trace-contains/disp32
1785
1786 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1787
1788
1789 68/push "F - test-compute-addresses/3"/imm32
1790 68/push "label 'l1' is at address 0x00001097."/imm32
1791
1792 e8/call check-trace-contains/disp32
1793
1794 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1795
1796
1797 68/push "F - test-compute-addresses/4"/imm32
1798 68/push "label 'l2' is at address 0x00002099."/imm32
1799
1800 e8/call check-trace-contains/disp32
1801
1802 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1803
1804
1805 68/push "F - test-compute-addresses/maintains-labels-write-index"/imm32
1806 68/push 0x20/imm32/2-entries
1807 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
1808
1809 e8/call check-ints-equal/disp32
1810
1811 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1812
1813 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1814 5d/pop-to-ebp
1815 c3/return
1816
1817 test-compute-addresses-large-segments:
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831 55/push-ebp
1832 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1833
1834
1835 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32
1836 68/push 0xa0/imm32/length
1837 68/push 0/imm32/read
1838 68/push 0/imm32/write
1839 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1840
1841 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32
1842 68/push 0x2000/imm32/length
1843 68/push 0/imm32/read
1844 68/push 0/imm32/write
1845 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1846
1847 68/push 0x5604/imm32/segment-size
1848 68/push 0/imm32/file-offset
1849 68/push 0x1000/imm32/start-address
1850 68/push "a"/imm32/segment-name
1851 51/push-ecx
1852
1853 e8/call stream-add4/disp32
1854
1855 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1856
1857 68/push 1/imm32/segment-size
1858 68/push 0x5604/imm32/file-offset
1859 68/push 0x2018/imm32/start-address
1860 68/push "b"/imm32/segment-name
1861 51/push-ecx
1862
1863 e8/call stream-add4/disp32
1864
1865 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1866
1867 68/push 0/imm32/label-address
1868 68/push 3/imm32/segment-offset
1869 68/push "a"/imm32/segment-name
1870 68/push "l1"/imm32/label-name
1871 52/push-edx
1872
1873 e8/call stream-add4/disp32
1874
1875 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
1876
1877
1878
1879 52/push-edx
1880 51/push-ecx
1881
1882 e8/call compute-addresses/disp32
1883
1884 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1885
1886
1887
1888 68/push "F - test-compute-addresses-large-segments/0"/imm32
1889 68/push "segment 'a' starts at address 0x00001074."/imm32
1890
1891 e8/call check-trace-contains/disp32
1892
1893 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1894
1895
1896 68/push "F - test-compute-addresses-large-segments/1"/imm32
1897 68/push "segment 'b' starts at address 0x00002678."/imm32
1898
1899 e8/call check-trace-contains/disp32
1900
1901 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1902
1903
1904 68/push "F - test-compute-addresses-large-segments/3"/imm32
1905 68/push "label 'l1' is at address 0x00001077."/imm32
1906
1907 e8/call check-trace-contains/disp32
1908
1909 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1910
1911 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1912 5d/pop-to-ebp
1913 c3/return
1914
1915 emit-output:
1916
1917
1918
1919
1920
1921 55/push-ebp
1922 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1923 +-- 9 lines: #? # write(2/stderr, "emit-headers\n") -----------------------------------------------------------------------------------------------------
1932
1933
1934 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
1935 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
1936 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1937
1938 e8/call emit-headers/disp32
1939
1940 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1941 +-- 9 lines: #? # write(2/stderr, "emit-segments\n") ----------------------------------------------------------------------------------------------------
1950
1951
1952 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
1953 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
1954 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1955 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
1956
1957 e8/call emit-segments/disp32
1958
1959 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
1960 $emit-output:end:
1961
1962 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1963 5d/pop-to-ebp
1964 c3/return
1965
1966 emit-segments:
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022 55/push-ebp
2023 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2024
2025 50/push-eax
2026 51/push-ecx
2027 52/push-edx
2028 53/push-ebx
2029 56/push-esi
2030 57/push-edi
2031
2032 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32
2033 68/push 0x200/imm32/length
2034 68/push 0/imm32/read
2035 68/push 0/imm32/write
2036 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
2037
2038 68/push 0/imm32/end
2039 68/push 0/imm32/start
2040 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
2041
2042 68/push 0/imm32/end
2043 68/push 0/imm32/start
2044 89/copy 3/mod/direct 7/rm32/edi . . . 4/r32/esp . .
2045
2046 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
2047 $emit-segments:line-loop:
2048
2049
2050 51/push-ecx
2051
2052 e8/call clear-stream/disp32
2053
2054 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2055
2056
2057 51/push-ecx
2058 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
2059
2060 e8/call read-line/disp32
2061
2062 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2063 +-- 33 lines: #? # dump line -----------------------------------------------------------------------------------------------------------------------------
2096 $emit-segments:check-for-end-of-input:
2097
2098 81 7/subop/compare 0/mod/indirect 1/rm32/ecx . . . . . 0/imm32
2099 0f 84/jump-if-equal $emit-segments:end/disp32
2100
2101
2102
2103 51/push-ecx
2104
2105 e8/call num-bytes/disp32
2106
2107 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2108
2109 01/add 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . .
2110 $emit-segments:word-loop:
2111
2112
2113 52/push-edx
2114 51/push-ecx
2115
2116 e8/call next-word/disp32
2117
2118 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2119 +-- 33 lines: #? # dump word-slice -----------------------------------------------------------------------------------------------------------------------
2152 $emit-segments:check-for-end-of-line:
2153
2154
2155
2156 52/push-edx
2157
2158 e8/call slice-empty?/disp32
2159
2160 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2161
2162 3d/compare-eax-and 0/imm32
2163 0f 85/jump-if-not-equal $emit-segments:next-line/disp32
2164 $emit-segments:check-for-comment:
2165
2166
2167 8b/copy 0/mod/indirect 2/rm32/edx . . . 6/r32/esi . .
2168
2169 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
2170 8a/copy-byte 0/mod/indirect 6/rm32/esi . . . 0/r32/AL . .
2171
2172 3d/compare-eax-and 0x23/imm32/hash
2173 0f 84/jump-if-equal $emit-segments:next-line/disp32
2174 $emit-segments:check-for-label:
2175
2176
2177
2178 52/push-edx
2179
2180 e8/call is-label?/disp32
2181
2182 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2183
2184 3d/compare-eax-and 0/imm32
2185 0f 85/jump-if-not-equal $emit-segments:line-loop/disp32
2186 $emit-segments:check-for-segment-header:
2187
2188
2189
2190 68/push "=="/imm32
2191 52/push-edx
2192
2193 e8/call slice-equal?/disp32
2194
2195 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2196
2197 3d/compare-eax-and 0/imm32
2198 0f 85/jump-if-not-equal $emit-segments:line-loop/disp32
2199 $emit-segments:2-character:
2200
2201
2202 8b/copy 1/mod/*+disp8 2/rm32/edx . . . 0/r32/eax 4/disp8 .
2203 2b/subtract 0/mod/indirect 2/rm32/edx . . . 0/r32/eax . .
2204
2205 3d/compare-eax-and 2/imm32
2206 75/jump-if-not-equal $emit-segments:check-metadata/disp8
2207
2208
2209 52/push-edx
2210 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2211
2212 e8/call write-slice-buffered/disp32
2213
2214 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2215
2216
2217 68/push " "/imm32
2218 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2219
2220 e8/call write-buffered/disp32
2221
2222 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2223
2224 e9/jump $emit-segments:word-loop/disp32
2225 $emit-segments:check-metadata:
2226
2227
2228
2229 57/push-edi
2230 68/push 0x2f/imm32/slash
2231 ff 6/subop/push 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
2232 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
2233
2234 e8/call next-token-from-slice/disp32
2235
2236 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
2237 +-- 33 lines: #? # dump word-slice -----------------------------------------------------------------------------------------------------------------------
2270
2271
2272
2273 68/push "label table"/imm32
2274 68/push 0x10/imm32/row-size
2275 57/push-edi
2276 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
2277
2278 e8/call get-slice/disp32
2279
2280 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
2281
2282 89/copy 3/mod/direct 6/rm32/esi . . . 0/r32/eax . .
2283 $emit-segments:check-global-variable:
2284 +-- 26 lines: #? # dump info->segment-name ---------------------------------------------------------------------------------------------------------------
2310
2311
2312
2313 68/push "code"/imm32
2314 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
2315
2316 e8/call string-equal?/disp32
2317
2318 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2319
2320 3d/compare-eax-and 0/imm32
2321 0f 85/jump-if-not-equal $emit-segments:check-code-label-for-imm8/disp32
2322 $emit-segments:check-global-variable-for-disp8:
2323
2324
2325
2326 68/push "disp8"/imm32
2327 52/push-edx
2328
2329 e8/call has-metadata?/disp32
2330
2331 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2332
2333 3d/compare-eax-and 0/imm32
2334 0f 85/jump-if-not-equal $emit-segments:global-variable-abort/disp32
2335 $emit-segments:check-global-variable-for-imm8:
2336
2337
2338
2339 68/push "imm8"/imm32
2340 52/push-edx
2341
2342 e8/call has-metadata?/disp32
2343
2344 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2345
2346 3d/compare-eax-and 0/imm32
2347 0f 85/jump-if-not-equal $emit-segments:global-variable-abort/disp32
2348 $emit-segments:emit-global-variable:
2349
2350
2351 68/push 4/imm32
2352 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 8/disp8 .
2353 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2354
2355 e8/call emit-hex/disp32
2356
2357 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2358
2359 e9/jump $emit-segments:word-loop/disp32
2360 $emit-segments:check-code-label-for-imm8:
2361
2362
2363
2364 68/push "imm8"/imm32
2365 52/push-edx
2366
2367 e8/call has-metadata?/disp32
2368
2369 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2370
2371 3d/compare-eax-and 0/imm32
2372 0f 85/jump-if-not-equal $emit-segments:imm8-abort/disp32
2373 $emit-segments:check-code-label-for-imm32:
2374
2375
2376
2377 68/push "imm32"/imm32
2378 52/push-edx
2379
2380 e8/call has-metadata?/disp32
2381
2382 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2383
2384 3d/compare-eax-and 0/imm32
2385 74/jump-if-equal $emit-segments:check-code-label-for-disp8/disp8
2386 +-- 33 lines: #? # dump info->address --------------------------------------------------------------------------------------------------------------------
2419 $emit-segments:emit-code-label-imm32:
2420
2421
2422 68/push 4/imm32
2423 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 8/disp8 .
2424 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2425
2426 e8/call emit-hex/disp32
2427
2428 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2429
2430 e9/jump $emit-segments:word-loop/disp32
2431 $emit-segments:check-code-label-for-disp8:
2432
2433
2434
2435 68/push "disp8"/imm32
2436 52/push-edx
2437
2438 e8/call has-metadata?/disp32
2439
2440 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2441
2442 3d/compare-eax-and 0/imm32
2443 74/jump-if-equal $emit-segments:check-code-label-for-disp32/disp8
2444 $emit-segments:emit-code-label-disp8:
2445
2446
2447 68/push 1/imm32
2448 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 4/disp8 .
2449 29/subtract 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
2450 50/push-eax
2451 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2452
2453 e8/call emit-hex/disp32
2454
2455 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2456
2457 e9/jump $emit-segments:word-loop/disp32
2458 $emit-segments:check-code-label-for-disp32:
2459
2460
2461
2462 68/push "disp32"/imm32
2463 52/push-edx
2464
2465 e8/call has-metadata?/disp32
2466
2467 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2468
2469 3d/compare-eax-and 0/imm32
2470 0f 84/jump-if-equal $emit-segments:abort/disp32
2471 $emit-segments:emit-code-label-disp32:
2472
2473
2474 68/push 4/imm32
2475 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 4/disp8 .
2476 29/subtract 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
2477 50/push-eax
2478 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2479
2480 e8/call emit-hex/disp32
2481
2482 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2483
2484 e9/jump $emit-segments:word-loop/disp32
2485 $emit-segments:next-line:
2486
2487
2488 68/push Newline/imm32
2489 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2490
2491 e8/call write-buffered/disp32
2492
2493 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2494
2495 e9/jump $emit-segments:line-loop/disp32
2496 $emit-segments:end:
2497
2498 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x21c/imm32
2499
2500 5f/pop-to-edi
2501 5e/pop-to-esi
2502 5b/pop-to-ebx
2503 5a/pop-to-edx
2504 59/pop-to-ecx
2505 58/pop-to-eax
2506
2507 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2508 5d/pop-to-ebp
2509 c3/return
2510
2511 $emit-segments:global-variable-abort:
2512
2513
2514 68/push "emit-segments: must refer to global variables with /disp32 or /imm32"/imm32
2515 68/push 2/imm32/stderr
2516
2517 e8/call _write/disp32
2518
2519 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2520
2521 bb/copy-to-ebx 1/imm32
2522 b8/copy-to-eax 1/imm32/exit
2523 cd/syscall 0x80/imm8
2524
2525
2526 $emit-segments:imm8-abort:
2527
2528
2529 68/push "emit-segments: cannot refer to code labels with /imm8"/imm32
2530 68/push 2/imm32/stderr
2531
2532 e8/call _write/disp32
2533
2534 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2535
2536 bb/copy-to-ebx 1/imm32
2537 b8/copy-to-eax 1/imm32/exit
2538 cd/syscall 0x80/imm8
2539
2540
2541 $emit-segments:abort:
2542
2543
2544
2545 68/push "emit-segments: missing metadata in "/imm32
2546 68/push 2/imm32/stderr
2547
2548 e8/call _write/disp32
2549
2550 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2551
2552
2553 52/push-edx
2554 68/push Stderr/imm32
2555
2556 e8/call write-slice-buffered/disp32
2557
2558 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2559
2560
2561 68/push Stderr/imm32
2562
2563 e8/call flush/disp32
2564
2565 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2566
2567 bb/copy-to-ebx 1/imm32
2568 b8/copy-to-eax 1/imm32/exit
2569 cd/syscall 0x80/imm8
2570
2571
2572 test-emit-segments-global-variable:
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597 55/push-ebp
2598 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2599
2600
2601
2602 68/push _test-input-stream/imm32
2603
2604 e8/call clear-stream/disp32
2605
2606 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2607
2608
2609 68/push _test-output-stream/imm32
2610
2611 e8/call clear-stream/disp32
2612
2613 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2614
2615
2616 b8/copy-to-eax _test-output-buffered-file/imm32
2617 05/add-to-eax 4/imm32
2618 50/push-eax
2619
2620 e8/call clear-stream/disp32
2621
2622 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2623
2624 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32
2625 68/push 0xa0/imm32/length
2626 68/push 0/imm32/read
2627 68/push 0/imm32/write
2628 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
2629
2630 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32
2631 68/push 0x2000/imm32/length
2632 68/push 0/imm32/read
2633 68/push 0/imm32/write
2634 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
2635
2636
2637
2638 68/push "== code 0x1000\n"/imm32
2639 68/push _test-input-stream/imm32
2640
2641 e8/call write/disp32
2642
2643 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2644
2645
2646 68/push "ab cd ef gh\n"/imm32
2647 68/push _test-input-stream/imm32
2648
2649 e8/call write/disp32
2650
2651 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2652
2653
2654 68/push "ij x/disp32\n"/imm32
2655 68/push _test-input-stream/imm32
2656
2657 e8/call write/disp32
2658
2659 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2660
2661
2662 68/push "== data 0x2000\n"/imm32
2663 68/push _test-input-stream/imm32
2664
2665 e8/call write/disp32
2666
2667 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2668
2669
2670 68/push "00\n"/imm32
2671 68/push _test-input-stream/imm32
2672
2673 e8/call write/disp32
2674
2675 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2676
2677
2678 68/push "x:\n"/imm32
2679 68/push _test-input-stream/imm32
2680
2681 e8/call write/disp32
2682
2683 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2684
2685
2686 68/push "34\n"/imm32
2687 68/push _test-input-stream/imm32
2688
2689 e8/call write/disp32
2690
2691 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2692
2693 68/push 9/imm32/segment-size
2694 68/push 0/imm32/file-offset
2695 68/push 0x1074/imm32/start-address
2696 68/push "code"/imm32/segment-name
2697 51/push-ecx
2698
2699 e8/call stream-add4/disp32
2700
2701 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
2702
2703 68/push 1/imm32/segment-size
2704 68/push 5/imm32/file-offset
2705 68/push 0x2079/imm32/start-address
2706 68/push "data"/imm32/segment-name
2707 51/push-ecx
2708
2709 e8/call stream-add4/disp32
2710
2711 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
2712
2713 68/push 0x207a/imm32/label-address
2714 68/push 1/imm32/segment-offset
2715 68/push "data"/imm32/segment-name
2716 68/push "x"/imm32/label-name
2717 52/push-edx
2718
2719 e8/call stream-add4/disp32
2720
2721 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
2722
2723
2724
2725 52/push-edx
2726 51/push-ecx
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 . . . . . 0x10/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-global-variable/0"/imm32
2777 68/push "ab cd ef gh "/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-global-variable/1"/imm32
2786 68/push "ij 7a 20 00 00 "/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-global-variable/2"/imm32
2795 68/push "00 "/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
2803 68/push "F - test-emit-segments-global-variable/3"/imm32
2804 68/push "34 "/imm32
2805 68/push _test-output-stream/imm32
2806
2807 e8/call check-next-stream-line-equal/disp32
2808
2809 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2810
2811 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2812 5d/pop-to-ebp
2813 c3/return
2814
2815 test-emit-segments-code-label:
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836 55/push-ebp
2837 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2838
2839
2840
2841 68/push _test-input-stream/imm32
2842
2843 e8/call clear-stream/disp32
2844
2845 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2846
2847
2848 68/push _test-output-stream/imm32
2849
2850 e8/call clear-stream/disp32
2851
2852 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2853
2854
2855 b8/copy-to-eax _test-output-buffered-file/imm32
2856 05/add-to-eax 4/imm32
2857 50/push-eax
2858
2859 e8/call clear-stream/disp32
2860
2861 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2862
2863 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32
2864 68/push 0xa0/imm32/length
2865 68/push 0/imm32/read
2866 68/push 0/imm32/write
2867 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
2868
2869 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32
2870 68/push 0x2000/imm32/length
2871 68/push 0/imm32/read
2872 68/push 0/imm32/write
2873 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
2874
2875
2876
2877 68/push "== code 0x1000\n"/imm32
2878 68/push _test-input-stream/imm32
2879
2880 e8/call write/disp32
2881
2882 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2883
2884
2885 68/push "ab cd\n"/imm32
2886 68/push _test-input-stream/imm32
2887
2888 e8/call write/disp32
2889
2890 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2891
2892
2893 68/push "l1:\n"/imm32
2894 68/push _test-input-stream/imm32
2895
2896 e8/call write/disp32
2897
2898 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2899
2900
2901 68/push " ef gh\n"/imm32
2902 68/push _test-input-stream/imm32
2903
2904 e8/call write/disp32
2905
2906 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2907
2908
2909 68/push " ij l1/disp32\n"/imm32
2910 68/push _test-input-stream/imm32
2911
2912 e8/call write/disp32
2913
2914 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2915
2916 68/push 9/imm32/segment-size
2917 68/push 0/imm32/file-offset
2918 68/push 0x1054/imm32/start-address
2919 68/push "code"/imm32/segment-name
2920 51/push-ecx
2921
2922 e8/call stream-add4/disp32
2923
2924 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
2925
2926 68/push 0x1056/imm32/label-address
2927 68/push 2/imm32/segment-offset
2928 68/push "code"/imm32/segment-name
2929 68/push "l1"/imm32/label-name
2930 52/push-edx
2931
2932 e8/call stream-add4/disp32
2933
2934 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
2935
2936
2937
2938 52/push-edx
2939 51/push-ecx
2940 68/push _test-output-buffered-file/imm32
2941 68/push _test-input-stream/imm32
2942
2943 e8/call emit-segments/disp32
2944
2945 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
2946
2947
2948
2949 68/push _test-output-buffered-file/imm32
2950
2951 e8/call flush/disp32
2952
2953 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2954 +-- 33 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
2987
2988
2989 68/push "F - test-emit-segments-code-label/0"/imm32
2990 68/push "ab cd "/imm32
2991 68/push _test-output-stream/imm32
2992
2993 e8/call check-next-stream-line-equal/disp32
2994
2995 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2996
2997
2998 68/push "F - test-emit-segments-code-label/1"/imm32
2999 68/push "ef gh "/imm32
3000 68/push _test-output-stream/imm32
3001
3002 e8/call check-next-stream-line-equal/disp32
3003
3004 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3005
3006
3007 68/push "F - test-emit-segments-code-label/2"/imm32
3008 68/push "ij f9 ff ff ff "/imm32
3009 68/push _test-output-stream/imm32
3010
3011 e8/call check-next-stream-line-equal/disp32
3012
3013 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3014
3015 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3016 5d/pop-to-ebp
3017 c3/return
3018
3019 test-emit-segments-code-label-absolute:
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040 55/push-ebp
3041 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3042
3043
3044
3045 68/push _test-input-stream/imm32
3046
3047 e8/call clear-stream/disp32
3048
3049 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3050
3051
3052 68/push _test-output-stream/imm32
3053
3054 e8/call clear-stream/disp32
3055
3056 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3057
3058
3059 b8/copy-to-eax _test-output-buffered-file/imm32
3060 05/add-to-eax 4/imm32
3061 50/push-eax
3062
3063 e8/call clear-stream/disp32
3064
3065 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3066
3067 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32
3068 68/push 0xa0/imm32/length
3069 68/push 0/imm32/read
3070 68/push 0/imm32/write
3071 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
3072
3073 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32
3074 68/push 0x2000/imm32/length
3075 68/push 0/imm32/read
3076 68/push 0/imm32/write
3077 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
3078
3079
3080
3081 68/push "== code 0x1000\n"/imm32
3082 68/push _test-input-stream/imm32
3083
3084 e8/call write/disp32
3085
3086 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3087
3088
3089 68/push "ab cd\n"/imm32
3090 68/push _test-input-stream/imm32
3091
3092 e8/call write/disp32
3093
3094 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3095
3096
3097 68/push "l1:\n"/imm32
3098 68/push _test-input-stream/imm32
3099
3100 e8/call write/disp32
3101
3102 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3103
3104
3105 68/push " ef gh\n"/imm32
3106 68/push _test-input-stream/imm32
3107
3108 e8/call write/disp32
3109
3110 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3111
3112
3113 68/push " ij l1/imm32\n"/imm32
3114 68/push _test-input-stream/imm32
3115
3116 e8/call write/disp32
3117
3118 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3119
3120 68/push 9/imm32/segment-size
3121 68/push 0/imm32/file-offset
3122 68/push 0x1054/imm32/start-address
3123 68/push "code"/imm32/segment-name
3124 51/push-ecx
3125
3126 e8/call stream-add4/disp32
3127
3128 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
3129
3130 68/push 0x1056/imm32/label-address
3131 68/push 2/imm32/segment-offset
3132 68/push "code"/imm32/segment-name
3133 68/push "l1"/imm32/label-name
3134 52/push-edx
3135
3136 e8/call stream-add4/disp32
3137
3138 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
3139
3140
3141
3142 52/push-edx
3143 51/push-ecx
3144 68/push _test-output-buffered-file/imm32
3145 68/push _test-input-stream/imm32
3146
3147 e8/call emit-segments/disp32
3148
3149 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
3150
3151
3152
3153 68/push _test-output-buffered-file/imm32
3154
3155 e8/call flush/disp32
3156
3157 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3158 +-- 33 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
3191
3192
3193 68/push "F - test-emit-segments-code-label-absolute/0"/imm32
3194 68/push "ab cd "/imm32
3195 68/push _test-output-stream/imm32
3196
3197 e8/call check-next-stream-line-equal/disp32
3198
3199 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3200
3201
3202 68/push "F - test-emit-segments-code-label-absolute/1"/imm32
3203 68/push "ef gh "/imm32
3204 68/push _test-output-stream/imm32
3205
3206 e8/call check-next-stream-line-equal/disp32
3207
3208 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3209
3210
3211 68/push "F - test-emit-segments-code-label-absolute/2"/imm32
3212 68/push "ij 56 10 00 00 "/imm32
3213 68/push _test-output-stream/imm32
3214
3215 e8/call check-next-stream-line-equal/disp32
3216
3217 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3218
3219 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3220 5d/pop-to-ebp
3221 c3/return
3222
3223 emit-headers:
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234 55/push-ebp
3235 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3236
3237 50/push-eax
3238 51/push-ecx
3239 +-- 9 lines: #? # write(2/stderr, "emit-elf-header\n") --------------------------------------------------------------------------------------------------
3248
3249
3250 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3251 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3252 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3253
3254 e8/call emit-elf-header/disp32
3255
3256 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3257
3258 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 .
3259
3260 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3261
3262 8d/copy-address 1/mod/*+disp8 0/rm32/eax . . . 0/r32/eax 0xc/disp8 .
3263
3264 01/add 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . .
3265 $emit-headers:loop:
3266
3267 39/compare 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . .
3268 0f 83/jump-if-greater-or-equal-unsigned $emit-headers:end/disp32
3269 +-- 69 lines: #? # dump curr-segment->name ---------------------------------------------------------------------------------------------------------------
3338 +-- 9 lines: #? # write(2/stderr, "emit-segment-header\n") ----------------------------------------------------------------------------------------------
3347
3348
3349 50/push-eax
3350 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3351
3352 e8/call emit-elf-program-header-entry/disp32
3353
3354 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3355
3356 81 0/subop/add 3/mod/direct 0/rm32/eax . . . . . 0x10/imm32
3357 e9/jump $emit-headers:loop/disp32
3358 $emit-headers:end:
3359
3360 59/pop-to-ecx
3361 58/pop-to-eax
3362
3363 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3364 5d/pop-to-ebp
3365 c3/return
3366
3367 emit-elf-header:
3368
3369
3370
3371
3372
3373
3374
3375 55/push-ebp
3376 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3377
3378 50/push-eax
3379 51/push-ecx
3380 52/push-edx
3381
3382
3383 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0x10/disp8 .
3384
3385
3386 68/push "label table"/imm32
3387 68/push 0x10/imm32/row-size
3388 68/push "Entry"/imm32
3389 50/push-eax
3390
3391 e8/call get/disp32
3392
3393 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
3394
3395 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 0/r32/eax 8/disp8 .
3396
3397 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Elf_e_entry/disp32
3398
3399
3400 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 .
3401
3402 8b/copy 0/mod/indirect 0/rm32/eax . . . 0/r32/eax . .
3403
3404 b9/copy-to-ecx 0x10/imm32
3405 31/xor 3/mod/direct 2/rm32/edx . . . 2/r32/edx . .
3406 f7 7/subop/idiv 3/mod/direct 1/rm32/ecx . . . . . .
3407
3408 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Elf_e_phnum/disp32
3409
3410
3411 68/push Elf_header/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 "\n"/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-header:end:
3426
3427 5a/pop-to-edx
3428 59/pop-to-ecx
3429 58/pop-to-eax
3430
3431 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3432 5d/pop-to-ebp
3433 c3/return
3434
3435 emit-elf-program-header-entry:
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450 55/push-ebp
3451 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3452
3453 50/push-eax
3454 56/push-esi
3455
3456 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
3457
3458
3459 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 8/disp8 .
3460
3461 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Elf_p_offset/disp32
3462
3463
3464 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 4/disp8 .
3465
3466 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Elf_p_vaddr/disp32
3467
3468 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Elf_p_paddr/disp32
3469
3470
3471 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 0xc/disp8 .
3472
3473 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Elf_p_filesz/disp32
3474
3475 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Elf_p_memsz/disp32
3476
3477
3478 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
3479
3480
3481 68/push "code"/imm32
3482 50/push-eax
3483
3484 e8/call string-equal?/disp32
3485
3486 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3487
3488 3d/compare-eax-and 0/imm32
3489 74/jump-if-equal $emit-elf-program-header-entry:data/disp8
3490
3491 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Elf_p_flags/disp32 5/imm32
3492 eb/jump $emit-elf-program-header-entry:really-emit/disp8
3493 $emit-elf-program-header-entry:data:
3494
3495 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Elf_p_flags/disp32 6/imm32
3496 $emit-elf-program-header-entry:really-emit:
3497
3498
3499 68/push Elf_program_header_entry/imm32
3500 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3501
3502 e8/call emit-hex-array/disp32
3503
3504 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3505
3506
3507 68/push "\n"/imm32
3508 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3509
3510 e8/call write-buffered/disp32
3511
3512 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3513 $emit-elf-program-header-entry:end:
3514
3515 5e/pop-to-esi
3516 58/pop-to-eax
3517
3518 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3519 5d/pop-to-ebp
3520 c3/return
3521
3522
3523
3524 stream-add4:
3525
3526 55/push-ebp
3527 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3528
3529 50/push-eax
3530 51/push-ecx
3531 52/push-edx
3532 56/push-esi
3533
3534 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
3535
3536
3537 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
3538
3539 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 0/r32/eax 0xc/disp8 .
3540
3541
3542 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 8/disp8 .
3543
3544 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 2/index/edx . 2/r32/edx 0xc/disp8 .
3545
3546 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3547 73/jump-if-greater-or-equal-unsigned $stream-add4:abort/disp8
3548
3549 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0xc/disp8 .
3550 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3551
3552 05/add-to-eax 4/imm32
3553
3554 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3555 73/jump-if-greater-or-equal-unsigned $stream-add4:abort/disp8
3556
3557 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x10/disp8 .
3558 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3559
3560 05/add-to-eax 4/imm32
3561
3562 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3563 73/jump-if-greater-or-equal-unsigned $stream-add4:abort/disp8
3564
3565 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x14/disp8 .
3566 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3567
3568 05/add-to-eax 4/imm32
3569
3570 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3571 73/jump-if-greater-or-equal-unsigned $stream-add4:abort/disp8
3572
3573 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x18/disp8 .
3574 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3575
3576 81 0/subop/add 0/mod/indirect 6/rm32/esi . . . . . 0x10/imm32
3577 $stream-add4:end:
3578
3579 5e/pop-to-esi
3580 5a/pop-to-edx
3581 59/pop-to-ecx
3582 58/pop-to-eax
3583
3584 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3585 5d/pop-to-ebp
3586 c3/return
3587
3588 $stream-add4:abort:
3589
3590
3591 68/push "overflow in stream-add4\n"/imm32
3592 68/push 2/imm32/stderr
3593
3594 e8/call _write/disp32
3595
3596 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3597
3598 bb/copy-to-ebx 1/imm32
3599 b8/copy-to-eax 1/imm32/exit
3600 cd/syscall 0x80/imm8
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610 trace-sssns:
3611
3612 55/push-ebp
3613 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3614
3615
3616 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3617 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3618
3619 e8/call write/disp32
3620
3621 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3622
3623
3624 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3625 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3626
3627 e8/call write/disp32
3628
3629 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3630
3631
3632 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3633 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3634
3635 e8/call write/disp32
3636
3637 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3638
3639
3640 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
3641 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3642
3643 e8/call print-int32/disp32
3644
3645 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3646
3647
3648 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
3649
3650 e8/call trace/disp32
3651
3652 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3653 $trace-sssns:end:
3654
3655 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3656 5d/pop-to-ebp
3657 c3/return
3658
3659 test-trace-sssns:
3660
3661 55/push-ebp
3662 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3663
3664
3665 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
3666 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
3667
3668
3669 68/push " e"/imm32
3670 68/push 3/imm32
3671 68/push "c "/imm32
3672 68/push "b"/imm32
3673 68/push "A"/imm32
3674
3675 e8/call trace-sssns/disp32
3676
3677 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
3678 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
3704
3705
3706 68/push "F - test-trace-sssns"/imm32
3707 68/push "Abc 0x00000003 e"/imm32
3708
3709 e8/call check-trace-contains/disp32
3710
3711 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3712
3713 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3714 5d/pop-to-ebp
3715 c3/return
3716
3717 trace-snsns:
3718
3719 55/push-ebp
3720 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3721
3722
3723 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3724 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3725
3726 e8/call write/disp32
3727
3728 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3729
3730
3731 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3732 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3733
3734 e8/call print-int32/disp32
3735
3736 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3737
3738
3739 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3740 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3741
3742 e8/call write/disp32
3743
3744 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3745
3746
3747 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
3748 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3749
3750 e8/call print-int32/disp32
3751
3752 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3753
3754
3755 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
3756
3757 e8/call trace/disp32
3758
3759 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3760 $trace-snsns:end:
3761
3762 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3763 5d/pop-to-ebp
3764 c3/return
3765
3766 test-trace-snsns:
3767
3768 55/push-ebp
3769 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3770
3771
3772 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
3773 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
3774
3775
3776 68/push " e"/imm32
3777 68/push 3/imm32
3778 68/push " c "/imm32
3779 68/push 2/imm32
3780 68/push "A "/imm32
3781
3782 e8/call trace-snsns/disp32
3783
3784 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
3785 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
3811
3812
3813 68/push "F - test-trace-snsns"/imm32
3814 68/push "A 0x00000002 c 0x00000003 e"/imm32
3815
3816 e8/call check-trace-contains/disp32
3817
3818 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3819
3820 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3821 5d/pop-to-ebp
3822 c3/return
3823
3824 trace-slsls:
3825
3826 55/push-ebp
3827 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3828
3829
3830 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3831 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3832
3833 e8/call write/disp32
3834
3835 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3836
3837
3838 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3839 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3840
3841 e8/call write-slice/disp32
3842
3843 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3844
3845
3846 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3847 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3848
3849 e8/call write/disp32
3850
3851 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3852
3853
3854 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
3855 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3856
3857 e8/call write-slice/disp32
3858
3859 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3860
3861
3862 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
3863
3864 e8/call trace/disp32
3865
3866 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3867 $trace-slsls:end:
3868
3869 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3870 5d/pop-to-ebp
3871 c3/return
3872
3873 test-trace-slsls:
3874
3875 55/push-ebp
3876 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3877
3878
3879 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
3880 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
3881
3882 b8/copy-to-eax "b"/imm32
3883 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3884 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
3885 05/add-to-eax 4/imm32
3886
3887 51/push-ecx
3888 50/push-eax
3889 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
3890
3891 b8/copy-to-eax "d"/imm32
3892 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
3893 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
3894 05/add-to-eax 4/imm32
3895
3896 51/push-ecx
3897 50/push-eax
3898 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
3899
3900
3901 68/push "e"/imm32
3902 52/push-edx
3903 68/push "c"/imm32
3904 53/push-ebx
3905 68/push "A"/imm32
3906
3907 e8/call trace-slsls/disp32
3908
3909 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
3910 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
3936
3937
3938 68/push "F - test-trace-slsls"/imm32
3939 68/push "Abcde"/imm32
3940
3941 e8/call check-trace-contains/disp32
3942
3943 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3944
3945 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3946 5d/pop-to-ebp
3947 c3/return
3948
3949 trace-slsns:
3950
3951 55/push-ebp
3952 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3953
3954
3955 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3956 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3957
3958 e8/call write/disp32
3959
3960 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3961
3962
3963 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
3964 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3965
3966 e8/call write-slice/disp32
3967
3968 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3969
3970
3971 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
3972 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3973
3974 e8/call write/disp32
3975
3976 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3977
3978
3979 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
3980 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3981
3982 e8/call print-int32/disp32
3983
3984 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3985
3986
3987 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
3988
3989 e8/call trace/disp32
3990
3991 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3992 $trace-slsns:end:
3993
3994 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3995 5d/pop-to-ebp
3996 c3/return
3997
3998 test-trace-slsns:
3999
4000 55/push-ebp
4001 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4002
4003
4004 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
4005 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
4006
4007 b8/copy-to-eax "b"/imm32
4008 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
4009 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
4010 05/add-to-eax 4/imm32
4011
4012 51/push-ecx
4013 50/push-eax
4014 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
4015
4016
4017 68/push " e"/imm32
4018 68/push 3/imm32
4019 68/push "c "/imm32
4020 53/push-ebx
4021 68/push "A"/imm32
4022
4023 e8/call trace-slsns/disp32
4024
4025 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
4026 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
4052
4053
4054 68/push "F - test-trace-slsls"/imm32
4055 68/push "Abc 0x00000003 e"/imm32
4056
4057 e8/call check-trace-contains/disp32
4058
4059 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4060
4061 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4062 5d/pop-to-ebp
4063 c3/return
4064
4065 trace-slsss:
4066
4067 55/push-ebp
4068 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4069
4070
4071 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
4072 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
4073
4074 e8/call write/disp32
4075
4076 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4077
4078
4079 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
4080 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
4081
4082 e8/call write-slice/disp32
4083
4084 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4085
4086
4087 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
4088 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
4089
4090 e8/call write/disp32
4091
4092 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4093
4094
4095 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
4096 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
4097
4098 e8/call write/disp32
4099
4100 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4101
4102
4103 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
4104
4105 e8/call trace/disp32
4106
4107 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4108 $trace-slsss:end:
4109
4110 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4111 5d/pop-to-ebp
4112 c3/return
4113
4114 test-trace-slsss:
4115
4116 55/push-ebp
4117 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4118
4119
4120 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
4121 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
4122
4123 b8/copy-to-eax "b"/imm32
4124 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
4125 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
4126 05/add-to-eax 4/imm32
4127
4128 51/push-ecx
4129 50/push-eax
4130 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
4131
4132
4133 68/push "e"/imm32
4134 68/push "d"/imm32
4135 68/push "c"/imm32
4136 53/push-ebx
4137 68/push "A"/imm32
4138
4139 e8/call trace-slsss/disp32
4140
4141 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
4142 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
4168
4169
4170 68/push "F - test-trace-slsss"/imm32
4171 68/push "Abcde"/imm32
4172
4173 e8/call check-trace-contains/disp32
4174
4175 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4176
4177 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4178 5d/pop-to-ebp
4179 c3/return
4180
4181 num-bytes:
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198 55/push-ebp
4199 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4200
4201 51/push-ecx
4202 52/push-edx
4203 53/push-ebx
4204
4205 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
4206
4207 68/push 0/imm32/end
4208 68/push 0/imm32/start
4209 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
4210 +-- 26 lines: #? # dump line -----------------------------------------------------------------------------------------------------------------------------
4236
4237
4238 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
4239
4240 e8/call rewind-stream/disp32
4241
4242 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4243 $num-bytes:loop:
4244
4245
4246 51/push-ecx
4247 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
4248
4249 e8/call next-word/disp32
4250
4251 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4252 +-- 46 lines: #? # dump word-slice -----------------------------------------------------------------------------------------------------------------------
4298 $num-bytes:check0:
4299
4300
4301 50/push-eax
4302
4303
4304 51/push-ecx
4305
4306 e8/call slice-empty?/disp32
4307
4308 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4309
4310 3d/compare-eax-and 0/imm32
4311
4312 58/pop-to-eax
4313 75/jump-if-not-equal $num-bytes:end/disp8
4314 $num-bytes:check-for-comment:
4315
4316
4317 8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . .
4318
4319 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
4320 8a/copy-byte 0/mod/indirect 2/rm32/edx . . . 3/r32/BL . .
4321
4322 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x23/imm32/hash
4323 74/jump-if-equal $num-bytes:end/disp8
4324 $num-bytes:check-for-label:
4325
4326
4327 8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 4/disp8 .
4328
4329 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
4330 8a/copy-byte 1/mod/*+disp8 2/rm32/edx . . . 3/r32/BL -1/disp8 .
4331
4332 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x3a/imm32/colon
4333 74/jump-if-equal $num-bytes:end/disp8
4334 $num-bytes:check-for-segment-header:
4335
4336
4337 50/push-eax
4338
4339
4340 68/push "=="/imm32
4341 51/push-ecx
4342
4343 e8/call slice-equal?/disp32
4344
4345 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4346
4347 3d/compare-eax-and 0/imm32
4348
4349 58/pop-to-eax
4350 75/jump-if-not-equal $num-bytes:end/disp8
4351 $num-bytes:loop-body:
4352
4353
4354 89/copy 3/mod/direct 2/rm32/edx . . . 0/r32/eax . .
4355
4356
4357 51/push-ecx
4358
4359 e8/call compute-width-of-slice/disp32
4360
4361 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4362
4363 01/add 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
4364 e9/jump $num-bytes:loop/disp32
4365 $num-bytes:end:
4366
4367
4368 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
4369
4370 e8/call rewind-stream/disp32
4371
4372 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4373
4374 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4375
4376 5b/pop-to-ebx
4377 5a/pop-to-edx
4378 59/pop-to-ecx
4379
4380 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4381 5d/pop-to-ebp
4382 c3/return
4383
4384 test-num-bytes-handles-empty-string:
4385
4386
4387 55/push-ebp
4388 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4389
4390
4391
4392 68/push _test-input-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 68/push _test-output-stream/imm32
4400
4401 e8/call clear-stream/disp32
4402
4403 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4404
4405
4406
4407 68/push _test-input-stream/imm32
4408
4409 e8/call num-bytes/disp32
4410
4411 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4412
4413
4414 68/push "F - test-num-bytes-handles-empty-string"/imm32
4415 68/push 0/imm32/true
4416 50/push-eax
4417
4418 e8/call check-ints-equal/disp32
4419
4420 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4421
4422 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4423 5d/pop-to-ebp
4424 c3/return
4425
4426 test-num-bytes-ignores-comments:
4427
4428
4429 55/push-ebp
4430 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4431
4432
4433
4434 68/push _test-input-stream/imm32
4435
4436 e8/call clear-stream/disp32
4437
4438 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4439
4440
4441 68/push _test-output-stream/imm32
4442
4443 e8/call clear-stream/disp32
4444
4445 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4446
4447
4448
4449 68/push "# abcd"/imm32
4450 68/push _test-input-stream/imm32
4451
4452 e8/call write/disp32
4453
4454 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4455
4456
4457 68/push _test-input-stream/imm32
4458
4459 e8/call num-bytes/disp32
4460
4461 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4462
4463
4464 68/push "F - test-num-bytes-ignores-comments"/imm32
4465 68/push 0/imm32/true
4466 50/push-eax
4467
4468 e8/call check-ints-equal/disp32
4469
4470 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4471
4472 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4473 5d/pop-to-ebp
4474 c3/return
4475
4476 test-num-bytes-ignores-labels:
4477
4478
4479 55/push-ebp
4480 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4481
4482
4483
4484 68/push _test-input-stream/imm32
4485
4486 e8/call clear-stream/disp32
4487
4488 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4489
4490
4491 68/push _test-output-stream/imm32
4492
4493 e8/call clear-stream/disp32
4494
4495 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4496
4497
4498
4499 68/push "ab: # cd"/imm32
4500 68/push _test-input-stream/imm32
4501
4502 e8/call write/disp32
4503
4504 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4505
4506
4507 68/push _test-input-stream/imm32
4508
4509 e8/call num-bytes/disp32
4510
4511 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4512
4513
4514 68/push "F - test-num-bytes-ignores-labels"/imm32
4515 68/push 0/imm32/true
4516 50/push-eax
4517
4518 e8/call check-ints-equal/disp32
4519
4520 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4521
4522 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4523 5d/pop-to-ebp
4524 c3/return
4525
4526 test-num-bytes-ignores-segment-headers:
4527
4528
4529 55/push-ebp
4530 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4531
4532
4533
4534 68/push _test-input-stream/imm32
4535
4536 e8/call clear-stream/disp32
4537
4538 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4539
4540
4541 68/push _test-output-stream/imm32
4542
4543 e8/call clear-stream/disp32
4544
4545 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4546
4547
4548
4549 68/push "== ab cd"/imm32
4550 68/push _test-input-stream/imm32
4551
4552 e8/call write/disp32
4553
4554 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4555
4556
4557 68/push _test-input-stream/imm32
4558
4559 e8/call num-bytes/disp32
4560
4561 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4562
4563
4564 68/push "F - test-num-bytes-ignores-segment-headers"/imm32
4565 68/push 0/imm32/true
4566 50/push-eax
4567
4568 e8/call check-ints-equal/disp32
4569
4570 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4571
4572 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4573 5d/pop-to-ebp
4574 c3/return
4575
4576 test-num-bytes-counts-words-by-default:
4577
4578
4579 55/push-ebp
4580 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4581
4582
4583
4584 68/push _test-input-stream/imm32
4585
4586 e8/call clear-stream/disp32
4587
4588 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4589
4590
4591 68/push _test-output-stream/imm32
4592
4593 e8/call clear-stream/disp32
4594
4595 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4596
4597
4598
4599 68/push "ab cd ef"/imm32
4600 68/push _test-input-stream/imm32
4601
4602 e8/call write/disp32
4603
4604 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4605
4606
4607 68/push _test-input-stream/imm32
4608
4609 e8/call num-bytes/disp32
4610
4611 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4612
4613
4614 68/push "F - test-num-bytes-counts-words-by-default"/imm32
4615 68/push 3/imm32/true
4616 50/push-eax
4617
4618 e8/call check-ints-equal/disp32
4619
4620 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4621
4622 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4623 5d/pop-to-ebp
4624 c3/return
4625
4626 test-num-bytes-ignores-trailing-comment:
4627
4628
4629 55/push-ebp
4630 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4631
4632
4633
4634 68/push _test-input-stream/imm32
4635
4636 e8/call clear-stream/disp32
4637
4638 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4639
4640
4641 68/push _test-output-stream/imm32
4642
4643 e8/call clear-stream/disp32
4644
4645 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4646
4647
4648
4649 68/push "ab cd # ef"/imm32
4650 68/push _test-input-stream/imm32
4651
4652 e8/call write/disp32
4653
4654 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4655
4656
4657 68/push _test-input-stream/imm32
4658
4659 e8/call num-bytes/disp32
4660
4661 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4662
4663
4664 68/push "F - test-num-bytes-ignores-trailing-comment"/imm32
4665 68/push 2/imm32/true
4666 50/push-eax
4667
4668 e8/call check-ints-equal/disp32
4669
4670 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4671
4672 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4673 5d/pop-to-ebp
4674 c3/return
4675
4676 test-num-bytes-handles-imm32:
4677
4678
4679 55/push-ebp
4680 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
4681
4682
4683
4684 68/push _test-input-stream/imm32
4685
4686 e8/call clear-stream/disp32
4687
4688 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4689
4690
4691 68/push _test-output-stream/imm32
4692
4693 e8/call clear-stream/disp32
4694
4695 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4696
4697
4698
4699 68/push "ab cd/imm32 ef"/imm32
4700 68/push _test-input-stream/imm32
4701
4702 e8/call write/disp32
4703
4704 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
4705
4706
4707 68/push _test-input-stream/imm32
4708
4709 e8/call num-bytes/disp32
4710
4711 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
4712
4713
4714 68/push "F - test-num-bytes-handles-imm32"/imm32
4715 68/push 6/imm32/true
4716 50/push-eax
4717
4718 e8/call check-ints-equal/disp32
4719
4720 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
4721
4722 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
4723 5d/pop-to-ebp
4724 c3/return
4725
4726 == data
4727
4728
4729
4730
4731 Elf_header:
4732
4733 0x34/imm32
4734
4735 $e_ident:
4736 7f 45/E 4c/L 46/F
4737 01/32-bit 01/little-endian 01/file-version 00/no-os-extensions
4738 00 00 00 00 00 00 00 00
4739 $e_type:
4740 02 00
4741 $e_machine:
4742 03 00
4743 $e_version:
4744 1/imm32
4745 Elf_e_entry:
4746 0x09000000/imm32
4747 $e_phoff:
4748 0x34/imm32
4749 $e_shoff:
4750 0/imm32
4751 $e_flags:
4752 0/imm32
4753 $e_ehsize:
4754 0x34 00
4755 $e_phentsize:
4756 0x20 00
4757 Elf_e_phnum:
4758 00 00
4759 $e_shentsize:
4760 00 00
4761 $e_shnum:
4762 00 00
4763 $e_shstrndx:
4764 00 00
4765
4766
4767
4768
4769 Elf_program_header_entry:
4770
4771 0x20/imm32
4772
4773 $p_type:
4774 1/imm32/PT_LOAD
4775 Elf_p_offset:
4776 0/imm32
4777 Elf_p_vaddr:
4778 0/imm32
4779 Elf_p_paddr:
4780 0/imm32
4781 Elf_p_filesz:
4782 0/imm32
4783 Elf_p_memsz:
4784 0/imm32
4785 Elf_p_flags:
4786 6/imm32/rw-
4787 $p_align:
4788
4789
4790 0x1000/imm32
4791
4792