https://github.com/akkartik/mu/blob/master/subx/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 == code
36
37
38
39
40 Entry:
41
42
43 68/push Heap/imm32
44 68/push 0x10000/imm32/64KB
45
46 e8/call new-segment/disp32
47
48 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
49
50
51 68/push 0x40000/imm32/256KB
52
53 e8/call initialize-trace-stream/disp32
54
55 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
56
57
58
59 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
60
61
62
63 81 7/subop/compare 1/mod/*+disp8 5/rm32/EBP . . . . 0/disp8 1/imm32
64 7e/jump-if-lesser-or-equal $run-main/disp8
65
66
67 68/push "test"/imm32
68 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
69
70 e8/call kernel-string-equal?/disp32
71
72 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
73
74 3d/compare-EAX-and 1/imm32
75 75/jump-if-not-equal $run-main/disp8
76
77 e8/call run-tests/disp32
78 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32
79 eb/jump $main:end/disp8
80 $run-main:
81
82
83 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
84 89/copy 3/mod/direct 0/rm32/EAX . . . 4/r32/ESP . .
85
86
87 c7 0/subop/copy 0/mod/direct 0/rm32/EAX . . . . . 0/imm32
88
89
90 50/push-EAX/ed
91 68/push Stderr/imm32
92 68/push Stdout/imm32
93 68/push Stdin/imm32
94
95 e8/call convert/disp32
96
97 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
98
99 bb/copy-to-EBX 0/imm32
100 $main:end:
101 b8/copy-to-EAX 1/imm32/exit
102 cd/syscall 0x80/imm8
103
104
105
106
107
108
109
110
111 convert:
112
113
114
115
116
117
118
119
120
121 55/push-EBP
122 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
123
124 51/push-ECX
125 52/push-EDX
126
127 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 0xa0/imm32
128 68/push 0xa0/imm32/length
129 68/push 0/imm32/read
130 68/push 0/imm32/write
131 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
132
133 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 0x2000/imm32
134 68/push 0x2000/imm32/length
135 68/push 0/imm32/read
136 68/push 0/imm32/write
137 89/copy 3/mod/direct 2/rm32/EDX . . . 4/r32/ESP . .
138 +-- 9 lines: #? # write(2/stderr, "compute-offsets\n") --------------------------------------------------------------------------------------------------
147
148
149 52/push-EDX
150 51/push-ECX
151 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
152
153 e8/call compute-offsets/disp32
154
155 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
156 +-- 9 lines: #? # write(2/stderr, "compute-addresses\n") ------------------------------------------------------------------------------------------------
165
166
167 52/push-EDX
168 51/push-ECX
169
170 e8/call compute-addresses/disp32
171
172 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x8/imm32
173
174
175 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
176
177 e8/call rewind-stream/disp32
178
179 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
180 +-- 9 lines: #? # write(2/stderr, "emit-output\n") ------------------------------------------------------------------------------------------------------
189 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
215 +-- 46 lines: #? # dump labels->write --------------------------------------------------------------------------------------------------------------------
261
262
263 52/push-EDX
264 51/push-ECX
265 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
266 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
267
268 e8/call emit-output/disp32
269
270 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
271 $convert:end:
272
273 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x214/imm32
274
275 5a/pop-to-EDX
276 59/pop-to-ECX
277
278 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
279 5d/pop-to-EBP
280 c3/return
281
282 test-convert-computes-addresses:
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298 55/push-EBP
299 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
300
301
302
303 68/push _test-input-stream/imm32
304
305 e8/call clear-stream/disp32
306
307 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
308
309
310 b8/copy-to-EAX _test-input-buffered-file/imm32
311 05/add-to-EAX 4/imm32
312 50/push-EAX
313
314 e8/call clear-stream/disp32
315
316 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
317
318
319 68/push _test-output-stream/imm32
320
321 e8/call clear-stream/disp32
322
323 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
324
325
326 b8/copy-to-EAX _test-output-buffered-file/imm32
327 05/add-to-EAX 4/imm32
328 50/push-EAX
329
330 e8/call clear-stream/disp32
331
332 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
333
334
335
336 68/push "== code 0x1\n"/imm32
337 68/push _test-input-stream/imm32
338
339 e8/call write/disp32
340
341 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
342
343
344 68/push "Entry:\n"/imm32
345 68/push _test-input-stream/imm32
346
347 e8/call write/disp32
348
349 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
350
351
352 68/push "ab x/imm32\n"/imm32
353 68/push _test-input-stream/imm32
354
355 e8/call write/disp32
356
357 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
358
359
360 68/push "== data 0x1000\n"/imm32
361 68/push _test-input-stream/imm32
362
363 e8/call write/disp32
364
365 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
366
367
368 68/push "x:\n"/imm32
369 68/push _test-input-stream/imm32
370
371 e8/call write/disp32
372
373 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
374
375
376 68/push "01\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 _test-output-buffered-file/imm32
385 68/push _test-input-buffered-file/imm32
386
387 e8/call convert/disp32
388
389 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
390
391 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
417
418
419 68/push "F - test-convert-computes-addresses/0"/imm32
420 68/push "label 'x' is at address 0x00001079."/imm32
421
422 e8/call check-trace-contains/disp32
423
424 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
425
426
427 68/push "F - test-convert-computes-addresses/1"/imm32
428 68/push "segment 'code' starts at address 0x00000074."/imm32
429
430 e8/call check-trace-contains/disp32
431
432 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
433
434
435 68/push "F - test-convert-computes-addresses/2"/imm32
436 68/push "segment 'code' has size 0x00000005."/imm32
437
438 e8/call check-trace-contains/disp32
439
440 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
441
442
443 68/push "F - test-convert-computes-addresses/3"/imm32
444 68/push "segment 'data' starts at address 0x00001079."/imm32
445
446 e8/call check-trace-contains/disp32
447
448 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
449
450 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
451 5d/pop-to-EBP
452 c3/return
453
454
455 == data
456
457 compute-offsets:file-offset:
458 0/imm32
459 compute-offsets:segment-offset:
460 0/imm32
461 compute-offsets:word-slice:
462 0/imm32/start
463 0/imm32/end
464 compute-offsets:segment-tmp:
465 0/imm32/start
466 0/imm32/end
467
468 == code
469
470 compute-offsets:
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
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525 55/push-EBP
526 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
527
528 50/push-EAX
529 51/push-ECX
530 52/push-EDX
531 53/push-EBX
532 56/push-ESI
533 57/push-EDI
534
535 31/xor 3/mod/direct 6/rm32/ESI . . . 6/r32/ESI . .
536
537 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:file-offset/disp32 0/imm32
538
539 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:segment-offset/disp32 0/imm32
540
541
542
543 68/push 1/imm32
544 68/push 0x200/imm32
545 68/push Heap/imm32
546
547 e8/call new-stream/disp32
548
549 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
550
551 89/copy 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
552 $compute-offsets:line-loop:
553
554 51/push-ECX
555 e8/call clear-stream/disp32
556
557 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
558
559 51/push-ECX
560 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
561 e8/call read-line-buffered/disp32
562
563 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
564
565 8b/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
566 3d/compare-EAX-and 0/imm32
567 0f 84/jump-if-equal $compute-offsets:break-line-loop/disp32
568 $compute-offsets:word-loop:
569
570 ba/copy-to-EDX compute-offsets:word-slice/imm32
571
572 52/push-EDX
573 51/push-ECX
574 e8/call next-word/disp32
575
576 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
577 +-- 80 lines: #? # dump word-slice and maybe curr-segment-name -------------------------------------------------------------------------------------------
657 $compute-offsets:check0:
658
659
660 52/push-EDX
661 e8/call slice-empty?/disp32
662
663 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
664
665 3d/compare-EAX-and 0/imm32
666 0f 85/jump-if-not-equal $compute-offsets:line-loop/disp32
667
668 68/push "#"/imm32
669 52/push-EDX
670 e8/call slice-starts-with?/disp32
671
672 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
673
674 3d/compare-EAX-and 0/imm32
675 0f 85/jump-if-not-equal $compute-offsets:word-loop/disp32
676 $compute-offsets:case-segment-header:
677
678
679 68/push "=="/imm32
680 52/push-EDX
681 e8/call slice-equal?/disp32
682
683 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
684
685 3d/compare-EAX-and 0/imm32
686 0f 84/jump-if-equal $compute-offsets:case-label/disp32
687
688 81 7/subop/compare 3/mod/direct 6/rm32/ESI . . . . . 0/imm32
689 74/jump-if-equal $compute-offsets:construct-next-segment/disp8
690
691
692 68/push 0x10/imm32/row-size
693 56/push-ESI
694 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
695
696 e8/call get-or-insert/disp32
697
698 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
699
700
701 51/push-ECX
702
703 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX compute-offsets:file-offset/disp32
704
705 8b/copy 1/mod/*+disp8 0/rm32/EAX . . . 1/r32/ECX 4/disp8 .
706
707 29/subtract 3/mod/direct 3/rm32/EBX . . . 1/r32/ECX . .
708
709 89/copy 1/mod/*+disp8 0/rm32/EAX . . . 3/r32/EBX 8/disp8 .
710
711 59/pop-to-ECX
712
713
714 68/push "."/imm32
715 53/push-EBX
716 68/push "' has size "/imm32
717 56/push-ESI
718 68/push "segment '"/imm32
719
720 e8/call trace-sssns/disp32
721
722 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
723 $compute-offsets:construct-next-segment:
724
725 68/push compute-offsets:segment-tmp/imm32
726 51/push-ECX
727 e8/call next-word/disp32
728
729 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
730 +-- 47 lines: #? # dump curr-segment-name if not null (clobbering EAX) -----------------------------------------------------------------------------------
777 $compute-offsets:update-curr-segment-name:
778
779
780
781 68/push compute-offsets:segment-tmp/imm32
782 68/push Heap/imm32
783
784 e8/call slice-to-string/disp32
785
786 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
787
788 89/copy 3/mod/direct 6/rm32/ESI . . . 0/r32/EAX . .
789
790
791 3d/compare-EAX-and 0/imm32
792 0f 84/jump-if-equal $compute-offsets:abort/disp32
793
794 68/push compute-offsets:segment-tmp/imm32
795 51/push-ECX
796 e8/call next-word/disp32
797
798 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
799
800
801 68/push compute-offsets:segment-tmp/imm32
802 e8/call slice-empty?/disp32
803
804 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
805
806 3d/compare-EAX-and 0/imm32
807 0f 85/jump-if-not-equal $compute-offsets:abort/disp32
808
809
810 68/push 0x10/imm32/row-size
811 56/push-ESI
812 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
813
814 e8/call get-or-insert/disp32
815
816 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
817
818 89/copy 3/mod/direct 3/rm32/EBX . . . 0/r32/EAX . .
819
820
821 68/push compute-offsets:segment-tmp/imm32
822 e8/call parse-hex-int/disp32
823
824 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
825
826 89/copy 0/mod/indirect 3/rm32/EBX . . . 0/r32/EAX . .
827
828 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX compute-offsets:file-offset/disp32
829 89/copy 1/mod/*+disp8 3/rm32/EBX . . . 0/r32/EAX 4/disp8 .
830
831
832 68/push "."/imm32
833 50/push-EAX
834 68/push "' is at file offset "/imm32
835 56/push-ESI
836 68/push "segment '"/imm32
837
838 e8/call trace-sssns/disp32
839
840 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
841
842 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:segment-offset/disp32 0/imm32
843
844 e9/jump $compute-offsets:line-loop/disp32
845 $compute-offsets:case-label:
846
847
848
849 52/push-EDX
850
851 e8/call is-label?/disp32
852
853 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
854
855 3d/compare-EAX-and 0/imm32
856 74/jump-if-equal $compute-offsets:case-default/disp8
857
858 ff 1/subop/decrement 1/mod/*+disp8 2/rm32/EDX . . . . 4/disp8 .
859
860
861 68/push 0x10/imm32/row-size
862 52/push-EDX
863 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
864
865 e8/call leaky-get-or-insert-slice/disp32
866
867 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
868 $compute-offsets:save-label-offset:
869
870 89/copy 0/mod/indirect 0/rm32/EAX . . . 6/r32/ESI . .
871
872
873 68/push "'."/imm32
874 56/push-ESI
875 68/push "' is in segment '"/imm32
876 52/push-EDX
877 68/push "label '"/imm32
878
879 e8/call trace-slsss/disp32
880
881 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
882
883
884 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX compute-offsets:segment-offset/disp32
885
886 89/copy 1/mod/*+disp8 0/rm32/EAX . . . 3/r32/EBX 4/disp8 .
887
888
889 b8/copy-to-EAX compute-offsets:segment-offset/imm32
890
891 8b/copy 0/mod/indirect 0/rm32/EAX . . . 0/r32/EAX . .
892
893 68/push "."/imm32
894 50/push-EAX
895 68/push "' is at segment offset "/imm32
896 52/push-EDX
897 68/push "label '"/imm32
898
899 e8/call trace-slsns/disp32
900
901 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
902
903 e9/jump $compute-offsets:word-loop/disp32
904 $compute-offsets:case-default:
905
906
907 52/push-EDX
908
909 e8/call compute-width-of-slice/disp32
910
911 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
912
913 01/add 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX compute-offsets:segment-offset/disp32
914
915 01/add 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX compute-offsets:file-offset/disp32
916 +-- 47 lines: #? # dump segment-offset -------------------------------------------------------------------------------------------------------------------
963 e9/jump $compute-offsets:word-loop/disp32
964 $compute-offsets:break-line-loop:
965
966
967 68/push 0x10/imm32/row-size
968 56/push-ESI
969 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
970
971 e8/call get-or-insert/disp32
972
973 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
974
975
976 51/push-ECX
977
978 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX compute-offsets:file-offset/disp32
979
980 8b/copy 1/mod/*+disp8 0/rm32/EAX . . . 1/r32/ECX 4/disp8 .
981
982 29/subtract 3/mod/direct 3/rm32/EBX . . . 1/r32/ECX . .
983
984 89/copy 1/mod/*+disp8 0/rm32/EAX . . . 3/r32/EBX 8/disp8 .
985
986 59/pop-to-ECX
987
988
989
990 68/push "."/imm32
991 53/push-EBX
992 68/push "' has size "/imm32
993 56/push-ESI
994 68/push "segment '"/imm32
995
996 e8/call trace-sssns/disp32
997
998 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
999 $compute-offsets:end:
1000
1001
1002 5f/pop-to-EDI
1003 5e/pop-to-ESI
1004 5b/pop-to-EBX
1005 5a/pop-to-EDX
1006 59/pop-to-ECX
1007 58/pop-to-EAX
1008
1009 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1010 5d/pop-to-EBP
1011 c3/return
1012 $compute-offsets:abort:
1013
1014
1015 68/push "'==' must be followed by segment name and segment-start\n"/imm32
1016 68/push 2/imm32/stderr
1017
1018 e8/call _write/disp32
1019
1020 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1021
1022 bb/copy-to-EBX 1/imm32
1023 b8/copy-to-EAX 1/imm32/exit
1024 cd/syscall 0x80/imm8
1025
1026
1027 test-compute-offsets:
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045 55/push-EBP
1046 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1047
1048
1049
1050 68/push _test-input-stream/imm32
1051
1052 e8/call clear-stream/disp32
1053
1054 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1055
1056
1057 b8/copy-to-EAX _test-input-buffered-file/imm32
1058 05/add-to-EAX 4/imm32
1059 50/push-EAX
1060
1061 e8/call clear-stream/disp32
1062
1063 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1064
1065
1066 68/push _test-output-stream/imm32
1067
1068 e8/call clear-stream/disp32
1069
1070 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1071
1072
1073 b8/copy-to-EAX _test-output-buffered-file/imm32
1074 05/add-to-EAX 4/imm32
1075 50/push-EAX
1076
1077 e8/call clear-stream/disp32
1078
1079 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1080
1081 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 0x20/imm32
1082 68/push 0x20/imm32/length
1083 68/push 0/imm32/read
1084 68/push 0/imm32/write
1085 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1086
1087 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 0x20/imm32
1088 68/push 0x20/imm32/length
1089 68/push 0/imm32/read
1090 68/push 0/imm32/write
1091 89/copy 3/mod/direct 2/rm32/EDX . . . 4/r32/ESP . .
1092
1093
1094
1095 68/push "== code 0x1\n"/imm32
1096 68/push _test-input-stream/imm32
1097
1098 e8/call write/disp32
1099
1100 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1101
1102
1103 68/push "ab x/imm32\n"/imm32
1104 68/push _test-input-stream/imm32
1105
1106 e8/call write/disp32
1107
1108 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1109
1110
1111 68/push "== data 0x1000\n"/imm32
1112 68/push _test-input-stream/imm32
1113
1114 e8/call write/disp32
1115
1116 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1117
1118
1119 68/push "00\n"/imm32
1120 68/push _test-input-stream/imm32
1121
1122 e8/call write/disp32
1123
1124 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1125
1126
1127 68/push "x:\n"/imm32
1128 68/push _test-input-stream/imm32
1129
1130 e8/call write/disp32
1131
1132 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1133
1134
1135 68/push "34\n"/imm32
1136 68/push _test-input-stream/imm32
1137
1138 e8/call write/disp32
1139
1140 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1141
1142
1143 52/push-EDX
1144 51/push-ECX
1145 68/push _test-input-buffered-file/imm32
1146
1147 e8/call compute-offsets/disp32
1148
1149 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1150 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
1176
1177
1178
1179 68/push "F - test-compute-offsets/0"/imm32
1180 68/push "segment 'code' is at file offset 0x00000000."/imm32
1181
1182 e8/call check-trace-contains/disp32
1183
1184 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1185
1186
1187 68/push "F - test-compute-offsets/1"/imm32
1188 68/push "segment 'code' has size 0x00000005."/imm32
1189
1190 e8/call check-trace-contains/disp32
1191
1192 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1193
1194
1195 68/push "F - test-compute-offsets/2"/imm32
1196 68/push "segment 'data' is at file offset 0x00000005."/imm32
1197
1198 e8/call check-trace-contains/disp32
1199
1200 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1201
1202
1203 68/push "F - test-compute-offsets/3"/imm32
1204 68/push "segment 'data' has size 0x00000002."/imm32
1205
1206 e8/call check-trace-contains/disp32
1207
1208 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1209
1210
1211 68/push "F - test-compute-offsets/4"/imm32
1212 68/push "label 'x' is in segment 'data'."/imm32
1213
1214 e8/call check-trace-contains/disp32
1215
1216 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1217
1218
1219 68/push "F - test-compute-offsets/5"/imm32
1220 68/push "label 'x' is at segment offset 0x00000001."/imm32
1221
1222 e8/call check-trace-contains/disp32
1223
1224 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1225
1226
1227 68/push "F - test-compute-offsets-maintains-labels-write-index"/imm32
1228 68/push 0x10/imm32/1-entry
1229 ff 6/subop/push 0/mod/indirect 2/rm32/EDX . . . . . .
1230
1231 e8/call check-ints-equal/disp32
1232
1233 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1234
1235 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1236 5d/pop-to-EBP
1237 c3/return
1238
1239 compute-addresses:
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263 55/push-EBP
1264 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1265
1266 50/push-EAX
1267 51/push-ECX
1268 52/push-EDX
1269 53/push-EBX
1270 56/push-ESI
1271 57/push-EDI
1272
1273 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
1274
1275
1276 8b/copy 0/mod/indirect 6/rm32/ESI . . . 7/r32/EDI . .
1277 c1/shift 5/subop/logic-right 3/mod/direct 7/rm32/EDI . . . . . 4/imm8
1278
1279 c1/shift 4/subop/left 3/mod/direct 7/rm32/EDI . . . . . 5/imm8
1280 81 0/subop/add 3/mod/direct 7/rm32/EDI . . . . . 0x34/imm32
1281
1282 8d/copy-address 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 0xc/disp8 .
1283
1284 8b/copy 0/mod/indirect 6/rm32/ESI . . . 1/r32/ECX . .
1285 01/add 3/mod/direct 1/rm32/ECX . . . 6/r32/ESI . .
1286 $compute-addresses:segment-loop:
1287
1288 39/compare 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
1289 73/jump-if-greater-or-equal-unsigned $compute-addresses:segment-break/disp8
1290
1291 01/add 1/mod/*+disp8 0/rm32/EAX . . . 7/r32/EDI 8/disp8 .
1292
1293
1294 8b/copy 1/mod/*+disp8 0/rm32/EAX . . . 2/r32/EDX 4/disp8 .
1295
1296 81 4/subop/and 3/mod/direct 2/rm32/EDX . . . . . 0xfffff000/imm32
1297
1298
1299 8b/copy 1/mod/*+disp8 0/rm32/EAX . . . 3/r32/EBX 8/disp8 .
1300
1301 81 4/subop/and 3/mod/direct 3/rm32/EBX . . . . . 0x00000fff/imm32
1302
1303 09/or 3/mod/direct 2/rm32/EDX . . . 3/r32/EBX . .
1304 89/copy 1/mod/*+disp8 0/rm32/EAX . . . 2/r32/EDX 4/disp8 .
1305
1306
1307 68/push "."/imm32
1308 52/push-EDX
1309 68/push "' starts at address "/imm32
1310 ff 6/subop/push 0/mod/indirect 0/rm32/EAX . . . . . .
1311 68/push "segment '"/imm32
1312
1313 e8/call trace-sssns/disp32
1314
1315 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
1316
1317 05/add-to-EAX 0x10/imm32
1318 eb/jump $compute-addresses:segment-loop/disp8
1319 $compute-addresses:segment-break:
1320 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
1346
1347 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 0xc/disp8 .
1348
1349 8d/copy-address 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 0xc/disp8 .
1350
1351 8b/copy 0/mod/indirect 6/rm32/ESI . . . 1/r32/ECX . .
1352 01/add 3/mod/direct 1/rm32/ECX . . . 6/r32/ESI . .
1353 $compute-addresses:label-loop:
1354
1355 39/compare 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
1356 0f 83/jump-if-greater-or-equal-unsigned $compute-addresses:end/disp32
1357 +-- 26 lines: #? # dump lrow->key ------------------------------------------------------------------------------------------------------------------------
1383
1384 8b/copy 1/mod/*+disp8 0/rm32/EAX . . . 2/r32/EDX 4/disp8 .
1385 +-- 26 lines: #? # dump seg-name -------------------------------------------------------------------------------------------------------------------------
1411
1412
1413 50/push-EAX
1414
1415
1416 68/push 0x10/imm32/row-size
1417 52/push-EDX
1418 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1419
1420 e8/call get/disp32
1421
1422 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1423
1424 89/copy 3/mod/direct 2/rm32/EDX . . . 0/r32/EAX . .
1425
1426 58/pop-to-EAX
1427
1428 8b/copy 0/mod/indirect 2/rm32/EDX . . . 3/r32/EBX . .
1429
1430 03/add 1/mod/*+disp8 0/rm32/EAX . . . 3/r32/EBX 8/disp8 .
1431
1432 89/copy 1/mod/*+disp8 0/rm32/EAX . . . 3/r32/EBX 0xc/disp8 .
1433
1434
1435 68/push "."/imm32
1436 53/push-EBX
1437 68/push "' is at address "/imm32
1438 ff 6/subop/push 0/mod/indirect 0/rm32/EAX . . . . . .
1439 68/push "label '"/imm32
1440
1441 e8/call trace-sssns/disp32
1442
1443 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
1444
1445 05/add-to-EAX 0x10/imm32
1446 e9/jump $compute-addresses:label-loop/disp32
1447 $compute-addresses:end:
1448
1449 5f/pop-to-EDI
1450 5e/pop-to-ESI
1451 5b/pop-to-EBX
1452 5a/pop-to-EDX
1453 59/pop-to-ECX
1454 58/pop-to-EAX
1455
1456 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1457 5d/pop-to-EBP
1458 c3/return
1459
1460 test-compute-addresses:
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478 55/push-EBP
1479 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1480
1481
1482 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 0xa0/imm32
1483 68/push 0xa0/imm32/length
1484 68/push 0/imm32/read
1485 68/push 0/imm32/write
1486 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1487
1488 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 0x2000/imm32
1489 68/push 0x2000/imm32/length
1490 68/push 0/imm32/read
1491 68/push 0/imm32/write
1492 89/copy 3/mod/direct 2/rm32/EDX . . . 4/r32/ESP . .
1493
1494 68/push 5/imm32/segment-size
1495 68/push 0/imm32/file-offset
1496 68/push 0x1000/imm32/start-address
1497 68/push "a"/imm32/segment-name
1498 51/push-ECX
1499
1500 e8/call stream-add4/disp32
1501
1502 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
1503
1504 68/push 1/imm32/segment-size
1505 68/push 5/imm32/file-offset
1506 68/push 0x2018/imm32/start-address
1507 68/push "b"/imm32/segment-name
1508 51/push-ECX
1509
1510 e8/call stream-add4/disp32
1511
1512 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
1513
1514 68/push 0xc/imm32/segment-size
1515 68/push 6/imm32/file-offset
1516 68/push 0x5444/imm32/start-address
1517 68/push "c"/imm32/segment-name
1518 51/push-ECX
1519
1520 e8/call stream-add4/disp32
1521
1522 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
1523
1524 68/push 0/imm32/label-address
1525 68/push 3/imm32/segment-offset
1526 68/push "a"/imm32/segment-name
1527 68/push "l1"/imm32/label-name
1528 52/push-EDX
1529
1530 e8/call stream-add4/disp32
1531
1532 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
1533
1534 68/push 0/imm32/label-address
1535 68/push 0/imm32/segment-offset
1536 68/push "b"/imm32/segment-name
1537 68/push "l2"/imm32/label-name
1538 52/push-EDX
1539
1540 e8/call stream-add4/disp32
1541
1542 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
1543
1544
1545
1546 52/push-EDX
1547 51/push-ECX
1548
1549 e8/call compute-addresses/disp32
1550
1551 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1552
1553 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
1579
1580
1581 68/push "F - test-compute-addresses/0"/imm32
1582 68/push "segment 'a' starts at address 0x00001094."/imm32
1583
1584 e8/call check-trace-contains/disp32
1585
1586 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1587
1588
1589 68/push "F - test-compute-addresses/1"/imm32
1590 68/push "segment 'b' starts at address 0x00002099."/imm32
1591
1592 e8/call check-trace-contains/disp32
1593
1594 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1595
1596
1597 68/push "F - test-compute-addresses/2"/imm32
1598 68/push "segment 'c' starts at address 0x0000509a."/imm32
1599
1600 e8/call check-trace-contains/disp32
1601
1602 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1603
1604
1605 68/push "F - test-compute-addresses/3"/imm32
1606 68/push "label 'l1' is at address 0x00001097."/imm32
1607
1608 e8/call check-trace-contains/disp32
1609
1610 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1611
1612
1613 68/push "F - test-compute-addresses/4"/imm32
1614 68/push "label 'l2' is at address 0x00002099."/imm32
1615
1616 e8/call check-trace-contains/disp32
1617
1618 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1619
1620
1621 68/push "F - test-compute-addresses-maintains-labels-write-index"/imm32
1622 68/push 0x20/imm32/2-entries
1623 ff 6/subop/push 0/mod/indirect 2/rm32/EDX . . . . . .
1624
1625 e8/call check-ints-equal/disp32
1626
1627 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1628
1629 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1630 5d/pop-to-EBP
1631 c3/return
1632
1633 emit-output:
1634
1635
1636
1637
1638
1639 55/push-EBP
1640 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1641 +-- 9 lines: #? # write(2/stderr, "emit-headers\n") -----------------------------------------------------------------------------------------------------
1650
1651
1652 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x14/disp8 .
1653 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
1654 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
1655
1656 e8/call emit-headers/disp32
1657
1658 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1659 +-- 9 lines: #? # write(2/stderr, "emit-segments\n") ----------------------------------------------------------------------------------------------------
1668
1669
1670 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x14/disp8 .
1671 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
1672 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
1673 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1674
1675 e8/call emit-segments/disp32
1676
1677 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
1678 $emit-output:end:
1679
1680 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1681 5d/pop-to-EBP
1682 c3/return
1683
1684 emit-segments:
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733 55/push-EBP
1734 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1735
1736 50/push-EAX
1737 51/push-ECX
1738 52/push-EDX
1739 53/push-EBX
1740 56/push-ESI
1741 57/push-EDI
1742
1743 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 0x200/imm32
1744 68/push 0x200/imm32/length
1745 68/push 0/imm32/read
1746 68/push 0/imm32/write
1747 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1748
1749 68/push 0/imm32/end
1750 68/push 0/imm32/start
1751 89/copy 3/mod/direct 2/rm32/EDX . . . 4/r32/ESP . .
1752
1753 68/push 0/imm32/end
1754 68/push 0/imm32/start
1755 89/copy 3/mod/direct 7/rm32/EDI . . . 4/r32/ESP . .
1756
1757 31/xor 3/mod/direct 3/rm32/EBX . . . 3/r32/EBX . .
1758 $emit-segments:line-loop:
1759
1760
1761 51/push-ECX
1762
1763 e8/call clear-stream/disp32
1764
1765 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1766
1767
1768 51/push-ECX
1769 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1770
1771 e8/call read-line-buffered/disp32
1772
1773 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1774 +-- 33 lines: #? # dump line -----------------------------------------------------------------------------------------------------------------------------
1807 $emit-segments:check0:
1808
1809 81 7/subop/compare 0/mod/indirect 1/rm32/ECX . . . . . 0/imm32
1810 0f 84/jump-if-equal $emit-segments:end/disp32
1811
1812
1813
1814 51/push-ECX
1815
1816 e8/call num-bytes/disp32
1817
1818 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1819
1820 89/copy 3/mod/direct 3/rm32/EBX . . . 0/r32/EAX . .
1821 $emit-segments:word-loop:
1822
1823
1824 52/push-EDX
1825 51/push-ECX
1826
1827 e8/call next-word/disp32
1828
1829 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1830 +-- 33 lines: #? # dump word-slice -----------------------------------------------------------------------------------------------------------------------
1863 $emit-segments:check1:
1864
1865
1866
1867 52/push-EDX
1868
1869 e8/call slice-empty?/disp32
1870
1871 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1872
1873 3d/compare-EAX-and 0/imm32
1874 0f 85/jump-if-not-equal $emit-segments:next-line/disp32
1875 $emit-segments:check-for-comment:
1876
1877
1878 8b/copy 0/mod/indirect 2/rm32/EDX . . . 6/r32/ESI . .
1879
1880 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
1881 8a/copy-byte 0/mod/indirect 6/rm32/ESI . . . 0/r32/AL . .
1882
1883 3d/compare-EAX-and 0x23/imm32/hash
1884 0f 84/jump-if-equal $emit-segments:next-line/disp32
1885 $emit-segments:check-for-label:
1886
1887
1888
1889 52/push-EDX
1890
1891 e8/call is-label?/disp32
1892
1893 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1894
1895 3d/compare-EAX-and 0/imm32
1896 0f 85/jump-if-not-equal $emit-segments:line-loop/disp32
1897 $emit-segments:check-for-segment-header:
1898
1899
1900
1901 68/push "=="/imm32
1902 52/push-EDX
1903
1904 e8/call slice-equal?/disp32
1905
1906 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1907
1908 3d/compare-EAX-and 0/imm32
1909 0f 85/jump-if-not-equal $emit-segments:line-loop/disp32
1910 $emit-segments:2-character:
1911
1912
1913 8b/copy 1/mod/*+disp8 2/rm32/EDX . . . 0/r32/EAX 4/disp8 .
1914 2b/subtract 0/mod/indirect 2/rm32/EDX . . . 0/r32/EAX . .
1915
1916 3d/compare-EAX-and 2/imm32
1917 75/jump-if-not-equal $emit-segments:check-metadata/disp8
1918
1919
1920 52/push-EDX
1921 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
1922
1923 e8/call write-slice-buffered/disp32
1924
1925 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1926
1927
1928 68/push " "/imm32
1929 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
1930
1931 e8/call write-buffered/disp32
1932
1933 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1934
1935 e9/jump $emit-segments:word-loop/disp32
1936 $emit-segments:check-metadata:
1937
1938
1939
1940 57/push-EDI
1941 68/push 0x2f/imm32/slash
1942 ff 6/subop/push 1/mod/*+disp8 2/rm32/EDX . . . . 4/disp8 .
1943 ff 6/subop/push 0/mod/indirect 2/rm32/EDX . . . . . .
1944
1945 e8/call next-token-from-slice/disp32
1946
1947 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
1948 +-- 33 lines: #? # dump word-slice -----------------------------------------------------------------------------------------------------------------------
1981
1982
1983
1984 68/push 0x10/imm32/row-size
1985 57/push-EDI
1986 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x14/disp8 .
1987
1988 e8/call get-slice/disp32
1989
1990 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1991
1992 89/copy 3/mod/direct 6/rm32/ESI . . . 0/r32/EAX . .
1993 $emit-segments:check-for-imm8:
1994
1995
1996
1997 68/push "imm8"/imm32
1998 52/push-EDX
1999
2000 e8/call has-metadata?/disp32
2001
2002 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2003
2004 3d/compare-EAX-and 0/imm32
2005 0f 85/jump-if-not-equal $emit-segments:imm8-abort/disp32
2006 $emit-segments:check-for-imm32:
2007
2008
2009
2010 68/push "imm32"/imm32
2011 52/push-EDX
2012
2013 e8/call has-metadata?/disp32
2014
2015 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2016
2017 3d/compare-EAX-and 0/imm32
2018 74/jump-if-equal $emit-segments:check-for-disp8/disp8
2019 +-- 33 lines: #? # dump info->address --------------------------------------------------------------------------------------------------------------------
2052
2053
2054 68/push 4/imm32
2055 ff 6/subop/push 1/mod/*+disp8 6/rm32/ESI . . . . 8/disp8 .
2056 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
2057
2058 e8/call emit-hex/disp32
2059
2060 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2061
2062 e9/jump $emit-segments:word-loop/disp32
2063 $emit-segments:check-for-disp8:
2064
2065
2066
2067 68/push "disp8"/imm32
2068 52/push-EDX
2069
2070 e8/call has-metadata?/disp32
2071
2072 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2073
2074 3d/compare-EAX-and 0/imm32
2075 74/jump-if-equal $emit-segments:check-for-disp32/disp8
2076
2077
2078 68/push 1/imm32
2079 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 4/disp8 .
2080 29/subtract 3/mod/direct 0/rm32/EAX . . . 3/r32/EBX . .
2081 50/push-EAX
2082 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
2083
2084 e8/call emit-hex/disp32
2085
2086 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2087
2088 e9/jump $emit-segments:word-loop/disp32
2089 $emit-segments:check-for-disp32:
2090
2091
2092
2093 68/push "disp32"/imm32
2094 52/push-EDX
2095
2096 e8/call has-metadata?/disp32
2097
2098 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2099
2100 3d/compare-EAX-and 0/imm32
2101 74/jump-if-equal $emit-segments:abort/disp8
2102
2103
2104 68/push 4/imm32
2105 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 4/disp8 .
2106 29/subtract 3/mod/direct 0/rm32/EAX . . . 3/r32/EBX . .
2107 50/push-EAX
2108 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
2109
2110 e8/call emit-hex/disp32
2111
2112 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2113
2114 e9/jump $emit-segments:word-loop/disp32
2115 $emit-segments:next-line:
2116
2117
2118 68/push Newline/imm32
2119 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
2120
2121 e8/call write-buffered/disp32
2122
2123 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2124
2125 e9/jump $emit-segments:line-loop/disp32
2126 $emit-segments:end:
2127
2128 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x21c/imm32
2129
2130 5f/pop-to-EDI
2131 5e/pop-to-ESI
2132 5b/pop-to-EBX
2133 5a/pop-to-EDX
2134 59/pop-to-ECX
2135 58/pop-to-EAX
2136
2137 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2138 5d/pop-to-EBP
2139 c3/return
2140
2141 $emit-segments:imm8-abort:
2142
2143
2144 68/push "emit-segments: unexpected /imm8"/imm32
2145 68/push 2/imm32/stderr
2146
2147 e8/call _write/disp32
2148
2149 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2150
2151 bb/copy-to-EBX 1/imm32
2152 b8/copy-to-EAX 1/imm32/exit
2153 cd/syscall 0x80/imm8
2154
2155
2156 $emit-segments:abort:
2157
2158
2159
2160 68/push "emit-segments: missing metadata in "/imm32
2161 68/push 2/imm32/stderr
2162
2163 e8/call _write/disp32
2164
2165 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2166
2167
2168 52/push-EDX
2169 68/push Stderr/imm32
2170
2171 e8/call write-slice-buffered/disp32
2172
2173 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2174
2175
2176 68/push Stderr/imm32
2177
2178 e8/call flush/disp32
2179
2180 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2181
2182 bb/copy-to-EBX 1/imm32
2183 b8/copy-to-EAX 1/imm32/exit
2184 cd/syscall 0x80/imm8
2185
2186
2187 test-emit-segments:
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211 55/push-EBP
2212 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2213
2214
2215
2216 68/push _test-input-stream/imm32
2217
2218 e8/call clear-stream/disp32
2219
2220 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2221
2222
2223 b8/copy-to-EAX _test-input-buffered-file/imm32
2224 05/add-to-EAX 4/imm32
2225 50/push-EAX
2226
2227 e8/call clear-stream/disp32
2228
2229 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2230
2231
2232 68/push _test-output-stream/imm32
2233
2234 e8/call clear-stream/disp32
2235
2236 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2237
2238
2239 b8/copy-to-EAX _test-output-buffered-file/imm32
2240 05/add-to-EAX 4/imm32
2241 50/push-EAX
2242
2243 e8/call clear-stream/disp32
2244
2245 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2246
2247 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 0xa0/imm32
2248 68/push 0xa0/imm32/length
2249 68/push 0/imm32/read
2250 68/push 0/imm32/write
2251 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2252
2253 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 0x2000/imm32
2254 68/push 0x2000/imm32/length
2255 68/push 0/imm32/read
2256 68/push 0/imm32/write
2257 89/copy 3/mod/direct 2/rm32/EDX . . . 4/r32/ESP . .
2258
2259
2260
2261 68/push "== code 0x1000\n"/imm32
2262 68/push _test-input-stream/imm32
2263
2264 e8/call write/disp32
2265
2266 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2267
2268
2269 68/push "ab cd ef gh\n"/imm32
2270 68/push _test-input-stream/imm32
2271
2272 e8/call write/disp32
2273
2274 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2275
2276
2277 68/push "ij x/imm32\n"/imm32
2278 68/push _test-input-stream/imm32
2279
2280 e8/call write/disp32
2281
2282 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2283
2284
2285 68/push "== data 0x2000\n"/imm32
2286 68/push _test-input-stream/imm32
2287
2288 e8/call write/disp32
2289
2290 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2291
2292
2293 68/push "00\n"/imm32
2294 68/push _test-input-stream/imm32
2295
2296 e8/call write/disp32
2297
2298 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2299
2300
2301 68/push "x:\n"/imm32
2302 68/push _test-input-stream/imm32
2303
2304 e8/call write/disp32
2305
2306 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2307
2308
2309 68/push "34\n"/imm32
2310 68/push _test-input-stream/imm32
2311
2312 e8/call write/disp32
2313
2314 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2315
2316 68/push 5/imm32/segment-size
2317 68/push 0/imm32/file-offset
2318 68/push 0x1074/imm32/start-address
2319 68/push "code"/imm32/segment-name
2320 51/push-ECX
2321
2322 e8/call stream-add4/disp32
2323
2324 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
2325
2326 68/push 1/imm32/segment-size
2327 68/push 5/imm32/file-offset
2328 68/push 0x2079/imm32/start-address
2329 68/push "data"/imm32/segment-name
2330 51/push-ECX
2331
2332 e8/call stream-add4/disp32
2333
2334 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
2335
2336 68/push 0x1077/imm32/label-address
2337 68/push 3/imm32/segment-offset
2338 68/push "code"/imm32/segment-name
2339 68/push "l1"/imm32/label-name
2340 52/push-EDX
2341
2342 e8/call stream-add4/disp32
2343
2344 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
2345
2346 68/push 0x207a/imm32/label-address
2347 68/push 1/imm32/segment-offset
2348 68/push "data"/imm32/segment-name
2349 68/push "x"/imm32/label-name
2350 52/push-EDX
2351
2352 e8/call stream-add4/disp32
2353
2354 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
2355
2356
2357
2358 52/push-EDX
2359 51/push-ECX
2360 68/push _test-output-buffered-file/imm32
2361 68/push _test-input-buffered-file/imm32
2362
2363 e8/call emit-segments/disp32
2364
2365 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
2366
2367 +-- 33 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
2400
2401
2402 68/push "F - test-emit-segments/0"/imm32
2403 68/push "ab cd ef gh "/imm32
2404 68/push _test-output-stream/imm32
2405
2406 e8/call check-next-stream-line-equal/disp32
2407
2408 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2409
2410
2411 68/push "F - test-emit-segments/1"/imm32
2412 68/push "ij 7a 20 00 00 "/imm32
2413 68/push _test-output-stream/imm32
2414
2415 e8/call check-next-stream-line-equal/disp32
2416
2417 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2418
2419
2420 68/push "F - test-emit-segments/2"/imm32
2421 68/push "00 "/imm32
2422 68/push _test-output-stream/imm32
2423
2424 e8/call check-next-stream-line-equal/disp32
2425
2426 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2427
2428
2429 68/push "F - test-emit-segments/3"/imm32
2430 68/push "34 "/imm32
2431 68/push _test-output-stream/imm32
2432
2433 e8/call check-next-stream-line-equal/disp32
2434
2435 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2436
2437 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2438 5d/pop-to-EBP
2439 c3/return
2440
2441 emit-headers:
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452 55/push-EBP
2453 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2454
2455 50/push-EAX
2456 51/push-ECX
2457 +-- 9 lines: #? # write(2/stderr, "emit-elf-header\n") --------------------------------------------------------------------------------------------------
2466
2467
2468 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
2469 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
2470 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2471
2472 e8/call emit-elf-header/disp32
2473
2474 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2475
2476 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 0/r32/EAX 0xc/disp8 .
2477
2478 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2479
2480 8d/copy-address 1/mod/*+disp8 0/rm32/EAX . . . 0/r32/EAX 0xc/disp8 .
2481
2482 01/add 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
2483 $emit-headers:loop:
2484
2485 39/compare 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
2486 0f 83/jump-if-greater-or-equal-unsigned $emit-headers:end/disp32
2487 +-- 69 lines: #? # dump curr-segment->name ---------------------------------------------------------------------------------------------------------------
2556 +-- 9 lines: #? # write(2/stderr, "emit-segment-header\n") ----------------------------------------------------------------------------------------------
2565
2566
2567 50/push-EAX
2568 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2569
2570 e8/call emit-elf-program-header-entry/disp32
2571
2572 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2573
2574 81 0/subop/add 3/mod/direct 0/rm32/EAX . . . . . 0x10/imm32
2575 e9/jump $emit-headers:loop/disp32
2576 $emit-headers:end:
2577
2578 59/pop-to-ECX
2579 58/pop-to-EAX
2580
2581 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2582 5d/pop-to-EBP
2583 c3/return
2584
2585 emit-elf-header:
2586
2587
2588
2589
2590
2591
2592 55/push-EBP
2593 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2594
2595 50/push-EAX
2596 51/push-ECX
2597 52/push-EDX
2598
2599
2600 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 0/r32/EAX 0x10/disp8 .
2601
2602
2603 68/push 0x10/imm32/row-size
2604 68/push "Entry"/imm32
2605 50/push-EAX
2606
2607 e8/call get/disp32
2608
2609 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2610
2611 8b/copy 1/mod/*+disp8 0/rm32/EAX . . . 0/r32/EAX 8/disp8 .
2612
2613 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Elf_e_entry/disp32
2614
2615
2616 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 0/r32/EAX 0xc/disp8 .
2617
2618 8b/copy 0/mod/indirect 0/rm32/EAX . . . 0/r32/EAX . .
2619
2620 b9/copy-to-ECX 0x20/imm32
2621 31/xor 3/mod/direct 2/rm32/EDX . . . 2/r32/EDX . .
2622 f7 7/subop/idiv 3/mod/direct 1/rm32/ECX . . . . . .
2623
2624 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Elf_e_phnum/disp32
2625
2626
2627 68/push Elf_header/imm32
2628 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2629
2630 e8/call emit-hex-array/disp32
2631
2632 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2633 $emit-elf-header:end:
2634
2635 5a/pop-to-EDX
2636 59/pop-to-ECX
2637 58/pop-to-EAX
2638
2639 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2640 5d/pop-to-EBP
2641 c3/return
2642
2643 emit-elf-program-header-entry:
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657 55/push-EBP
2658 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2659
2660 50/push-EAX
2661 56/push-ESI
2662
2663 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 0xc/disp8 .
2664
2665
2666 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 8/disp8 .
2667
2668 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Elf_p_offset/disp32
2669
2670
2671 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 4/disp8 .
2672
2673 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Elf_p_vaddr/disp32
2674
2675 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Elf_p_paddr/disp32
2676
2677
2678 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 0xc/disp8 .
2679
2680 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Elf_p_filesz/disp32
2681
2682 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Elf_p_memsz/disp32
2683
2684
2685 8b/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
2686
2687
2688 68/push "code"/imm32
2689 50/push-EAX
2690
2691 e8/call string-equal?/disp32
2692
2693 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2694
2695 3d/compare-EAX-and 0/imm32
2696 74/jump-if-equal $emit-elf-program-header-entry:data/disp8
2697
2698 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Elf_p_flags/disp32 6/imm32
2699 $emit-elf-program-header-entry:data:
2700
2701 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Elf_p_flags/disp32 5/imm32
2702
2703
2704 68/push Elf_program_header_entry/imm32
2705 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2706
2707 e8/call emit-hex-array/disp32
2708
2709 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2710 $emit-elf-program-header-entry:end:
2711
2712 5e/pop-to-ESI
2713 58/pop-to-EAX
2714
2715 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2716 5d/pop-to-EBP
2717 c3/return
2718
2719
2720
2721 stream-add4:
2722
2723 55/push-EBP
2724 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2725
2726 50/push-EAX
2727 51/push-ECX
2728 52/push-EDX
2729 56/push-ESI
2730
2731 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
2732
2733
2734 8b/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
2735
2736 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 0/index/EAX . 0/r32/EAX 0xc/disp8 .
2737
2738
2739 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 2/r32/EDX 8/disp8 .
2740
2741 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 2/index/EDX . 2/r32/EDX 0xc/disp8 .
2742
2743 39/compare 3/mod/direct 0/rm32/EAX . . . 2/r32/EDX . .
2744 73/jump-if-greater-or-equal-unsigned $stream-add4:abort/disp8
2745
2746 8b/copy 1/mod/*+disp8 5/rm32/EBP . . 1/r32/ECX 0xc/disp8 .
2747 89/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2748
2749 05/add-to-EAX 4/imm32
2750
2751 39/compare 3/mod/direct 0/rm32/EAX . . . 2/r32/EDX . .
2752 73/jump-if-greater-or-equal-unsigned $stream-add4:abort/disp8
2753
2754 8b/copy 1/mod/*+disp8 5/rm32/EBP . . 1/r32/ECX 0x10/disp8 .
2755 89/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2756
2757 05/add-to-EAX 4/imm32
2758
2759 39/compare 3/mod/direct 0/rm32/EAX . . . 2/r32/EDX . .
2760 73/jump-if-greater-or-equal-unsigned $stream-add4:abort/disp8
2761
2762 8b/copy 1/mod/*+disp8 5/rm32/EBP . . 1/r32/ECX 0x14/disp8 .
2763 89/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2764
2765 05/add-to-EAX 4/imm32
2766
2767 39/compare 3/mod/direct 0/rm32/EAX . . . 2/r32/EDX . .
2768 73/jump-if-greater-or-equal-unsigned $stream-add4:abort/disp8
2769
2770 8b/copy 1/mod/*+disp8 5/rm32/EBP . . 1/r32/ECX 0x18/disp8 .
2771 89/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2772
2773 81 0/subop/add 0/mod/indirect 6/rm32/ESI . . . . . 0x10/imm32
2774 $stream-add4:end:
2775
2776 5e/pop-to-ESI
2777 5a/pop-to-EDX
2778 59/pop-to-ECX
2779 58/pop-to-EAX
2780
2781 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2782 5d/pop-to-EBP
2783 c3/return
2784
2785 $stream-add4:abort:
2786
2787
2788 68/push "overflow in stream-add4\n"/imm32
2789 68/push 2/imm32/stderr
2790
2791 e8/call _write/disp32
2792
2793 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2794
2795 bb/copy-to-EBX 1/imm32
2796 b8/copy-to-EAX 1/imm32/exit
2797 cd/syscall 0x80/imm8
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807 trace-sssns:
2808
2809 55/push-EBP
2810 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2811
2812
2813 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2814 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
2815
2816 e8/call write/disp32
2817
2818 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2819
2820
2821 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
2822 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
2823
2824 e8/call write/disp32
2825
2826 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2827
2828
2829 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
2830 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
2831
2832 e8/call write/disp32
2833
2834 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2835
2836
2837 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x14/disp8 .
2838 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
2839
2840 e8/call print-int32/disp32
2841
2842 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2843
2844
2845 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x18/disp8 .
2846
2847 e8/call trace/disp32
2848
2849 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2850 $trace-sssns:end:
2851
2852 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2853 5d/pop-to-EBP
2854 c3/return
2855
2856 test-trace-sssns:
2857
2858 55/push-EBP
2859 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2860
2861
2862 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Trace-stream/disp32
2863 c7 0/subop/copy 0/mod/direct 0/rm32/EAX . . . . . 0/imm32
2864
2865
2866 68/push " e"/imm32
2867 68/push 3/imm32
2868 68/push "c "/imm32
2869 68/push "b"/imm32
2870 68/push "A"/imm32
2871
2872 e8/call trace-sssns/disp32
2873
2874 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
2875 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
2901
2902
2903 68/push "F - test-trace-sssns"/imm32
2904 68/push "Abc 0x00000003 e"/imm32
2905
2906 e8/call check-trace-contains/disp32
2907
2908 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2909
2910 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2911 5d/pop-to-EBP
2912 c3/return
2913
2914 trace-snsns:
2915
2916 55/push-EBP
2917 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2918
2919
2920 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2921 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
2922
2923 e8/call write/disp32
2924
2925 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2926
2927
2928 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
2929 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
2930
2931 e8/call print-int32/disp32
2932
2933 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2934
2935
2936 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
2937 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
2938
2939 e8/call write/disp32
2940
2941 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2942
2943
2944 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x14/disp8 .
2945 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
2946
2947 e8/call print-int32/disp32
2948
2949 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2950
2951
2952 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x18/disp8 .
2953
2954 e8/call trace/disp32
2955
2956 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2957 $trace-snsns:end:
2958
2959 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2960 5d/pop-to-EBP
2961 c3/return
2962
2963 test-trace-snsns:
2964
2965 55/push-EBP
2966 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2967
2968
2969 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Trace-stream/disp32
2970 c7 0/subop/copy 0/mod/direct 0/rm32/EAX . . . . . 0/imm32
2971
2972
2973 68/push " e"/imm32
2974 68/push 3/imm32
2975 68/push " c "/imm32
2976 68/push 2/imm32
2977 68/push "A "/imm32
2978
2979 e8/call trace-snsns/disp32
2980
2981 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
2982 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
3008
3009
3010 68/push "F - test-trace-snsns"/imm32
3011 68/push "A 0x00000002 c 0x00000003 e"/imm32
3012
3013 e8/call check-trace-contains/disp32
3014
3015 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3016
3017 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3018 5d/pop-to-EBP
3019 c3/return
3020
3021 trace-slsls:
3022
3023 55/push-EBP
3024 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3025
3026
3027 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
3028 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3029
3030 e8/call write/disp32
3031
3032 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3033
3034
3035 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
3036 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3037
3038 e8/call write-slice/disp32
3039
3040 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3041
3042
3043 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
3044 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3045
3046 e8/call write/disp32
3047
3048 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3049
3050
3051 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x14/disp8 .
3052 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3053
3054 e8/call write-slice/disp32
3055
3056 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3057
3058
3059 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x18/disp8 .
3060
3061 e8/call trace/disp32
3062
3063 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3064 $trace-slsls:end:
3065
3066 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3067 5d/pop-to-EBP
3068 c3/return
3069
3070 test-trace-slsls:
3071
3072 55/push-EBP
3073 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3074
3075
3076 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Trace-stream/disp32
3077 c7 0/subop/copy 0/mod/direct 0/rm32/EAX . . . . . 0/imm32
3078
3079 b8/copy-to-EAX "b"/imm32
3080 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
3081 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
3082 05/add-to-EAX 4/imm32
3083
3084 51/push-ECX
3085 50/push-EAX
3086 89/copy 3/mod/direct 3/rm32/EBX . . . 4/r32/ESP . .
3087
3088 b8/copy-to-EAX "d"/imm32
3089 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
3090 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
3091 05/add-to-EAX 4/imm32
3092
3093 51/push-ECX
3094 50/push-EAX
3095 89/copy 3/mod/direct 2/rm32/EDX . . . 4/r32/ESP . .
3096
3097
3098 68/push "e"/imm32
3099 52/push-EDX
3100 68/push "c"/imm32
3101 53/push-EBX
3102 68/push "A"/imm32
3103
3104 e8/call trace-slsls/disp32
3105
3106 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
3107 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
3133
3134
3135 68/push "F - test-trace-slsls"/imm32
3136 68/push "Abcde"/imm32
3137
3138 e8/call check-trace-contains/disp32
3139
3140 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3141
3142 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3143 5d/pop-to-EBP
3144 c3/return
3145
3146 trace-slsns:
3147
3148 55/push-EBP
3149 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3150
3151
3152 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
3153 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3154
3155 e8/call write/disp32
3156
3157 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3158
3159
3160 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
3161 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3162
3163 e8/call write-slice/disp32
3164
3165 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3166
3167
3168 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
3169 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3170
3171 e8/call write/disp32
3172
3173 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3174
3175
3176 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x14/disp8 .
3177 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3178
3179 e8/call print-int32/disp32
3180
3181 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3182
3183
3184 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x18/disp8 .
3185
3186 e8/call trace/disp32
3187
3188 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3189 $trace-slsns:end:
3190
3191 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3192 5d/pop-to-EBP
3193 c3/return
3194
3195 test-trace-slsns:
3196
3197 55/push-EBP
3198 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3199
3200
3201 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Trace-stream/disp32
3202 c7 0/subop/copy 0/mod/direct 0/rm32/EAX . . . . . 0/imm32
3203
3204 b8/copy-to-EAX "b"/imm32
3205 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
3206 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
3207 05/add-to-EAX 4/imm32
3208
3209 51/push-ECX
3210 50/push-EAX
3211 89/copy 3/mod/direct 3/rm32/EBX . . . 4/r32/ESP . .
3212
3213
3214 68/push " e"/imm32
3215 68/push 3/imm32
3216 68/push "c "/imm32
3217 53/push-EBX
3218 68/push "A"/imm32
3219
3220 e8/call trace-slsns/disp32
3221
3222 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
3223 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
3249
3250
3251 68/push "F - test-trace-slsls"/imm32
3252 68/push "Abc 0x00000003 e"/imm32
3253
3254 e8/call check-trace-contains/disp32
3255
3256 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3257
3258 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3259 5d/pop-to-EBP
3260 c3/return
3261
3262 trace-slsss:
3263
3264 55/push-EBP
3265 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3266
3267
3268 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
3269 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3270
3271 e8/call write/disp32
3272
3273 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3274
3275
3276 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
3277 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3278
3279 e8/call write-slice/disp32
3280
3281 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3282
3283
3284 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
3285 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3286
3287 e8/call write/disp32
3288
3289 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3290
3291
3292 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x14/disp8 .
3293 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
3294
3295 e8/call write/disp32
3296
3297 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3298
3299
3300 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x18/disp8 .
3301
3302 e8/call trace/disp32
3303
3304 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3305 $trace-slsss:end:
3306
3307 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3308 5d/pop-to-EBP
3309 c3/return
3310
3311 test-trace-slsss:
3312
3313 55/push-EBP
3314 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3315
3316
3317 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Trace-stream/disp32
3318 c7 0/subop/copy 0/mod/direct 0/rm32/EAX . . . . . 0/imm32
3319
3320 b8/copy-to-EAX "b"/imm32
3321 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
3322 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
3323 05/add-to-EAX 4/imm32
3324
3325 51/push-ECX
3326 50/push-EAX
3327 89/copy 3/mod/direct 3/rm32/EBX . . . 4/r32/ESP . .
3328
3329
3330 68/push "e"/imm32
3331 68/push "d"/imm32
3332 68/push "c"/imm32
3333 53/push-EBX
3334 68/push "A"/imm32
3335
3336 e8/call trace-slsss/disp32
3337
3338 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
3339 +-- 26 lines: #? # dump *Trace-stream --------------------------------------------------------------------------------------------------------------------
3365
3366
3367 68/push "F - test-trace-slsss"/imm32
3368 68/push "Abcde"/imm32
3369
3370 e8/call check-trace-contains/disp32
3371
3372 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3373
3374 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3375 5d/pop-to-EBP
3376 c3/return
3377
3378 num-bytes:
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395 55/push-EBP
3396 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3397
3398 51/push-ECX
3399 52/push-EDX
3400 53/push-EBX
3401
3402 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
3403
3404 68/push 0/imm32/end
3405 68/push 0/imm32/start
3406 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
3407 +-- 26 lines: #? # dump line -----------------------------------------------------------------------------------------------------------------------------
3433
3434
3435 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
3436
3437 e8/call rewind-stream/disp32
3438
3439 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3440 $num-bytes:loop:
3441
3442
3443 51/push-ECX
3444 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
3445
3446 e8/call next-word/disp32
3447
3448 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3449 +-- 46 lines: #? # dump word-slice -----------------------------------------------------------------------------------------------------------------------
3495 $num-bytes:check0:
3496
3497
3498 50/push-EAX
3499
3500
3501 51/push-ECX
3502
3503 e8/call slice-empty?/disp32
3504
3505 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3506
3507 3d/compare-EAX-and 0/imm32
3508
3509 58/pop-to-EAX
3510 75/jump-if-not-equal $num-bytes:end/disp8
3511 $num-bytes:check-for-comment:
3512
3513
3514 8b/copy 0/mod/indirect 1/rm32/ECX . . . 2/r32/EDX . .
3515
3516 31/xor 3/mod/direct 3/rm32/EBX . . . 3/r32/EBX . .
3517 8a/copy-byte 0/mod/indirect 2/rm32/EDX . . . 3/r32/BL . .
3518
3519 81 7/subop/compare 3/mod/direct 3/rm32/EBX . . . . . 0x23/imm32/hash
3520 74/jump-if-equal $num-bytes:end/disp8
3521 $num-bytes:check-for-label:
3522
3523
3524 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 2/r32/EDX 4/disp8 .
3525
3526 31/xor 3/mod/direct 3/rm32/EBX . . . 3/r32/EBX . .
3527 8a/copy-byte 1/mod/*+disp8 2/rm32/EDX . . . 3/r32/BL -1/disp8 .
3528
3529 81 7/subop/compare 3/mod/direct 3/rm32/EBX . . . . . 0x3a/imm32/colon
3530 74/jump-if-equal $num-bytes:end/disp8
3531 $num-bytes:check-for-segment-header:
3532
3533
3534 50/push-EAX
3535
3536
3537 68/push "=="/imm32
3538 51/push-ECX
3539
3540 e8/call slice-equal?/disp32
3541
3542 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3543
3544 3d/compare-EAX-and 0/imm32
3545
3546 58/pop-to-EAX
3547 75/jump-if-not-equal $num-bytes:end/disp8
3548 $num-bytes:loop-body:
3549
3550
3551 89/copy 3/mod/direct 2/rm32/EDX . . . 0/r32/EAX . .
3552
3553
3554 51/push-ECX
3555
3556 e8/call compute-width-of-slice/disp32
3557
3558 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3559
3560 01/add 3/mod/direct 0/rm32/EAX . . . 2/r32/EDX . .
3561 e9/jump $num-bytes:loop/disp32
3562 $num-bytes:end:
3563
3564
3565 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
3566
3567 e8/call rewind-stream/disp32
3568
3569 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3570
3571 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3572
3573 5b/pop-to-EBX
3574 5a/pop-to-EDX
3575 59/pop-to-ECX
3576
3577 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3578 5d/pop-to-EBP
3579 c3/return
3580
3581 test-num-bytes-handles-empty-string:
3582
3583
3584 55/push-EBP
3585 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3586
3587
3588
3589 68/push _test-input-stream/imm32
3590
3591 e8/call clear-stream/disp32
3592
3593 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3594
3595
3596 68/push _test-output-stream/imm32
3597
3598 e8/call clear-stream/disp32
3599
3600 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3601
3602
3603
3604 68/push _test-input-stream/imm32
3605
3606 e8/call num-bytes/disp32
3607
3608 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3609
3610
3611 68/push "F - test-num-bytes-handles-empty-string"/imm32
3612 68/push 0/imm32/true
3613 50/push-EAX
3614
3615 e8/call check-ints-equal/disp32
3616
3617 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3618
3619 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3620 5d/pop-to-EBP
3621 c3/return
3622
3623 test-num-bytes-ignores-comments:
3624
3625
3626 55/push-EBP
3627 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3628
3629
3630
3631 68/push _test-input-stream/imm32
3632
3633 e8/call clear-stream/disp32
3634
3635 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3636
3637
3638 68/push _test-output-stream/imm32
3639
3640 e8/call clear-stream/disp32
3641
3642 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3643
3644
3645
3646 68/push "# abcd"/imm32
3647 68/push _test-input-stream/imm32
3648
3649 e8/call write/disp32
3650
3651 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3652
3653
3654 68/push _test-input-stream/imm32
3655
3656 e8/call num-bytes/disp32
3657
3658 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3659
3660
3661 68/push "F - test-num-bytes-ignores-comments"/imm32
3662 68/push 0/imm32/true
3663 50/push-EAX
3664
3665 e8/call check-ints-equal/disp32
3666
3667 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3668
3669 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3670 5d/pop-to-EBP
3671 c3/return
3672
3673 test-num-bytes-ignores-labels:
3674
3675
3676 55/push-EBP
3677 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3678
3679
3680
3681 68/push _test-input-stream/imm32
3682
3683 e8/call clear-stream/disp32
3684
3685 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3686
3687
3688 68/push _test-output-stream/imm32
3689
3690 e8/call clear-stream/disp32
3691
3692 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3693
3694
3695
3696 68/push "ab: # cd"/imm32
3697 68/push _test-input-stream/imm32
3698
3699 e8/call write/disp32
3700
3701 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3702
3703
3704 68/push _test-input-stream/imm32
3705
3706 e8/call num-bytes/disp32
3707
3708 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3709
3710
3711 68/push "F - test-num-bytes-ignores-labels"/imm32
3712 68/push 0/imm32/true
3713 50/push-EAX
3714
3715 e8/call check-ints-equal/disp32
3716
3717 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3718
3719 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3720 5d/pop-to-EBP
3721 c3/return
3722
3723 test-num-bytes-ignores-segment-headers:
3724
3725
3726 55/push-EBP
3727 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3728
3729
3730
3731 68/push _test-input-stream/imm32
3732
3733 e8/call clear-stream/disp32
3734
3735 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3736
3737
3738 68/push _test-output-stream/imm32
3739
3740 e8/call clear-stream/disp32
3741
3742 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3743
3744
3745
3746 68/push "== ab cd"/imm32
3747 68/push _test-input-stream/imm32
3748
3749 e8/call write/disp32
3750
3751 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3752
3753
3754 68/push _test-input-stream/imm32
3755
3756 e8/call num-bytes/disp32
3757
3758 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3759
3760
3761 68/push "F - test-num-bytes-ignores-segment-headers"/imm32
3762 68/push 0/imm32/true
3763 50/push-EAX
3764
3765 e8/call check-ints-equal/disp32
3766
3767 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3768
3769 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3770 5d/pop-to-EBP
3771 c3/return
3772
3773 test-num-bytes-counts-words-by-default:
3774
3775
3776 55/push-EBP
3777 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3778
3779
3780
3781 68/push _test-input-stream/imm32
3782
3783 e8/call clear-stream/disp32
3784
3785 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3786
3787
3788 68/push _test-output-stream/imm32
3789
3790 e8/call clear-stream/disp32
3791
3792 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3793
3794
3795
3796 68/push "ab cd ef"/imm32
3797 68/push _test-input-stream/imm32
3798
3799 e8/call write/disp32
3800
3801 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3802
3803
3804 68/push _test-input-stream/imm32
3805
3806 e8/call num-bytes/disp32
3807
3808 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3809
3810
3811 68/push "F - test-num-bytes-counts-words-by-default"/imm32
3812 68/push 3/imm32/true
3813 50/push-EAX
3814
3815 e8/call check-ints-equal/disp32
3816
3817 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3818
3819 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3820 5d/pop-to-EBP
3821 c3/return
3822
3823 test-num-bytes-ignores-trailing-comment:
3824
3825
3826 55/push-EBP
3827 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3828
3829
3830
3831 68/push _test-input-stream/imm32
3832
3833 e8/call clear-stream/disp32
3834
3835 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3836
3837
3838 68/push _test-output-stream/imm32
3839
3840 e8/call clear-stream/disp32
3841
3842 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3843
3844
3845
3846 68/push "ab cd # ef"/imm32
3847 68/push _test-input-stream/imm32
3848
3849 e8/call write/disp32
3850
3851 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3852
3853
3854 68/push _test-input-stream/imm32
3855
3856 e8/call num-bytes/disp32
3857
3858 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3859
3860
3861 68/push "F - test-num-bytes-ignores-trailing-comment"/imm32
3862 68/push 2/imm32/true
3863 50/push-EAX
3864
3865 e8/call check-ints-equal/disp32
3866
3867 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3868
3869 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3870 5d/pop-to-EBP
3871 c3/return
3872
3873 test-num-bytes-handles-imm32:
3874
3875
3876 55/push-EBP
3877 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3878
3879
3880
3881 68/push _test-input-stream/imm32
3882
3883 e8/call clear-stream/disp32
3884
3885 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3886
3887
3888 68/push _test-output-stream/imm32
3889
3890 e8/call clear-stream/disp32
3891
3892 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3893
3894
3895
3896 68/push "ab cd/imm32 ef"/imm32
3897 68/push _test-input-stream/imm32
3898
3899 e8/call write/disp32
3900
3901 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3902
3903
3904 68/push _test-input-stream/imm32
3905
3906 e8/call num-bytes/disp32
3907
3908 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3909
3910
3911 68/push "F - test-num-bytes-handles-imm32"/imm32
3912 68/push 6/imm32/true
3913 50/push-EAX
3914
3915 e8/call check-ints-equal/disp32
3916
3917 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3918
3919 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3920 5d/pop-to-EBP
3921 c3/return
3922
3923 == data
3924
3925 Segment-size:
3926 0x1000/imm32/4KB
3927
3928
3929
3930
3931 Elf_header:
3932
3933 0x34/imm32
3934
3935 $e_ident:
3936 7f 45/E 4c/L 46/F
3937 01/32-bit 01/little-endian 01/file-version 00/no-os-extensions
3938 00 00 00 00 00 00 00 00
3939 $e_type:
3940 02 00
3941 $e_machine:
3942 03 00
3943 $e_version:
3944 1/imm32
3945 Elf_e_entry:
3946 0x09000000/imm32
3947 $e_phoff:
3948 0x34/imm32
3949 $e_shoff:
3950 0/imm32
3951 $e_flags:
3952 0/imm32
3953 $e_ehsize:
3954 0x34 00
3955 $e_phentsize:
3956 0x20 00
3957 Elf_e_phnum:
3958 00 00
3959 $e_shentsize:
3960 00 00
3961 $e_shnum:
3962 00 00
3963 $e_shstrndx:
3964 00 00
3965
3966
3967
3968
3969 Elf_program_header_entry:
3970
3971 0x20/imm32
3972
3973 $p_type:
3974 1/imm32/PT_LOAD
3975 Elf_p_offset:
3976 0/imm32
3977 Elf_p_vaddr:
3978 0/imm32
3979 Elf_p_paddr:
3980 0/imm32
3981 Elf_p_filesz:
3982 0/imm32
3983 Elf_p_memsz:
3984 0/imm32
3985 Elf_p_flags:
3986 6/imm32/rw-
3987 $p_align:
3988
3989
3990 0x1000/imm32
3991
3992