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