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