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
81 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 0/r32/EAX 8/disp8 .
82
83 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 3/r32/EBX 0xc/disp8 .
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123 8b/copy 1/mod/*+disp8 0/rm32/EAX . . . 1/r32/ECX 8/disp8 .
124
125 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 0xc/disp8 .
126
127 8b/copy 0/mod/indirect 0/rm32/EAX . . . 6/r32/ESI . .
128
129 8b/copy 0/mod/indirect 3/rm32/EBX . . . 2/r32/EDX . .
130
131 81 7/subop/compare 3/mod/direct 2/rm32/EDX . . . . . 0/imm32
132 74/jump-if-equal $trace:end/disp8
133
134 01/add 0/mod/indirect 0/rm32/EAX . . . 2/r32/EDX . .
135
136 81 0/subop/add 0/mod/indirect 0/rm32/EAX . . . . . 1/imm32
137
138 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 6/index/ESI . 0/r32/EAX 0xc/disp8 .
139
140 8d/copy-address 1/mod/*+disp8 4/rm32/sib 3/base/EBX 2/index/EDX . 6/r32/ESI 4/disp8 .
141
142 81 0/subop/add 3/mod/direct 3/rm32/EBX . . . . . 4/imm32
143
144 $trace:loop:
145
146 39/compare 3/mod/direct 3/rm32/EBX . . . 6/r32/ESI . .
147 7d/jump-if-greater-or-equal $trace:break/disp8
148
149 39/compare 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
150 7d/jump-if-greater-or-equal $trace:break/disp8
151
152 8a/copy-byte 0/mod/indirect 3/rm32/EBX . . . 2/r32/DL . .
153 88/copy-byte 0/mod/indirect 0/rm32/EAX . . . 2/r32/DL . .
154
155 40/increment-EAX
156 43/increment-EBX
157 eb/jump $trace:loop/disp8
158 $trace:break:
159
160
161 39/compare 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
162 7d/jump-if-greater-or-equal $trace:end/disp8
163
164 ba/copy-to-EDX 0x0a/imm32
165 88/copy-byte 0/mod/indirect 0/rm32/EAX . . . 2/r32/DL . .
166 $trace:end:
167
168 5e/pop-to-ESI
169 5b/pop-to-EBX
170 5a/pop-to-EDX
171 59/pop-to-ECX
172 58/pop-to-EAX
173
174 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
175 5d/pop-to-EBP
176 c3/return
177
178 clear-trace-stream:
179
180 55/push-EBP
181 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
182
183 50/push-EAX
184 51/push-ECX
185
186 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 0/r32/EAX 8/disp8 .
187
188 8b/copy 1/mod/*+disp8 0/rm32/EAX . . . 1/r32/ECX 8/disp8 .
189
190 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 0xc/disp8 .
191
192 c7/copy 0/mod/direct 0/rm32/EAX . . . . . 0/imm32
193
194 c7/copy 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 0/imm32
195
196 81 0/subop/add 3/mod/direct 0/rm32/EAX . . . . . 0xc/imm32
197
198 $clear-trace-stream:loop:
199
200 39/compare 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
201 7d/jump-if-greater-or-equal $clear-trace-stream:end/disp8
202
203 c7/copy 0/mod/direct 0/rm32/EAX . . . . . 0/imm32
204
205 81 0/subop/add 3/mod/direct 0/rm32/EAX . . . . . 4/imm32
206 eb/jump $clear-trace-stream:loop/disp8
207 $clear-trace-stream:end:
208
209 59/pop-to-ECX
210 58/pop-to-EAX
211
212 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
213 5d/pop-to-EBP
214 c3/return
215
216 test-trace-single:
217
218
219 68/push Test-trace-stream/imm32
220
221 e8/call clear-trace-stream/disp32
222
223 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
224
225
226 68/push "Ab"/imm32
227 68/push Test-trace-stream/imm32
228
229 e8/call trace/disp32
230
231 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
232
233
234 68/push "F - test-trace-single"/imm32
235 68/push 0x0a6241/imm32/Ab-newline
236
237 b8/copy-to-EAX Test-trace-stream/imm32
238 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 .
239
240 e8/call check-ints-equal/disp32
241
242 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
243
244 c3/return
245
246 test-trace-appends:
247
248
249 68/push Test-trace-stream/imm32
250
251 e8/call clear-trace-stream/disp32
252
253 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
254
255
256 68/push "C"/imm32
257 68/push Test-trace-stream/imm32
258
259 e8/call trace/disp32
260
261 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
262
263
264 68/push "D"/imm32
265 68/push Test-trace-stream/imm32
266
267 e8/call trace/disp32
268
269 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
270
271
272 68/push "F - test-trace-appends"/imm32
273 68/push 0x0a440a43/imm32/C-newline-D-newline
274
275 b8/copy-to-EAX Test-trace-stream/imm32
276 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 .
277
278 e8/call check-ints-equal/disp32
279
280 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
281
282 c3/return
283
284 test-trace-empty-line:
285
286
287 68/push Test-trace-stream/imm32
288
289 e8/call clear-trace-stream/disp32
290
291 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
292
293
294 68/push ""/imm32
295 68/push Test-trace-stream/imm32
296
297 e8/call trace/disp32
298
299 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
300
301
302 68/push "F - test-trace-empty-line"/imm32
303 68/push 0/imm32
304
305 b8/copy-to-EAX Test-trace-stream/imm32
306 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 .
307
308 e8/call check-ints-equal/disp32
309
310 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
311
312 c3/return
313
314