https://github.com/akkartik/mu/blob/main/linux/survey_baremetal.subx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 == code
40
41
42
43
44 Entry:
45
46 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
47
48
49
50 68/push Heap/imm32
51 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Heap-size/disp32
52
53 e8/call new-segment/disp32
54
55 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
56
57
58 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-size/disp32
59
60 e8/call initialize-trace-stream/disp32
61
62 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
63
64
65
66 81 7/subop/compare 1/mod/*+disp8 5/rm32/ebp . . . . 0/disp8 1/imm32
67 7e/jump-if-<= $subx-survey-main:interactive/disp8
68
69
70
71 68/push "test"/imm32
72 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
73
74 e8/call kernel-string-equal?/disp32
75
76 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
77
78 3d/compare-eax-and 0/imm32/false
79 74/jump-if-= $subx-survey-main:interactive/disp8
80
81
82 e8/call run-tests/disp32
83
84 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32
85 eb/jump $subx-survey-main:end/disp8
86 $subx-survey-main:interactive:
87
88
89
90 68/push Stdout/imm32
91 68/push Stdin/imm32
92
93 e8/call subx-survey/disp32
94
95 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
96
97
98
99
100
101
102
103
104
105 bb/copy-to-ebx 0/imm32
106 $subx-survey-main:end:
107 e8/call syscall_exit/disp32
108
109 subx-survey:
110
111
112
113
114
115
116
117
118
119 55/push-ebp
120 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
121
122 51/push-ecx
123 52/push-edx
124 56/push-esi
125
126
127
128 2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Max-labels/disp32
129
130 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Max-labels/disp32
131
132 68/push 0/imm32/read
133
134 68/push 0/imm32/write
135 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
136
137
138 2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Input-size/disp32
139
140 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Input-size/disp32
141
142 68/push 0/imm32/read
143
144 68/push 0/imm32/write
145 89/copy 3/mod/direct 6/rm32/esi . . . 4/r32/esp . .
146
147
148 56/push-esi
149 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
150
151 e8/call slurp/disp32
152
153 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
154
155
156 52/push-edx
157 56/push-esi
158
159 e8/call compute-offsets/disp32
160
161 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
162
163
164 56/push-esi
165
166 e8/call rewind-stream/disp32
167
168 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
169
170
171 52/push-edx
172 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
173 56/push-esi
174
175 e8/call emit-output/disp32
176
177 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
178
179
180 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
181
182 e8/call flush/disp32
183
184 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
185 $subx-survey:end:
186
187 03/add 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Max-labels/disp32
188 03/add 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Input-size/disp32
189
190 5e/pop-to-esi
191 5a/pop-to-edx
192 59/pop-to-ecx
193
194 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
195 5d/pop-to-ebp
196 c3/return
197
198 test-subx-survey-computes-addresses:
199
200
201
202
203
204
205
206
207
208
209
210 55/push-ebp
211 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
212
213
214
215 68/push _test-input-stream/imm32
216
217 e8/call clear-stream/disp32
218
219 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
220
221
222 68/push $_test-input-buffered-file->buffer/imm32
223
224 e8/call clear-stream/disp32
225
226 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
227
228
229 68/push _test-output-stream/imm32
230
231 e8/call clear-stream/disp32
232
233 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
234
235
236 68/push $_test-output-buffered-file->buffer/imm32
237
238 e8/call clear-stream/disp32
239
240 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
241
242
243
244 68/push "== code\n"/imm32
245 68/push _test-input-stream/imm32
246
247 e8/call write/disp32
248
249 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
250
251
252 68/push "ab x/imm32\n"/imm32
253 68/push _test-input-stream/imm32
254
255 e8/call write/disp32
256
257 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
258
259
260 68/push "== data\n"/imm32
261 68/push _test-input-stream/imm32
262
263 e8/call write/disp32
264
265 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
266
267
268 68/push "x:\n"/imm32
269 68/push _test-input-stream/imm32
270
271 e8/call write/disp32
272
273 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
274
275
276 68/push "01\n"/imm32
277 68/push _test-input-stream/imm32
278
279 e8/call write/disp32
280
281 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
282
283
284 68/push _test-output-buffered-file/imm32
285 68/push _test-input-buffered-file/imm32
286
287 e8/call subx-survey/disp32
288
289 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
290
291 +-- 26 lines: #? # dump *Trace-stream -----------------------------------------------------------------------------------------------------------------------------------------------
317
318
319 68/push "F - test-subx-survey-computes-addresses/0"/imm32
320 68/push "label 'x' is at address 0x00007c05."/imm32
321
322 e8/call check-trace-contains/disp32
323
324 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
325
326 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
327 5d/pop-to-ebp
328 c3/return
329
330 test-subx-survey-computes-addresses-with-padding:
331
332
333
334
335
336
337
338
339
340
341
342 55/push-ebp
343 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
344
345
346
347 68/push _test-input-stream/imm32
348
349 e8/call clear-stream/disp32
350
351 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
352
353
354 68/push $_test-input-buffered-file->buffer/imm32
355
356 e8/call clear-stream/disp32
357
358 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
359
360
361 68/push _test-output-stream/imm32
362
363 e8/call clear-stream/disp32
364
365 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
366
367
368 68/push $_test-output-buffered-file->buffer/imm32
369
370 e8/call clear-stream/disp32
371
372 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
373
374
375
376 68/push "== code\n"/imm32
377 68/push _test-input-stream/imm32
378
379 e8/call write/disp32
380
381 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
382
383
384 68/push "ab x/imm32\n"/imm32
385 68/push _test-input-stream/imm32
386
387 e8/call write/disp32
388
389 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
390
391
392 68/push "== data 0x7c10\n"/imm32
393 68/push _test-input-stream/imm32
394
395 e8/call write/disp32
396
397 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
398
399
400 68/push "x:\n"/imm32
401 68/push _test-input-stream/imm32
402
403 e8/call write/disp32
404
405 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
406
407
408 68/push "01\n"/imm32
409 68/push _test-input-stream/imm32
410
411 e8/call write/disp32
412
413 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
414
415
416 68/push _test-output-buffered-file/imm32
417 68/push _test-input-buffered-file/imm32
418
419 e8/call subx-survey/disp32
420
421 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
422
423 +-- 26 lines: #? # dump *Trace-stream -----------------------------------------------------------------------------------------------------------------------------------------------
449
450
451 68/push "F - test-subx-survey-computes-addresses-with-padding/0"/imm32
452 68/push "label 'x' is at address 0x00007c10."/imm32
453
454 e8/call check-trace-contains/disp32
455
456 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
457
458 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
459 5d/pop-to-ebp
460 c3/return
461
462 compute-offsets:
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496 55/push-ebp
497 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
498
499 50/push-eax
500 51/push-ecx
501 52/push-edx
502 53/push-ebx
503 56/push-esi
504 57/push-edi
505
506 be/copy-to-esi 0x7c00/imm32
507
508 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32
509 68/push 0x200/imm32/size
510 68/push 0/imm32/read
511 68/push 0/imm32/write
512 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
513
514 68/push 0/imm32
515 68/push 0/imm32
516 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
517 $compute-offsets:line-loop:
518
519
520 51/push-ecx
521
522 e8/call clear-stream/disp32
523
524 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
525
526
527 51/push-ecx
528 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
529
530 e8/call read-line/disp32
531
532 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
533
534 8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . .
535 3d/compare-eax-and 0/imm32
536 0f 84/jump-if-= $compute-offsets:end/disp32
537 +-- 33 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------
570 $compute-offsets:word-loop:
571
572
573 52/push-edx
574 51/push-ecx
575
576 e8/call next-word/disp32
577
578 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
579 $compute-offsets:case-empty:
580
581
582
583 52/push-edx
584
585 e8/call slice-empty?/disp32
586
587 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
588
589 3d/compare-eax-and 0/imm32/false
590 0f 85/jump-if-!= $compute-offsets:line-loop/disp32
591 $compute-offsets:case-comment:
592
593
594 68/push "#"/imm32
595 52/push-edx
596
597 e8/call slice-starts-with?/disp32
598
599 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
600
601 3d/compare-eax-and 0/imm32/false
602 0f 85/jump-if-!= $compute-offsets:line-loop/disp32
603 $compute-offsets:case-segment-header:
604
605
606
607 68/push "=="/imm32
608 52/push-edx
609
610 e8/call slice-equal?/disp32
611
612 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
613
614 3d/compare-eax-and 0/imm32/false
615 0f 84/jump-if-= $compute-offsets:case-label/disp32
616
617
618 52/push-edx
619 51/push-ecx
620
621 e8/call next-word/disp32
622
623 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
624
625
626
627 52/push-edx
628
629 e8/call slice-empty?/disp32
630
631 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
632
633 3d/compare-eax-and 0/imm32/false
634 0f 85/jump-if-!= $compute-offsets:abort/disp32
635
636
637 52/push-edx
638 51/push-ecx
639
640 e8/call next-word/disp32
641
642 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
643
644
645
646 52/push-edx
647
648 e8/call slice-empty?/disp32
649
650 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
651
652 3d/compare-eax-and 0/imm32/false
653 0f 85/jump-if-!= $compute-offsets:line-loop/disp32
654
655
656 52/push-edx
657
658 e8/call parse-hex-int-from-slice/disp32
659
660 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
661
662 39/compare 3/mod/direct 0/rm32/eax . . . 6/r32/esi . .
663 0f 82/jump-if-addr< $compute-offsets:error-bad-segment-address/disp32
664
665 89/copy 3/mod/direct 6/rm32/esi . . . 0/r32/eax . .
666
667 e9/jump $compute-offsets:line-loop/disp32
668 $compute-offsets:case-label:
669
670
671
672 52/push-edx
673
674 e8/call label?/disp32
675
676 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
677
678 3d/compare-eax-and 0/imm32/false
679 0f 84/jump-if-= $compute-offsets:case-default/disp32
680
681 ff 1/subop/decrement 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
682
683
684 68/push Heap/imm32
685 68/push 0xc/imm32/row-size
686 52/push-edx
687 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
688
689 e8/call get-or-insert-slice/disp32
690
691 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
692
693 89/copy 0/mod/indirect 0/rm32/eax . . . 6/r32/esi . .
694
695
696 68/push "."/imm32
697 56/push-esi
698 68/push "' is at address "/imm32
699 52/push-edx
700 68/push "label '"/imm32
701
702 e8/call trace-slsns/disp32
703
704 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
705
706 e9/jump $compute-offsets:word-loop/disp32
707 $compute-offsets:case-default:
708
709
710 52/push-edx
711
712 e8/call compute-width-of-slice/disp32
713
714 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
715
716 01/add 3/mod/direct 6/rm32/esi . . . 0/r32/eax . .
717 +-- 41 lines: #? # dump segment-offset ----------------------------------------------------------------------------------------------------------------------------------------------
758 e9/jump $compute-offsets:word-loop/disp32
759 $compute-offsets:end:
760
761 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x214/imm32
762
763 5f/pop-to-edi
764 5e/pop-to-esi
765 5b/pop-to-ebx
766 5a/pop-to-edx
767 59/pop-to-ecx
768 58/pop-to-eax
769
770 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
771 5d/pop-to-ebp
772 c3/return
773
774 $compute-offsets:abort:
775
776
777 68/push "'==' must be followed by segment name and optionally an address\n"/imm32
778 68/push 2/imm32/stderr
779
780 e8/call _write/disp32
781
782 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
783
784 bb/copy-to-ebx 1/imm32
785 e8/call syscall_exit/disp32
786
787
788 $compute-offsets:error-bad-segment-address:
789
790
791 68/push "'==' specifies an address that implies negative padding\n"/imm32
792 68/push 2/imm32/stderr
793
794 e8/call _write/disp32
795
796 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
797
798 bb/copy-to-ebx 1/imm32
799 e8/call syscall_exit/disp32
800
801
802 test-compute-offsets:
803
804
805
806
807
808
809
810
811
812
813
814
815 55/push-ebp
816 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
817
818
819
820 68/push _test-input-stream/imm32
821
822 e8/call clear-stream/disp32
823
824 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
825
826 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x18/imm32
827 68/push 0x18/imm32/size
828 68/push 0/imm32/read
829 68/push 0/imm32/write
830 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
831
832
833
834 68/push "== code\n"/imm32
835 68/push _test-input-stream/imm32
836
837 e8/call write/disp32
838
839 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
840
841
842 68/push "ab x/imm32 # skip comment\n"/imm32
843 68/push _test-input-stream/imm32
844
845 e8/call write/disp32
846
847 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
848
849
850 68/push "== data\n"/imm32
851 68/push _test-input-stream/imm32
852
853 e8/call write/disp32
854
855 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
856
857
858 68/push "00\n"/imm32
859 68/push _test-input-stream/imm32
860
861 e8/call write/disp32
862
863 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
864
865
866 68/push "x:\n"/imm32
867 68/push _test-input-stream/imm32
868
869 e8/call write/disp32
870
871 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
872
873
874 68/push "34\n"/imm32
875 68/push _test-input-stream/imm32
876
877 e8/call write/disp32
878
879 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
880
881
882 52/push-edx
883 68/push _test-input-stream/imm32
884
885 e8/call compute-offsets/disp32
886
887 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
888 +-- 26 lines: #? # dump *Trace-stream -----------------------------------------------------------------------------------------------------------------------------------------------
914
915
916 68/push "F - test-compute-offsets"/imm32
917 68/push "label 'x' is at address 0x00007c06."/imm32
918
919 e8/call check-trace-contains/disp32
920
921 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
922
923
924 68/push "F - test-compute-offsets-maintains-labels-write-index"/imm32
925 68/push 0xc/imm32/1-entry
926 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
927
928 e8/call check-ints-equal/disp32
929
930 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
931
932 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x24/imm32
933
934 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
935 5d/pop-to-ebp
936 c3/return
937
938
939 == data
940
941 emit-output:datum:
942 0/imm32/start
943 0/imm32/end
944
945 == code
946
947 emit-output:
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012 55/push-ebp
1013 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1014
1015 50/push-eax
1016 51/push-ecx
1017 52/push-edx
1018 53/push-ebx
1019 56/push-esi
1020 57/push-edi
1021
1022 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32
1023 68/push 0x200/imm32/size
1024 68/push 0/imm32/read
1025 68/push 0/imm32/write
1026 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1027
1028 68/push 0/imm32/end
1029 68/push 0/imm32/start
1030 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1031
1032 bb/copy-to-ebx 0x7c00/imm32
1033 $emit-output:line-loop:
1034
1035
1036 51/push-ecx
1037
1038 e8/call clear-stream/disp32
1039
1040 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1041
1042
1043 51/push-ecx
1044 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
1045
1046 e8/call read-line/disp32
1047
1048 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1049 +-- 33 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------
1082 $emit-output:check-for-end-of-input:
1083
1084 81 7/subop/compare 0/mod/indirect 1/rm32/ecx . . . . . 0/imm32
1085 0f 84/jump-if-= $emit-output:end/disp32
1086
1087
1088
1089 51/push-ecx
1090
1091 e8/call num-bytes/disp32
1092
1093 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1094
1095 01/add 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . .
1096
1097
1098 51/push-ecx
1099
1100 e8/call far-jump-or-call?/disp32
1101
1102 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1103
1104
1105 51/push-ecx
1106
1107 e8/call rewind-stream/disp32
1108
1109 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1110 $emit-output:word-loop:
1111
1112
1113 52/push-edx
1114 51/push-ecx
1115
1116 e8/call next-word/disp32
1117
1118 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1119 +-- 33 lines: #? # dump word-slice --------------------------------------------------------------------------------------------------------------------------------------------------
1152 $emit-output:check-for-end-of-line:
1153
1154
1155
1156 52/push-edx
1157
1158 e8/call slice-empty?/disp32
1159
1160 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1161
1162 3d/compare-eax-and 0/imm32/false
1163 0f 85/jump-if-!= $emit-output:next-line/disp32
1164 $emit-output:check-for-comment:
1165
1166
1167 8b/copy 0/mod/indirect 2/rm32/edx . . . 6/r32/esi . .
1168
1169 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
1170 8a/copy-byte 0/mod/indirect 6/rm32/esi . . . 0/r32/AL . .
1171
1172 3d/compare-eax-and 0x23/imm32/hash
1173 0f 84/jump-if-= $emit-output:next-line/disp32
1174 $emit-output:check-for-label:
1175
1176
1177
1178 52/push-edx
1179
1180 e8/call label?/disp32
1181
1182 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1183
1184 3d/compare-eax-and 0/imm32/false
1185 0f 85/jump-if-!= $emit-output:line-loop/disp32
1186 $emit-output:check-for-segment-header:
1187
1188
1189
1190 68/push "=="/imm32
1191 52/push-edx
1192
1193 e8/call slice-equal?/disp32
1194
1195 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1196
1197 3d/compare-eax-and 0/imm32/false
1198 0f 84/jump-if-= $emit-output:2-character/disp32
1199
1200
1201
1202 52/push-edx
1203 51/push-ecx
1204
1205 e8/call next-word/disp32
1206
1207 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1208
1209
1210
1211 52/push-edx
1212 51/push-ecx
1213
1214 e8/call next-word/disp32
1215
1216 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1217
1218
1219 52/push-edx
1220
1221 e8/call slice-empty?/disp32
1222
1223 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1224
1225 3d/compare-eax-and 0/imm32/false
1226 0f 85/jump-if-!= $emit-output:padding-done/disp32
1227
1228
1229 52/push-edx
1230
1231 e8/call parse-hex-int-from-slice/disp32
1232
1233 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1234
1235
1236
1237 68/push "# "/imm32
1238 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1239
1240 e8/call write-buffered/disp32
1241
1242 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1243
1244
1245 53/push-ebx
1246 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1247
1248 e8/call write-int32-hex-buffered/disp32
1249
1250 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1251
1252
1253 68/push Newline/imm32
1254 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1255
1256 e8/call write-buffered/disp32
1257
1258 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1259 $emit-output:padding-loop:
1260
1261 39/compare 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . .
1262 73/jump-if-addr>= $emit-output:padding-loop-done/disp8
1263
1264 53/push-ebx
1265 81 4/subop/and 3/mod/direct 3/rm32/ebx . . . . . 7/imm32
1266 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0/imm32
1267 5b/pop-to-ebx
1268 75/jump-if-!= $emit-output:padding-core/disp8
1269
1270
1271 68/push Newline/imm32
1272 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1273
1274 e8/call write-buffered/disp32
1275
1276 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1277 $emit-output:padding-core:
1278
1279
1280 68/push "00 "/imm32
1281 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1282
1283 e8/call write-buffered/disp32
1284
1285 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1286
1287 43/increment-ebx
1288
1289 eb/jump $emit-output:padding-loop/disp8
1290 $emit-output:padding-loop-done:
1291
1292
1293 68/push Newline/imm32
1294 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1295
1296 e8/call write-buffered/disp32
1297
1298 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1299 $emit-output:padding-done:
1300
1301
1302
1303 68/push "# "/imm32
1304 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1305
1306 e8/call write-buffered/disp32
1307
1308 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1309
1310
1311 53/push-ebx
1312 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1313
1314 e8/call write-int32-hex-buffered/disp32
1315
1316 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1317
1318
1319 68/push Newline/imm32
1320 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1321
1322 e8/call write-buffered/disp32
1323
1324 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1325
1326 e9/jump $emit-output:line-loop/disp32
1327 $emit-output:2-character:
1328
1329
1330 8b/copy 1/mod/*+disp8 2/rm32/edx . . . 0/r32/eax 4/disp8 .
1331 2b/subtract 0/mod/indirect 2/rm32/edx . . . 0/r32/eax . .
1332
1333 3d/compare-eax-and 2/imm32
1334 75/jump-if-!= $emit-output:check-metadata/disp8
1335
1336
1337 52/push-edx
1338 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1339
1340 e8/call write-slice-buffered/disp32
1341
1342 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1343
1344
1345 68/push Space/imm32
1346 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1347
1348 e8/call write-buffered/disp32
1349
1350 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1351
1352 e9/jump $emit-output:word-loop/disp32
1353 $emit-output:check-metadata:
1354
1355
1356
1357 68/push emit-output:datum/imm32
1358 68/push 0x2f/imm32/slash
1359 ff 6/subop/push 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
1360 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
1361
1362 e8/call next-token-from-slice/disp32
1363
1364 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
1365 +-- 33 lines: #? # dump datum -------------------------------------------------------------------------------------------------------------------------------------------------------
1398
1399
1400
1401 68/push "label table"/imm32
1402 68/push 0xc/imm32/row-size
1403 68/push emit-output:datum/imm32
1404 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
1405
1406 e8/call get-slice/disp32
1407
1408 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
1409
1410 89/copy 3/mod/direct 6/rm32/esi . . . 0/r32/eax . .
1411 $emit-output:check-imm8:
1412
1413
1414
1415 68/push "imm8"/imm32
1416 52/push-edx
1417
1418 e8/call has-metadata?/disp32
1419
1420 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1421
1422 3d/compare-eax-and 0/imm32/false
1423 74/jump-if-= $emit-output:check-imm16/disp8
1424 $emit-output:emit-imm8:
1425
1426
1427 68/push 1/imm32
1428 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
1429 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1430
1431 e8/call emit-hex/disp32
1432
1433 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1434
1435 e9/jump $emit-output:word-loop/disp32
1436 $emit-output:check-imm16:
1437
1438
1439
1440 68/push "imm16"/imm32
1441 52/push-edx
1442
1443 e8/call has-metadata?/disp32
1444
1445 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1446
1447 3d/compare-eax-and 0/imm32/false
1448 74/jump-if-= $emit-output:check-imm32/disp8
1449 +-- 33 lines: #? # dump *address ----------------------------------------------------------------------------------------------------------------------------------------------------
1482 $emit-output:emit-imm16:
1483
1484
1485 68/push 2/imm32
1486 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
1487 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1488
1489 e8/call emit-hex/disp32
1490
1491 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1492
1493
1494 e9/jump $emit-output:word-loop/disp32
1495 $emit-output:check-imm32:
1496
1497
1498
1499 68/push "imm32"/imm32
1500 52/push-edx
1501
1502 e8/call has-metadata?/disp32
1503
1504 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1505
1506 3d/compare-eax-and 0/imm32/false
1507 74/jump-if-= $emit-output:check-disp8/disp8
1508 +-- 33 lines: #? # dump *address ----------------------------------------------------------------------------------------------------------------------------------------------------
1541 $emit-output:emit-imm32:
1542
1543
1544 68/push 4/imm32
1545 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
1546 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1547
1548 e8/call emit-hex/disp32
1549
1550 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1551
1552 e9/jump $emit-output:word-loop/disp32
1553 $emit-output:check-disp8:
1554
1555
1556
1557 68/push "disp8"/imm32
1558 52/push-edx
1559
1560 e8/call has-metadata?/disp32
1561
1562 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1563
1564 3d/compare-eax-and 0/imm32/false
1565 74/jump-if-= $emit-output:check-disp16/disp8
1566 $emit-output:emit-disp8:
1567
1568
1569 68/push 1/imm32
1570 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
1571 29/subtract 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
1572 50/push-eax
1573 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1574
1575 e8/call emit-hex/disp32
1576
1577 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1578
1579 e9/jump $emit-output:word-loop/disp32
1580 $emit-output:check-disp16:
1581
1582
1583
1584 68/push "disp16"/imm32
1585 52/push-edx
1586
1587 e8/call has-metadata?/disp32
1588
1589 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1590
1591 3d/compare-eax-and 0/imm32/false
1592 74/jump-if-= $emit-output:check-disp32/disp8
1593 $emit-output:emit-disp16:
1594
1595
1596 68/push 2/imm32
1597 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
1598 29/subtract 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
1599 50/push-eax
1600 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1601
1602 e8/call emit-hex/disp32
1603
1604 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1605
1606 e9/jump $emit-output:word-loop/disp32
1607 $emit-output:check-disp32:
1608
1609
1610
1611 68/push "disp32"/imm32
1612 52/push-edx
1613
1614 e8/call has-metadata?/disp32
1615
1616 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1617
1618 3d/compare-eax-and 0/imm32/false
1619 0f 84/jump-if-= $emit-output:abort/disp32
1620 $emit-output:emit-disp32:
1621
1622 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
1623
1624 81 7/subop/compare 3/mod/direct 7/rm32/edi . . . . . 0/imm32/false
1625 74/jump-if-= $emit-output:really-emit-disp32/disp8
1626 29/subtract 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
1627 $emit-output:really-emit-disp32:
1628
1629
1630 68/push 4/imm32
1631 50/push-eax
1632 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1633
1634 e8/call emit-hex/disp32
1635
1636 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1637
1638 e9/jump $emit-output:word-loop/disp32
1639 $emit-output:next-line:
1640
1641
1642 68/push Newline/imm32
1643 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1644
1645 e8/call write-buffered/disp32
1646
1647 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1648
1649 e9/jump $emit-output:line-loop/disp32
1650 $emit-output:end:
1651
1652 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x214/imm32
1653
1654 5f/pop-to-edi
1655 5e/pop-to-esi
1656 5b/pop-to-ebx
1657 5a/pop-to-edx
1658 59/pop-to-ecx
1659 58/pop-to-eax
1660
1661 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1662 5d/pop-to-ebp
1663 c3/return
1664
1665 $emit-output:abort:
1666
1667
1668
1669 68/push "emit-output: missing metadata in "/imm32
1670 68/push 2/imm32/stderr
1671
1672 e8/call _write/disp32
1673
1674 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1675
1676
1677 52/push-edx
1678 68/push Stderr/imm32
1679
1680 e8/call write-slice-buffered/disp32
1681
1682 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1683
1684
1685 68/push Stderr/imm32
1686
1687 e8/call flush/disp32
1688
1689 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1690
1691 bb/copy-to-ebx 1/imm32
1692 e8/call syscall_exit/disp32
1693
1694
1695 test-emit-output-non-far-control-flow:
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716 55/push-ebp
1717 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1718
1719
1720
1721 68/push _test-input-stream/imm32
1722
1723 e8/call clear-stream/disp32
1724
1725 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1726
1727
1728 68/push _test-output-stream/imm32
1729
1730 e8/call clear-stream/disp32
1731
1732 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1733
1734
1735 68/push $_test-output-buffered-file->buffer/imm32
1736
1737 e8/call clear-stream/disp32
1738
1739 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1740
1741 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
1742 68/push 0xc0/imm32/size
1743 68/push 0/imm32/read
1744 68/push 0/imm32/write
1745 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1746
1747 68/push 0/imm32
1748 68/push 0/imm32
1749 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
1750
1751
1752
1753 68/push "== code\n"/imm32
1754 68/push _test-input-stream/imm32
1755
1756 e8/call write/disp32
1757
1758 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1759
1760
1761 68/push "ab cd ef gh\n"/imm32
1762 68/push _test-input-stream/imm32
1763
1764 e8/call write/disp32
1765
1766 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1767
1768
1769 68/push "ij x/disp32\n"/imm32
1770 68/push _test-input-stream/imm32
1771
1772 e8/call write/disp32
1773
1774 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1775
1776
1777 68/push "== data\n"/imm32
1778 68/push _test-input-stream/imm32
1779
1780 e8/call write/disp32
1781
1782 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1783
1784
1785 68/push "00\n"/imm32
1786 68/push _test-input-stream/imm32
1787
1788 e8/call write/disp32
1789
1790 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1791
1792
1793 68/push "34\n"/imm32
1794 68/push _test-input-stream/imm32
1795
1796 e8/call write/disp32
1797
1798 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1799
1800 68/push 0x11223344/imm32/label-address
1801
1802 53/push-ebx
1803 68/push "x"/imm32
1804 68/push Heap/imm32
1805 e8/call copy-array/disp32
1806 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1807 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1808 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1809
1810 52/push-edx
1811
1812 e8/call stream-add2/disp32
1813
1814 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
1815
1816
1817
1818 52/push-edx
1819 68/push _test-output-buffered-file/imm32
1820 68/push _test-input-stream/imm32
1821
1822 e8/call emit-output/disp32
1823
1824 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1825
1826
1827
1828 68/push _test-output-buffered-file/imm32
1829
1830 e8/call flush/disp32
1831
1832 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1833 +-- 33 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------
1866
1867
1868 68/push "F - test-emit-output-non-far-control-flow/0"/imm32
1869 68/push "# 0x00007c00"/imm32
1870 68/push _test-output-stream/imm32
1871
1872 e8/call check-next-stream-line-equal/disp32
1873
1874 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1875
1876
1877 68/push "F - test-emit-output-non-far-control-flow/1"/imm32
1878 68/push "ab cd ef gh "/imm32
1879 68/push _test-output-stream/imm32
1880
1881 e8/call check-next-stream-line-equal/disp32
1882
1883 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1884
1885
1886 68/push "F - test-emit-output-non-far-control-flow/2"/imm32
1887 68/push "ij 44 33 22 11 "/imm32
1888 68/push _test-output-stream/imm32
1889
1890 e8/call check-next-stream-line-equal/disp32
1891
1892 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1893
1894
1895 68/push "F - test-emit-output-non-far-control-flow/3"/imm32
1896 68/push "# 0x00007c09"/imm32
1897 68/push _test-output-stream/imm32
1898
1899 e8/call check-next-stream-line-equal/disp32
1900
1901 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1902
1903
1904 68/push "F - test-emit-output-non-far-control-flow/3"/imm32
1905 68/push "00 "/imm32
1906 68/push _test-output-stream/imm32
1907
1908 e8/call check-next-stream-line-equal/disp32
1909
1910 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1911
1912
1913 68/push "F - test-emit-output-non-far-control-flow/4"/imm32
1914 68/push "34 "/imm32
1915 68/push _test-output-stream/imm32
1916
1917 e8/call check-next-stream-line-equal/disp32
1918
1919 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1920
1921 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1922 5d/pop-to-ebp
1923 c3/return
1924
1925 test-emit-output-with-padding:
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944 55/push-ebp
1945 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1946
1947
1948
1949 68/push _test-input-stream/imm32
1950
1951 e8/call clear-stream/disp32
1952
1953 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1954
1955
1956 68/push _test-output-stream/imm32
1957
1958 e8/call clear-stream/disp32
1959
1960 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1961
1962
1963 68/push $_test-output-buffered-file->buffer/imm32
1964
1965 e8/call clear-stream/disp32
1966
1967 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1968
1969 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
1970 68/push 0xc0/imm32/size
1971 68/push 0/imm32/read
1972 68/push 0/imm32/write
1973 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1974
1975 68/push 0/imm32
1976 68/push 0/imm32
1977 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
1978
1979
1980
1981 68/push "== code\n"/imm32
1982 68/push _test-input-stream/imm32
1983
1984 e8/call write/disp32
1985
1986 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1987
1988
1989 68/push "ab cd ef gh\n"/imm32
1990 68/push _test-input-stream/imm32
1991
1992 e8/call write/disp32
1993
1994 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1995
1996
1997 68/push "== data 0x7c10\n"/imm32
1998 68/push _test-input-stream/imm32
1999
2000 e8/call write/disp32
2001
2002 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2003
2004
2005 68/push "34\n"/imm32
2006 68/push _test-input-stream/imm32
2007
2008 e8/call write/disp32
2009
2010 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2011
2012
2013
2014 52/push-edx
2015 68/push _test-output-buffered-file/imm32
2016 68/push _test-input-stream/imm32
2017
2018 e8/call emit-output/disp32
2019
2020 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2021
2022
2023
2024 68/push _test-output-buffered-file/imm32
2025
2026 e8/call flush/disp32
2027
2028 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2029 +-- 33 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------
2062
2063
2064 68/push "F - test-emit-output-with-padding/0"/imm32
2065 68/push "# 0x00007c00"/imm32
2066 68/push _test-output-stream/imm32
2067
2068 e8/call check-next-stream-line-equal/disp32
2069
2070 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2071
2072
2073 68/push "F - test-emit-output-with-padding/1"/imm32
2074 68/push "ab cd ef gh "/imm32
2075 68/push _test-output-stream/imm32
2076
2077 e8/call check-next-stream-line-equal/disp32
2078
2079 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2080
2081
2082 68/push "F - test-emit-output-with-padding/0"/imm32
2083 68/push "# 0x00007c04"/imm32
2084 68/push _test-output-stream/imm32
2085
2086 e8/call check-next-stream-line-equal/disp32
2087
2088 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2089
2090
2091 68/push "F - test-emit-output-with-padding/2"/imm32
2092 68/push "00 00 00 00 "/imm32
2093 68/push _test-output-stream/imm32
2094
2095 e8/call check-next-stream-line-equal/disp32
2096
2097 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2098
2099
2100 68/push "F - test-emit-output-with-padding/3"/imm32
2101 68/push "00 00 00 00 00 00 00 00 "/imm32
2102 68/push _test-output-stream/imm32
2103
2104 e8/call check-next-stream-line-equal/disp32
2105
2106 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2107
2108
2109 68/push "F - test-emit-output-with-padding/0"/imm32
2110 68/push "# 0x00007c10"/imm32
2111 68/push _test-output-stream/imm32
2112
2113 e8/call check-next-stream-line-equal/disp32
2114
2115 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2116
2117
2118 68/push "F - test-emit-output-with-padding/4"/imm32
2119 68/push "34 "/imm32
2120 68/push _test-output-stream/imm32
2121
2122 e8/call check-next-stream-line-equal/disp32
2123
2124 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2125
2126 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2127 5d/pop-to-ebp
2128 c3/return
2129
2130 test-emit-output-code-label:
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148 55/push-ebp
2149 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2150
2151
2152
2153 68/push _test-input-stream/imm32
2154
2155 e8/call clear-stream/disp32
2156
2157 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2158
2159
2160 68/push _test-output-stream/imm32
2161
2162 e8/call clear-stream/disp32
2163
2164 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2165
2166
2167 68/push $_test-output-buffered-file->buffer/imm32
2168
2169 e8/call clear-stream/disp32
2170
2171 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2172
2173 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
2174 68/push 0xc0/imm32/size
2175 68/push 0/imm32/read
2176 68/push 0/imm32/write
2177 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
2178
2179 68/push 0/imm32
2180 68/push 0/imm32
2181 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
2182
2183
2184
2185 68/push "== code\n"/imm32
2186 68/push _test-input-stream/imm32
2187
2188 e8/call write/disp32
2189
2190 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2191
2192
2193 68/push "ab cd\n"/imm32
2194 68/push _test-input-stream/imm32
2195
2196 e8/call write/disp32
2197
2198 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2199
2200
2201 68/push "ef gh\n"/imm32
2202 68/push _test-input-stream/imm32
2203
2204 e8/call write/disp32
2205
2206 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2207
2208
2209 68/push "e8 l1/disp32\n"/imm32
2210 68/push _test-input-stream/imm32
2211
2212 e8/call write/disp32
2213
2214 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2215
2216 68/push 0x7c10/imm32/label-address
2217
2218 53/push-ebx
2219 68/push "l1"/imm32
2220 68/push Heap/imm32
2221 e8/call copy-array/disp32
2222 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2223 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
2224 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
2225
2226 52/push-edx
2227
2228 e8/call stream-add2/disp32
2229
2230 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
2231
2232
2233
2234 52/push-edx
2235 68/push _test-output-buffered-file/imm32
2236 68/push _test-input-stream/imm32
2237
2238 e8/call emit-output/disp32
2239
2240 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2241
2242
2243
2244 68/push _test-output-buffered-file/imm32
2245
2246 e8/call flush/disp32
2247
2248 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2249 +-- 33 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------
2282
2283
2284 68/push "F - test-emit-output-code-label/0"/imm32
2285 68/push "# 0x00007c00"/imm32
2286 68/push _test-output-stream/imm32
2287
2288 e8/call check-next-stream-line-equal/disp32
2289
2290 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2291
2292
2293 68/push "F - test-emit-output-code-label/1"/imm32
2294 68/push "ab cd "/imm32
2295 68/push _test-output-stream/imm32
2296
2297 e8/call check-next-stream-line-equal/disp32
2298
2299 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2300
2301
2302 68/push "F - test-emit-output-code-label/2"/imm32
2303 68/push "ef gh "/imm32
2304 68/push _test-output-stream/imm32
2305
2306 e8/call check-next-stream-line-equal/disp32
2307
2308 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2309
2310
2311 68/push "F - test-emit-output-code-label/3"/imm32
2312 68/push "e8 07 00 00 00 "/imm32
2313 68/push _test-output-stream/imm32
2314
2315 e8/call check-next-stream-line-equal/disp32
2316
2317 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2318
2319 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2320 5d/pop-to-ebp
2321 c3/return
2322
2323 test-emit-output-code-label-absolute:
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341 55/push-ebp
2342 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2343
2344
2345
2346 68/push _test-input-stream/imm32
2347
2348 e8/call clear-stream/disp32
2349
2350 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2351
2352
2353 68/push _test-output-stream/imm32
2354
2355 e8/call clear-stream/disp32
2356
2357 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2358
2359
2360 68/push $_test-output-buffered-file->buffer/imm32
2361
2362 e8/call clear-stream/disp32
2363
2364 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2365
2366 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
2367 68/push 0xc0/imm32/size
2368 68/push 0/imm32/read
2369 68/push 0/imm32/write
2370 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
2371
2372 68/push 0/imm32
2373 68/push 0/imm32
2374 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
2375
2376
2377
2378 68/push "== code\n"/imm32
2379 68/push _test-input-stream/imm32
2380
2381 e8/call write/disp32
2382
2383 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2384
2385
2386 68/push "ab cd\n"/imm32
2387 68/push _test-input-stream/imm32
2388
2389 e8/call write/disp32
2390
2391 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2392
2393
2394 68/push "ef gh\n"/imm32
2395 68/push _test-input-stream/imm32
2396
2397 e8/call write/disp32
2398
2399 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2400
2401
2402 68/push "ij l1/imm32\n"/imm32
2403 68/push _test-input-stream/imm32
2404
2405 e8/call write/disp32
2406
2407 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2408
2409 68/push 0x1056/imm32/label-address
2410
2411 53/push-ebx
2412 68/push "l1"/imm32
2413 68/push Heap/imm32
2414 e8/call copy-array/disp32
2415 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2416 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
2417 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
2418
2419 52/push-edx
2420
2421 e8/call stream-add2/disp32
2422
2423 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
2424
2425
2426
2427 52/push-edx
2428 68/push _test-output-buffered-file/imm32
2429 68/push _test-input-stream/imm32
2430
2431 e8/call emit-output/disp32
2432
2433 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2434
2435
2436
2437 68/push _test-output-buffered-file/imm32
2438
2439 e8/call flush/disp32
2440
2441 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2442 +-- 33 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------
2475
2476
2477 68/push "F - test-emit-output-code-label-absolute/0"/imm32
2478 68/push "# 0x00007c00"/imm32
2479 68/push _test-output-stream/imm32
2480
2481 e8/call check-next-stream-line-equal/disp32
2482
2483 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2484
2485
2486 68/push "F - test-emit-output-code-label-absolute/1"/imm32
2487 68/push "ab cd "/imm32
2488 68/push _test-output-stream/imm32
2489
2490 e8/call check-next-stream-line-equal/disp32
2491
2492 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2493
2494
2495 68/push "F - test-emit-output-code-label-absolute/2"/imm32
2496 68/push "ef gh "/imm32
2497 68/push _test-output-stream/imm32
2498
2499 e8/call check-next-stream-line-equal/disp32
2500
2501 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2502
2503
2504 68/push "F - test-emit-output-code-label-absolute/3"/imm32
2505 68/push "ij 56 10 00 00 "/imm32
2506 68/push _test-output-stream/imm32
2507
2508 e8/call check-next-stream-line-equal/disp32
2509
2510 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2511
2512 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2513 5d/pop-to-ebp
2514 c3/return
2515
2516
2517
2518 far-jump-or-call?:
2519
2520 55/push-ebp
2521 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2522
2523 50/push-eax
2524 51/push-ecx
2525 52/push-edx
2526 53/push-ebx
2527
2528 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 .
2529
2530 68/push 0/imm32/end
2531 68/push 0/imm32/start
2532 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
2533
2534 68/push 0/imm32/end
2535 68/push 0/imm32/start
2536 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
2537
2538 bf/copy-to-edi 0/imm32/false
2539 $far-jump-or-call?:check-first-word:
2540
2541
2542 52/push-edx
2543 51/push-ecx
2544
2545 e8/call next-word/disp32
2546
2547 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2548
2549
2550
2551 52/push-edx
2552
2553 e8/call slice-empty?/disp32
2554
2555 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2556
2557 3d/compare-eax-and 0/imm32/false
2558 0f 85/jump-if-!= $far-jump-or-call?:end/disp32
2559
2560
2561 53/push-ebx
2562 68/push 0x2f/imm32/slash
2563 ff 6/subop/push 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
2564 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
2565
2566 e8/call next-token-from-slice/disp32
2567
2568 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
2569
2570
2571
2572 68/push "e8"/imm32
2573 53/push-ebx
2574
2575 e8/call slice-equal?/disp32
2576
2577 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2578
2579 3d/compare-eax-and 0/imm32/false
2580 75/jump-if-!= $far-jump-or-call?:return-true/disp8
2581
2582
2583
2584 68/push "e9"/imm32
2585 53/push-ebx
2586
2587 e8/call slice-equal?/disp32
2588
2589 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2590
2591 3d/compare-eax-and 0/imm32/false
2592 75/jump-if-!= $far-jump-or-call?:return-true/disp8
2593
2594
2595
2596 68/push "0f"/imm32
2597 53/push-ebx
2598
2599 e8/call slice-equal?/disp32
2600
2601 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2602
2603 3d/compare-eax-and 0/imm32/false
2604 74/jump-if-= $far-jump-or-call?:end/disp8
2605 $far-jump-or-call?:check-second-word:
2606
2607
2608 52/push-edx
2609 51/push-ecx
2610
2611 e8/call next-word/disp32
2612
2613 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2614
2615
2616
2617 52/push-edx
2618
2619 e8/call slice-empty?/disp32
2620
2621 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2622
2623 3d/compare-eax-and 0/imm32/false
2624 75/jump-if-!= $far-jump-or-call?:end/disp8
2625
2626
2627 8b/copy 0/mod/indirect 2/rm32/edx . . . 0/r32/eax . .
2628
2629 8a/copy-byte 0/mod/indirect 0/rm32/eax . . . 0/r32/AL . .
2630 81 4/subop/and 3/mod/direct 0/rm32/eax . . . . . 0xff/imm32
2631
2632 3d/compare-eax-and 0x38/imm32/8
2633 75/jump-if-!= $far-jump-or-call?:end/disp8
2634
2635 $far-jump-or-call?:return-true:
2636 bf/copy-to-edi 1/imm32/true
2637 $far-jump-or-call?:end:
2638
2639 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
2640
2641 5b/pop-to-ebx
2642 5a/pop-to-edx
2643 59/pop-to-ecx
2644 58/pop-to-eax
2645
2646 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2647 5d/pop-to-ebp
2648 c3/return
2649
2650
2651
2652 stream-add2:
2653
2654 55/push-ebp
2655 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2656
2657 50/push-eax
2658 51/push-ecx
2659 52/push-edx
2660 56/push-esi
2661
2662 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
2663
2664
2665 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
2666
2667 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 0/r32/eax 0xc/disp8 .
2668
2669
2670 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 8/disp8 .
2671
2672 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 2/index/edx . 2/r32/edx 0xc/disp8 .
2673
2674 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
2675 73/jump-if-addr>= $stream-add2:abort/disp8
2676
2677 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0xc/disp8 .
2678 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
2679
2680 05/add-to-eax 4/imm32
2681
2682 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
2683 73/jump-if-addr>= $stream-add2:abort/disp8
2684
2685 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x10/disp8 .
2686 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
2687
2688 05/add-to-eax 4/imm32
2689
2690 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
2691 73/jump-if-addr>= $stream-add2:abort/disp8
2692
2693 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x14/disp8 .
2694 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
2695
2696 81 0/subop/add 0/mod/indirect 6/rm32/esi . . . . . 0xc/imm32
2697 $stream-add2:end:
2698
2699 5e/pop-to-esi
2700 5a/pop-to-edx
2701 59/pop-to-ecx
2702 58/pop-to-eax
2703
2704 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2705 5d/pop-to-ebp
2706 c3/return
2707
2708 $stream-add2:abort:
2709
2710
2711 68/push "overflow in stream-add2\n"/imm32
2712 68/push 2/imm32/stderr
2713
2714 e8/call _write/disp32
2715
2716 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2717
2718 bb/copy-to-ebx 1/imm32
2719 e8/call syscall_exit/disp32
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729 trace-slsns:
2730
2731 55/push-ebp
2732 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2733
2734
2735 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
2736 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
2737
2738 e8/call write/disp32
2739
2740 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2741
2742
2743 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2744 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
2745
2746 e8/call write-slice/disp32
2747
2748 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2749
2750
2751 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
2752 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
2753
2754 e8/call write/disp32
2755
2756 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2757
2758
2759 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
2760 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
2761
2762 e8/call write-int32-hex/disp32
2763
2764 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2765
2766
2767 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
2768
2769 e8/call trace/disp32
2770
2771 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2772 $trace-slsns:end:
2773
2774 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2775 5d/pop-to-ebp
2776 c3/return
2777
2778 test-trace-slsns:
2779
2780 55/push-ebp
2781 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2782
2783
2784 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
2785 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
2786
2787 b8/copy-to-eax "b"/imm32
2788 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
2789 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
2790 05/add-to-eax 4/imm32
2791
2792 51/push-ecx
2793 50/push-eax
2794 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
2795
2796
2797 68/push " e"/imm32
2798 68/push 3/imm32
2799 68/push "c "/imm32
2800 53/push-ebx
2801 68/push "A"/imm32
2802
2803 e8/call trace-slsns/disp32
2804
2805 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
2806 +-- 26 lines: #? # dump *Trace-stream -----------------------------------------------------------------------------------------------------------------------------------------------
2832
2833
2834 68/push "F - test-trace-slsls"/imm32
2835 68/push "Abc 0x00000003 e"/imm32
2836
2837 e8/call check-trace-contains/disp32
2838
2839 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2840
2841 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2842 5d/pop-to-ebp
2843 c3/return
2844
2845 num-bytes:
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862 55/push-ebp
2863 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2864
2865 51/push-ecx
2866 52/push-edx
2867 53/push-ebx
2868
2869 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
2870
2871 68/push 0/imm32/end
2872 68/push 0/imm32/start
2873 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
2874 +-- 26 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------
2900
2901
2902 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
2903
2904 e8/call rewind-stream/disp32
2905
2906 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2907 $num-bytes:loop:
2908
2909
2910 51/push-ecx
2911 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
2912
2913 e8/call next-word/disp32
2914
2915 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2916 +-- 40 lines: #? # dump word-slice --------------------------------------------------------------------------------------------------------------------------------------------------
2956 $num-bytes:check0:
2957
2958
2959 50/push-eax
2960
2961
2962 51/push-ecx
2963
2964 e8/call slice-empty?/disp32
2965
2966 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2967
2968 3d/compare-eax-and 0/imm32/false
2969
2970 58/pop-to-eax
2971 75/jump-if-!= $num-bytes:end/disp8
2972 $num-bytes:check-for-comment:
2973
2974
2975 8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . .
2976
2977 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
2978 8a/copy-byte 0/mod/indirect 2/rm32/edx . . . 3/r32/BL . .
2979
2980 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x23/imm32/hash
2981 74/jump-if-= $num-bytes:end/disp8
2982 $num-bytes:check-for-label:
2983
2984
2985 8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 4/disp8 .
2986
2987 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
2988 8a/copy-byte 1/mod/*+disp8 2/rm32/edx . . . 3/r32/BL -1/disp8 .
2989
2990 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x3a/imm32/colon
2991 74/jump-if-= $num-bytes:end/disp8
2992 $num-bytes:check-for-segment-header:
2993
2994
2995 50/push-eax
2996
2997
2998 68/push "=="/imm32
2999 51/push-ecx
3000
3001 e8/call slice-equal?/disp32
3002
3003 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3004
3005 3d/compare-eax-and 0/imm32/false
3006
3007 58/pop-to-eax
3008 75/jump-if-!= $num-bytes:end/disp8
3009 $num-bytes:loop-body:
3010
3011
3012 89/copy 3/mod/direct 2/rm32/edx . . . 0/r32/eax . .
3013
3014
3015 51/push-ecx
3016
3017 e8/call compute-width-of-slice/disp32
3018
3019 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3020
3021 01/add 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
3022 e9/jump $num-bytes:loop/disp32
3023 $num-bytes:end:
3024
3025
3026 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
3027
3028 e8/call rewind-stream/disp32
3029
3030 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3031
3032 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3033
3034 5b/pop-to-ebx
3035 5a/pop-to-edx
3036 59/pop-to-ecx
3037
3038 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3039 5d/pop-to-ebp
3040 c3/return
3041
3042 test-num-bytes-handles-empty-string:
3043
3044
3045 55/push-ebp
3046 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3047
3048
3049
3050 68/push _test-input-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 68/push _test-output-stream/imm32
3058
3059 e8/call clear-stream/disp32
3060
3061 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3062
3063
3064
3065 68/push _test-input-stream/imm32
3066
3067 e8/call num-bytes/disp32
3068
3069 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3070
3071
3072 68/push "F - test-num-bytes-handles-empty-string"/imm32
3073 68/push 0/imm32/true
3074 50/push-eax
3075
3076 e8/call check-ints-equal/disp32
3077
3078 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3079
3080 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3081 5d/pop-to-ebp
3082 c3/return
3083
3084 test-num-bytes-ignores-comments:
3085
3086
3087 55/push-ebp
3088 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3089
3090
3091
3092 68/push _test-input-stream/imm32
3093
3094 e8/call clear-stream/disp32
3095
3096 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3097
3098
3099 68/push _test-output-stream/imm32
3100
3101 e8/call clear-stream/disp32
3102
3103 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3104
3105
3106
3107 68/push "# abcd"/imm32
3108 68/push _test-input-stream/imm32
3109
3110 e8/call write/disp32
3111
3112 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3113
3114
3115 68/push _test-input-stream/imm32
3116
3117 e8/call num-bytes/disp32
3118
3119 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3120
3121
3122 68/push "F - test-num-bytes-ignores-comments"/imm32
3123 68/push 0/imm32/true
3124 50/push-eax
3125
3126 e8/call check-ints-equal/disp32
3127
3128 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3129
3130 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3131 5d/pop-to-ebp
3132 c3/return
3133
3134 test-num-bytes-ignores-labels:
3135
3136
3137 55/push-ebp
3138 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3139
3140
3141
3142 68/push _test-input-stream/imm32
3143
3144 e8/call clear-stream/disp32
3145
3146 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3147
3148
3149 68/push _test-output-stream/imm32
3150
3151 e8/call clear-stream/disp32
3152
3153 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3154
3155
3156
3157 68/push "ab: # cd"/imm32
3158 68/push _test-input-stream/imm32
3159
3160 e8/call write/disp32
3161
3162 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3163
3164
3165 68/push _test-input-stream/imm32
3166
3167 e8/call num-bytes/disp32
3168
3169 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3170
3171
3172 68/push "F - test-num-bytes-ignores-labels"/imm32
3173 68/push 0/imm32/true
3174 50/push-eax
3175
3176 e8/call check-ints-equal/disp32
3177
3178 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3179
3180 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3181 5d/pop-to-ebp
3182 c3/return
3183
3184 test-num-bytes-ignores-segment-headers:
3185
3186
3187 55/push-ebp
3188 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3189
3190
3191
3192 68/push _test-input-stream/imm32
3193
3194 e8/call clear-stream/disp32
3195
3196 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3197
3198
3199 68/push _test-output-stream/imm32
3200
3201 e8/call clear-stream/disp32
3202
3203 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3204
3205
3206
3207 68/push "== ab cd"/imm32
3208 68/push _test-input-stream/imm32
3209
3210 e8/call write/disp32
3211
3212 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3213
3214
3215 68/push _test-input-stream/imm32
3216
3217 e8/call num-bytes/disp32
3218
3219 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3220
3221
3222 68/push "F - test-num-bytes-ignores-segment-headers"/imm32
3223 68/push 0/imm32/true
3224 50/push-eax
3225
3226 e8/call check-ints-equal/disp32
3227
3228 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3229
3230 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3231 5d/pop-to-ebp
3232 c3/return
3233
3234 test-num-bytes-counts-words-by-default:
3235
3236
3237 55/push-ebp
3238 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3239
3240
3241
3242 68/push _test-input-stream/imm32
3243
3244 e8/call clear-stream/disp32
3245
3246 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3247
3248
3249 68/push _test-output-stream/imm32
3250
3251 e8/call clear-stream/disp32
3252
3253 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3254
3255
3256
3257 68/push "ab cd ef"/imm32
3258 68/push _test-input-stream/imm32
3259
3260 e8/call write/disp32
3261
3262 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3263
3264
3265 68/push _test-input-stream/imm32
3266
3267 e8/call num-bytes/disp32
3268
3269 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3270
3271
3272 68/push "F - test-num-bytes-counts-words-by-default"/imm32
3273 68/push 3/imm32/true
3274 50/push-eax
3275
3276 e8/call check-ints-equal/disp32
3277
3278 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3279
3280 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3281 5d/pop-to-ebp
3282 c3/return
3283
3284 test-num-bytes-ignores-trailing-comment:
3285
3286
3287 55/push-ebp
3288 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3289
3290
3291
3292 68/push _test-input-stream/imm32
3293
3294 e8/call clear-stream/disp32
3295
3296 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3297
3298
3299 68/push _test-output-stream/imm32
3300
3301 e8/call clear-stream/disp32
3302
3303 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3304
3305
3306
3307 68/push "ab cd # ef"/imm32
3308 68/push _test-input-stream/imm32
3309
3310 e8/call write/disp32
3311
3312 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3313
3314
3315 68/push _test-input-stream/imm32
3316
3317 e8/call num-bytes/disp32
3318
3319 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3320
3321
3322 68/push "F - test-num-bytes-ignores-trailing-comment"/imm32
3323 68/push 2/imm32/true
3324 50/push-eax
3325
3326 e8/call check-ints-equal/disp32
3327
3328 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3329
3330 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3331 5d/pop-to-ebp
3332 c3/return
3333
3334 test-num-bytes-handles-imm32:
3335
3336
3337 55/push-ebp
3338 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
3339
3340
3341
3342 68/push _test-input-stream/imm32
3343
3344 e8/call clear-stream/disp32
3345
3346 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3347
3348
3349 68/push _test-output-stream/imm32
3350
3351 e8/call clear-stream/disp32
3352
3353 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3354
3355
3356
3357 68/push "ab cd/imm32 ef"/imm32
3358 68/push _test-input-stream/imm32
3359
3360 e8/call write/disp32
3361
3362 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
3363
3364
3365 68/push _test-input-stream/imm32
3366
3367 e8/call num-bytes/disp32
3368
3369 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
3370
3371
3372 68/push "F - test-num-bytes-handles-imm32"/imm32
3373 68/push 6/imm32/true
3374 50/push-eax
3375
3376 e8/call check-ints-equal/disp32
3377
3378 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
3379
3380 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
3381 5d/pop-to-ebp
3382 c3/return
3383
3384