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 e8/call run-tests/disp32
47
48 8b/copy 0/mod/indirect 5/rm32/.disp32 3/r32/EBX Num-test-failures/disp32
49 b8/copy-to-EAX 1/imm32
50 cd/syscall 0x80/imm8
51
52
53
54 initialize-trace-stream:
55
56
57 68/push 0x1000/imm32/N
58
59 e8/call new-segment/disp32
60
61 81 0/subop/add 3/mod/direct 4/rm32/ESP 4/imm32
62
63 89/copy 0/mod/indirect 5/rm32/.disp32 0/r32/EAX Trace-stream/disp32
64
65 c7 0/copy 1/mod/*+disp8 0/rm32/EAX 8/disp8 0xff4/imm32
66 c3/return
67
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-3/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-3/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 clear-trace-stream:
138
139 55/push-EBP
140 89/copy 3/mod/direct 5/rm32/EBP 4/r32/ESP
141
142 50/push-EAX
143 51/push-ECX
144
145 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 0/r32/EAX 8/disp8
146
147 8b/copy 1/mod/*+disp8 0/rm32/EAX 1/r32/ECX 8/disp8
148
149 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX 1/r32/ECX 0xc/disp8
150
151 c7/copy 0/mod/direct 0/rm32/EAX 0/imm32
152
153 c7/copy 1/mod/*+disp8 0/rm32/EAX 4/disp8 0/imm32
154
155 81 0/subop/add 3/mod/direct 0/rm32/EAX 0xc/imm32
156
157 $clear-trace-stream:loop:
158
159 39/compare 3/mod/direct 0/rm32/EAX 1/r32/ECX
160 7d/jump-if-greater-or-equal $clear-trace-stream:end/disp8
161
162 c7/copy 0/mod/direct 0/rm32/EAX 0/imm32
163
164 81 0/subop/add 3/mod/direct 0/rm32/EAX 4/imm32
165 eb/jump $clear-trace-stream:loop/disp8
166 $clear-trace-stream:end:
167
168 59/pop-to-ECX
169 58/pop-to-EAX
170
171 89/copy 3/mod/direct 4/rm32/ESP 5/r32/EBP
172 5d/pop-to-EBP
173 c3/return
174
175
176
177 test-trace-single:
178
179
180 68/push _test-trace-stream/imm32
181
182 e8/call clear-trace-stream/disp32
183
184 81 0/subop/add 3/mod/direct 4/rm32/ESP 4/imm32
185
186
187 68/push "Ab"/imm32
188 68/push _test-trace-stream/imm32
189
190 e8/call trace/disp32
191
192 81 0/subop/add 3/mod/direct 4/rm32/ESP 8/imm32
193
194
195 68/push "F - test-trace-single"/imm32
196 68/push 0x0a6241/imm32/Ab-newline
197
198 b8/copy-to-EAX _test-trace-stream/imm32
199 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX 0xc/disp8
200
201 e8/call check-ints-equal/disp32
202
203 81 0/subop/add 3/mod/direct 4/rm32/ESP 0xc/imm32
204
205 c3/return
206
207 test-trace-appends:
208
209
210 68/push _test-trace-stream/imm32
211
212 e8/call clear-trace-stream/disp32
213
214 81 0/subop/add 3/mod/direct 4/rm32/ESP 4/imm32
215
216
217 68/push "C"/imm32
218 68/push _test-trace-stream/imm32
219
220 e8/call trace/disp32
221
222 81 0/subop/add 3/mod/direct 4/rm32/ESP 8/imm32
223
224
225 68/push "D"/imm32
226 68/push _test-trace-stream/imm32
227
228 e8/call trace/disp32
229
230 81 0/subop/add 3/mod/direct 4/rm32/ESP 8/imm32
231
232
233 68/push "F - test-trace-appends"/imm32
234 68/push 0x0a440a43/imm32/C-newline-D-newline
235
236 b8/copy-to-EAX _test-trace-stream/imm32
237 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX 0xc/disp8
238
239 e8/call check-ints-equal/disp32
240
241 81 0/subop/add 3/mod/direct 4/rm32/ESP 0xc/imm32
242
243 c3/return
244
245 test-trace-empty-line:
246
247
248 68/push _test-trace-stream/imm32
249
250 e8/call clear-trace-stream/disp32
251
252 81 0/subop/add 3/mod/direct 4/rm32/ESP 4/imm32
253
254
255 68/push ""/imm32
256 68/push _test-trace-stream/imm32
257
258 e8/call trace/disp32
259
260 81 0/subop/add 3/mod/direct 4/rm32/ESP 8/imm32
261
262
263 68/push "F - test-trace-empty-line"/imm32
264 68/push 0/imm32
265
266 b8/copy-to-EAX _test-trace-stream/imm32
267 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX 0xc/disp8
268
269 e8/call check-ints-equal/disp32
270
271 81 0/subop/add 3/mod/direct 4/rm32/ESP 0xc/imm32
272
273 c3/return
274
275
276
277
278 _append-3:
279
280 55/push-EBP
281 89/copy 3/mod/direct 5/rm32/EBP 4/r32/ESP
282
283 51/push-ECX
284
285
286
287 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 0/r32/EAX 0x10/disp8
288
289 8b/copy 0/mod/indirect 0/rm32/EAX 1/r32/ECX
290
291 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX 1/r32/ECX 4/disp8
292 51/push-ECX
293
294 8d/copy-address 1/mod/*+disp8 0/rm32/EAX 1/r32/ECX 4/disp8
295 51/push-ECX
296
297 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 0xc/disp8
298
299 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 0x8/disp8
300
301 e8/call _append-4/disp32
302
303 81 0/subop/add 3/mod/direct 4/rm32/ESP 0x10/imm32
304
305 59/pop-to-ECX
306
307 89/copy 3/mod/direct 4/rm32/ESP 5/r32/EBP
308 5d/pop-to-EBP
309 c3/return
310
311
312 _append-4:
313
314 55/push-EBP
315 89/copy 3/mod/direct 5/rm32/EBP 4/r32/ESP
316
317 51/push-ECX
318 52/push-EDX
319 53/push-EBX
320 56/push-ESI
321 57/push-EDI
322
323 b8/copy-to-EAX 0/imm32
324
325 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 7/r32/EDI 0x8/disp8
326
327 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 2/r32/EDX 0xc/disp8
328
329 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 6/r32/ESI 0x10/disp8
330
331 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 1/r32/ECX 0x14/disp8
332 $_append-4:loop:
333
334 39/compare 3/mod/direct 6/rm32/ESI 1/r32/ECX
335 7d/jump-if-greater-or-equal $_append-4:end/disp8
336
337 39/compare 3/mod/direct 7/rm32/EDI 2/r32/EDX
338 7d/jump-if-greater-or-equal $_append-4:end/disp8
339
340 8a/copy-byte 0/mod/indirect 6/rm32/ESI 3/r32/BL
341 88/copy-byte 0/mod/indirect 7/rm32/EDI 3/r32/BL
342
343 40/increment-EAX
344 46/increment-ESI
345 47/increment-EDI
346 eb/jump $_append-4:loop/disp8
347 $_append-4:end:
348
349 5f/pop-to-EDI
350 5e/pop-to-ESI
351 5b/pop-to-EBX
352 5a/pop-to-EDX
353 59/pop-to-ECX
354
355 89/copy 3/mod/direct 4/rm32/ESP 5/r32/EBP
356 5d/pop-to-EBP
357 c3/return
358
359