1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 == data
18
19
20
21 Test-ostream:
22
23 00 00 00 00
24
25 08 00 00 00
26
27 00 00 00 00 00 00 00 00
28
29 == code
30
31
32
33
34
35
36 e8/call run-tests/disp32
37
38 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 1/r32/EBX Num-test-failures/disp32
39 b8/copy-to-EAX 1/imm32
40 cd/syscall 0x80/imm8
41
42 write:
43
44 55/push-EBP
45 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
46
47 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 8/disp8 0x08000000/imm32
48 7f/jump-if-greater $write:fake/disp8
49
50 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 .
51 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 8/disp8 .
52
53 e8/call _write/disp32
54
55 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
56 eb/jump $write:end/disp8
57 $write:fake:
58
59
60 50/push-EAX
61 51/push-ECX
62 52/push-EDX
63 53/push-EBX
64
65 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 1/r32/ECX 8/disp8 .
66
67 8b/copy 0/mod/indirect 1/rm32/ECX . . . 2/r32/EDX . .
68
69 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 3/r32/EBX 4/disp8 .
70
71
72 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 .
73
74 8d/copy-address 1/mod/*+disp8 4/rm32/sib 1/base/ECX 3/index/EBX . 3/r32/EBX 8/disp8 .
75 53/push-EBX
76
77 8d/copy-address 1/mod/*+disp8 4/rm32/sib 1/base/ECX 2/index/EDX . 3/r32/EBX 8/disp8 .
78 53/push-EBX
79
80 e8/call _append/disp32
81
82 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
83
84 01/add 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
85
86 5b/pop-to-EBX
87 5a/pop-to-EDX
88 59/pop-to-ECX
89 58/pop-to-EAX
90 $write:end:
91
92 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
93 5d/pop-to-EBP
94 c3/return
95
96 clear-ostream:
97
98 55/push-EBP
99 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
100
101 50/push-EAX
102 51/push-ECX
103
104 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 0/r32/EAX 8/disp8 .
105
106 8b/copy 1/mod/*+disp8 0/rm32/EAX . . . 1/r32/ECX 4/disp8 .
107
108 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 8/disp8 .
109
110 c7/copy 0/mod/direct 0/rm32/EAX . . . . . 0/imm32
111
112 81 0/subop/add 3/mod/direct 0/rm32/EAX . . . . . 8/imm32
113
114 $clear-ostream:loop:
115
116 39/compare 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
117 7d/jump-if-greater-or-equal $clear-ostream:end/disp8
118
119 c7/copy 0/mod/direct 0/rm32/EAX . . . . . 0/imm32
120
121 81 0/subop/add 3/mod/direct 0/rm32/EAX . . . . . 4/imm32
122 eb/jump $clear-ostream:loop/disp8
123 $clear-ostream:end:
124
125 59/pop-to-ECX
126 58/pop-to-EAX
127
128 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
129 5d/pop-to-EBP
130 c3/return
131
132 test-write-single:
133
134
135 68/push Test-ostream/imm32
136
137 e8/call clear-ostream/disp32
138
139 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
140
141
142 68/push "Ab"/imm32
143 68/push Test-ostream/imm32
144
145 e8/call write/disp32
146
147 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
148
149
150 68/push "F - test-write-single"/imm32
151 68/push 0x006241/imm32/Ab
152
153 b8/copy-to-EAX Test-ostream/imm32
154 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 8/disp8 .
155
156 e8/call check-ints-equal/disp32
157
158 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
159
160 c3/return
161
162 test-write-appends:
163
164
165 68/push Test-ostream/imm32
166
167 e8/call clear-ostream/disp32
168
169 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
170
171
172 68/push "C"/imm32
173 68/push Test-ostream/imm32
174
175 e8/call write/disp32
176
177 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
178
179
180 68/push "D"/imm32
181 68/push Test-ostream/imm32
182
183 e8/call write/disp32
184
185 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
186
187
188 68/push "F - test-write-appends"/imm32
189 68/push 0x00004443/imm32/C-D
190
191 b8/copy-to-EAX Test-ostream/imm32
192 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 8/disp8 .
193
194 e8/call check-ints-equal/disp32
195
196 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
197
198 c3/return