1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 == data
23
24
25 Trace-stream:
26 00 00 00 00
27
28
29
30 Test-trace-stream:
31
32 00 00 00 00
33
34 00 00 00 00
35
36 08 00 00 00
37
38 00 00 00 00 00 00 00 00
39
40 == code
41
42
43
44
45
46
47 e8/call run-tests/disp32
48
49 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 1/r32/EBX Num-test-failures/disp32
50 b8/copy-to-EAX 1/imm32
51 cd/syscall 0x80/imm8
52
53
54
55 initialize-trace-stream:
56
57
58 68/push 0x1000/imm32/N
59
60 e8/call new-segment/disp32
61
62 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
63
64 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Trace-stream/disp32
65
66 c7 0/copy 1/mod/*+disp8 0/rm32/EAX . . . . 8/disp8 0xff4/imm32
67 c3/return
68
69
70 trace:
71
72 55/push-EBP
73 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
74
75 50/push-EAX
76 51/push-ECX
77 52/push-EDX
78 53/push-EBX
79 56/push-ESI
80 57/push-EDI
81
82 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 7/r32/EDI 8/disp8 .
83
84 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 6/r32/ESI 0xc/disp8 .
85
86 8b/copy 0/mod/indirect 7/rm32/EDI . . . 1/r32/ECX . .
87
88 8b/copy 1/mod/*+disp8 7/rm32/EDI . . . 2/r32/EDX 8/disp8 .
89
90
91 56/push-ESI
92
93 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/EDI 2/index/EDX . 3/r32/EBX 0xc/disp8 .
94 53/push-EBX
95
96 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/EDI 1/index/ECX . 3/r32/EBX 0xc/disp8 .
97 53/push-EBX
98
99 e8/call _append/disp32
100
101 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
102
103 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32
104 74/jump-if-equal $trace:end/disp8
105
106 01/add 0/mod/indirect 7/rm32/EDI . . . 0/r32/EAX . .
107
108 8b/copy 0/mod/indirect 7/rm32/EDI . . . 1/r32/ECX . .
109
110
111 68/push Newline/imm32
112
113 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/EDI 2/index/EDX . 3/r32/EBX 0xc/disp8 .
114 53/push-EBX
115
116 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/EDI 1/index/ECX . 3/r32/EBX 0xc/disp8 .
117 53/push-EBX
118
119 e8/call _append/disp32
120
121 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
122
123 01/add 0/mod/indirect 7/rm32/EDI . . . 0/r32/EAX . .
124 $trace:end:
125
126 5f/pop-to-EDI
127 5e/pop-to-ESI
128 5b/pop-to-EBX
129 5a/pop-to-EDX
130 59/pop-to-ECX
131 58/pop-to-EAX
132
133 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
134 5d/pop-to-EBP
135 c3/return
136
137 _append:
138
139 55/push-EBP
140 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
141
142 51/push-ECX
143 52/push-EDX
144 53/push-EBX
145 56/push-ESI
146 57/push-EDI
147
148 b8/copy-to-EAX 0/imm32
149
150 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 7/r32/EDI 0x8/disp8 .
151
152 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 2/r32/EDX 0xc/disp8 .
153
154 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 6/r32/ESI 0x10/disp8 .
155
156 8b/copy 0/mod/indirect 6/rm32/ESI . . . 1/r32/ECX . .
157
158 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 1/r32/ECX 4/disp8 .
159
160 81 0/subop/add 3/mod/direct 6/rm32/ESI . . . . . 4/imm32
161 $_append:loop:
162
163 39/compare 3/mod/direct 6/rm32/ESI . . . 1/r32/ECX . .
164 7d/jump-if-greater-or-equal $_append:end/disp8
165
166 39/compare 3/mod/direct 7/rm32/EDI . . . 2/r32/EDX . .
167 7d/jump-if-greater-or-equal $_append:end/disp8
168
169 8a/copy-byte 0/mod/indirect 6/rm32/ESI . . . 3/r32/BL . .
170 88/copy-byte 0/mod/indirect 7/rm32/EDI . . . 3/r32/BL . .
171
172 40/increment-EAX
173 46/increment-ESI
174 47/increment-EDI
175 eb/jump $_append:loop/disp8
176 $_append:end:
177
178 5f/pop-to-EDI
179 5e/pop-to-ESI
180 5b/pop-to-EBX
181 5a/pop-to-EDX
182 59/pop-to-ECX
183
184 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
185 5d/pop-to-EBP
186 c3/return
187
188 clear-trace-stream:
189
190 55/push-EBP
191 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
192
193 50/push-EAX
194 51/push-ECX
195
196 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 0/r32/EAX 8/disp8 .
197
198 8b/copy 1/mod/*+disp8 0/rm32/EAX . . . 1/r32/ECX 8/disp8 .
199
200 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 0xc/disp8 .
201
202 c7/copy 0/mod/direct 0/rm32/EAX . . . . . 0/imm32
203
204 c7/copy 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 0/imm32
205
206 81 0/subop/add 3/mod/direct 0/rm32/EAX . . . . . 0xc/imm32
207
208 $clear-trace-stream:loop:
209
210 39/compare 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
211 7d/jump-if-greater-or-equal $clear-trace-stream:end/disp8
212
213 c7/copy 0/mod/direct 0/rm32/EAX . . . . . 0/imm32
214
215 81 0/subop/add 3/mod/direct 0/rm32/EAX . . . . . 4/imm32
216 eb/jump $clear-trace-stream:loop/disp8
217 $clear-trace-stream:end:
218
219 59/pop-to-ECX
220 58/pop-to-EAX
221
222 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
223 5d/pop-to-EBP
224 c3/return
225
226 test-trace-single:
227
228
229 68/push Test-trace-stream/imm32
230
231 e8/call clear-trace-stream/disp32
232
233 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
234
235
236 68/push "Ab"/imm32
237 68/push Test-trace-stream/imm32
238
239 e8/call trace/disp32
240
241 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
242
243
244 68/push "F - test-trace-single"/imm32
245 68/push 0x0a6241/imm32/Ab-newline
246
247 b8/copy-to-EAX Test-trace-stream/imm32
248 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 .
249
250 e8/call check-ints-equal/disp32
251
252 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
253
254 c3/return
255
256 test-trace-appends:
257
258
259 68/push Test-trace-stream/imm32
260
261 e8/call clear-trace-stream/disp32
262
263 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
264
265
266 68/push "C"/imm32
267 68/push Test-trace-stream/imm32
268
269 e8/call trace/disp32
270
271 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
272
273
274 68/push "D"/imm32
275 68/push Test-trace-stream/imm32
276
277 e8/call trace/disp32
278
279 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
280
281
282 68/push "F - test-trace-appends"/imm32
283 68/push 0x0a440a43/imm32/C-newline-D-newline
284
285 b8/copy-to-EAX Test-trace-stream/imm32
286 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 .
287
288 e8/call check-ints-equal/disp32
289
290 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
291
292 c3/return
293
294 test-trace-empty-line:
295
296
297 68/push Test-trace-stream/imm32
298
299 e8/call clear-trace-stream/disp32
300
301 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
302
303
304 68/push ""/imm32
305 68/push Test-trace-stream/imm32
306
307 e8/call trace/disp32
308
309 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
310
311
312 68/push "F - test-trace-empty-line"/imm32
313 68/push 0/imm32
314
315 b8/copy-to-EAX Test-trace-stream/imm32
316 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 .
317
318 e8/call check-ints-equal/disp32
319
320 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
321
322 c3/return
323
324