https://github.com/akkartik/mu/blob/master/apps/tests.subx
1
2
3
4
5
6
7 == code
8
9
10
11
12 Entry:
13
14 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
15
16
17
18
19 68/push Heap/imm32
20 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Heap-size/disp32
21
22 e8/call new-segment/disp32
23
24 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
25
26
27 68/push 0x40000/imm32/256KB
28
29 e8/call initialize-trace-stream/disp32
30
31 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
32
33
34
35 81 7/subop/compare 1/mod/*+disp8 5/rm32/ebp . . . . 0/disp8 1/imm32
36 7e/jump-if-<= $subx-tests-main:interactive/disp8
37
38
39
40 68/push "test"/imm32
41 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
42
43 e8/call kernel-string-equal?/disp32
44
45 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
46
47 3d/compare-eax-and 0/imm32/false
48 74/jump-if-= $subx-tests-main:interactive/disp8
49
50 e8/call run-tests/disp32
51
52 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32
53 eb/jump $subx-tests-main:end/disp8
54 $subx-tests-main:interactive:
55
56
57
58 68/push Stdout/imm32
59 68/push Stdin/imm32
60
61 e8/call subx-gen-run-tests/disp32
62
63 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
64
65 bb/copy-to-ebx 0/imm32
66 $subx-tests-main:end:
67 e8/call syscall_exit/disp32
68
69 subx-gen-run-tests:
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97 55/push-ebp
98 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
99
100 50/push-eax
101 51/push-ecx
102 52/push-edx
103 53/push-ebx
104 56/push-esi
105 57/push-edi
106
107 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32
108 68/push 0x200/imm32/length
109 68/push 0/imm32/read
110 68/push 0/imm32/write
111 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
112
113 68/push 0/imm32/end
114 68/push 0/imm32/start
115 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
116
117 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
118
119 68/push 0/imm32
120 68/push 0/imm32
121 89/copy 3/mod/direct 6/rm32/esi . . . 4/r32/esp . .
122
123
124 56/push-esi
125 68/push 1/imm32
126 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Segment-size/disp32
127 68/push Heap/imm32
128
129 e8/call new-stream/disp32
130
131 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
132
133
134
135 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
136 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
137
138 e8/call lookup/disp32
139
140 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
141
142 89/copy 3/mod/direct 7/rm32/edi . . . 0/r32/eax . .
143
144
145 68/push "\n== code\n"/imm32
146 57/push-edi
147
148 e8/call write/disp32
149
150 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
151
152
153 68/push "run-tests:\n"/imm32
154 57/push-edi
155
156 e8/call write/disp32
157
158 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
159 $subx-gen-run-tests:loop:
160
161
162 51/push-ecx
163
164 e8/call clear-stream/disp32
165
166 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
167
168
169 51/push-ecx
170 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
171
172 e8/call read-line-buffered/disp32
173
174 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
175 $subx-gen-run-tests:check0:
176
177 81 7/subop/compare 0/mod/indirect 1/rm32/ecx . . . . . 0/imm32
178 0f 84/jump-if-= $subx-gen-run-tests:break/disp32
179
180
181 52/push-edx
182 51/push-ecx
183
184 e8/call next-word/disp32
185
186 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
187 $subx-gen-run-tests:check-for-label:
188
189
190
191 52/push-edx
192
193 e8/call is-label?/disp32
194
195 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
196
197 3d/compare-eax-and 0/imm32/false
198 74/jump-if-= $subx-gen-run-tests:continue/disp8
199 $subx-gen-run-tests:check-label-prefix:
200
201 ff 1/subop/decrement 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
202
203
204 68/push "test-"/imm32
205 52/push-edx
206
207 e8/call slice-starts-with?/disp32
208
209 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
210
211 3d/compare-eax-and 0/imm32/false
212 74/jump-if-= $subx-gen-run-tests:continue/disp8
213 $subx-gen-run-tests:call-test-function:
214
215 bb/copy-to-ebx 1/imm32/true
216
217
218 68/push " e8/call "/imm32
219 57/push-edi
220
221 e8/call write/disp32
222
223 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
224
225
226 52/push-edx
227 57/push-edi
228
229 e8/call write-slice/disp32
230
231 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
232
233
234 68/push "/disp32\n"/imm32
235 57/push-edi
236
237 e8/call write/disp32
238
239 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
240 $subx-gen-run-tests:continue:
241
242
243 51/push-ecx
244
245 e8/call rewind-stream/disp32
246
247 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
248
249
250 51/push-ecx
251 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
252
253 e8/call write-stream-data/disp32
254
255 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
256
257 e9/jump $subx-gen-run-tests:loop/disp32
258 $subx-gen-run-tests:break:
259
260 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0/imm32/false
261 74/jump-if-= $subx-gen-run-tests:end/disp8
262
263
264 68/push " c3/return\n"/imm32
265 57/push-edi
266
267 e8/call write/disp32
268
269 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
270
271
272 57/push-edi
273 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
274
275 e8/call write-stream-data/disp32
276
277 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
278 $subx-gen-run-tests:end:
279
280
281 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
282
283 e8/call flush/disp32
284
285 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
286
287 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x21c/imm32
288
289 5f/pop-to-edi
290 5e/pop-to-esi
291 5b/pop-to-ebx
292 5a/pop-to-edx
293 59/pop-to-ecx
294 58/pop-to-eax
295
296 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
297 5d/pop-to-ebp
298 c3/return
299
300