https://github.com/akkartik/mu/blob/main/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
98
99 55/push-ebp
100 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
101
102 50/push-eax
103 51/push-ecx
104 52/push-edx
105 53/push-ebx
106 56/push-esi
107 57/push-edi
108
109 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32
110 68/push 0x200/imm32/length
111 68/push 0/imm32/read
112 68/push 0/imm32/write
113 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
114
115 68/push 0/imm32/end
116 68/push 0/imm32/start
117 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
118
119 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
120
121 68/push 0/imm32
122 68/push 0/imm32
123 89/copy 3/mod/direct 6/rm32/esi . . . 4/r32/esp . .
124
125
126 56/push-esi
127 68/push 1/imm32
128 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Segment-size/disp32
129 68/push Heap/imm32
130
131 e8/call new-stream/disp32
132
133 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
134
135
136
137 ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 .
138 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
139
140 e8/call lookup/disp32
141
142 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
143
144 89/copy 3/mod/direct 7/rm32/edi . . . 0/r32/eax . .
145
146
147 68/push "\n== code\n"/imm32
148 57/push-edi
149
150 e8/call write/disp32
151
152 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
153
154
155 68/push "run-tests:\n"/imm32
156 57/push-edi
157
158 e8/call write/disp32
159
160 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
161 $subx-gen-run-tests:loop:
162
163
164 51/push-ecx
165
166 e8/call clear-stream/disp32
167
168 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
169
170
171 51/push-ecx
172 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
173
174 e8/call read-line-buffered/disp32
175
176 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
177 $subx-gen-run-tests:check0:
178
179 81 7/subop/compare 0/mod/indirect 1/rm32/ecx . . . . . 0/imm32
180 0f 84/jump-if-= $subx-gen-run-tests:break/disp32
181
182
183 52/push-edx
184 51/push-ecx
185
186 e8/call next-word/disp32
187
188 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
189 $subx-gen-run-tests:check-empty:
190
191
192 52/push-edx
193 e8/call slice-empty?/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 75/jump-if-!= $subx-gen-run-tests:loop/disp8
199 $subx-gen-run-tests:check-for-label:
200
201
202
203 52/push-edx
204
205 e8/call is-label?/disp32
206
207 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
208
209 3d/compare-eax-and 0/imm32/false
210 74/jump-if-= $subx-gen-run-tests:continue/disp8
211 $subx-gen-run-tests:check-label-prefix:
212
213 ff 1/subop/decrement 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
214
215
216 68/push "test-"/imm32
217 52/push-edx
218
219 e8/call slice-starts-with?/disp32
220
221 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
222
223 3d/compare-eax-and 0/imm32/false
224 74/jump-if-= $subx-gen-run-tests:continue/disp8
225 $subx-gen-run-tests:call-test-function:
226
227 bb/copy-to-ebx 1/imm32/true
228
229
230 68/push " e8/call "/imm32
231 57/push-edi
232
233 e8/call write/disp32
234
235 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
236
237
238 52/push-edx
239 57/push-edi
240
241 e8/call write-slice/disp32
242
243 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
244
245
246 68/push "/disp32\n"/imm32
247 57/push-edi
248
249 e8/call write/disp32
250
251 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
252 $subx-gen-run-tests:continue:
253
254
255 51/push-ecx
256
257 e8/call rewind-stream/disp32
258
259 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
260
261
262 51/push-ecx
263 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
264
265 e8/call write-stream-data/disp32
266
267 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
268
269 e9/jump $subx-gen-run-tests:loop/disp32
270 $subx-gen-run-tests:break:
271
272 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0/imm32/false
273 74/jump-if-= $subx-gen-run-tests:end/disp8
274
275
276 68/push " c3/return\n"/imm32
277 57/push-edi
278
279 e8/call write/disp32
280
281 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
282
283
284 57/push-edi
285 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
286
287 e8/call write-stream-data/disp32
288
289 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
290 $subx-gen-run-tests:end:
291
292
293 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
294
295 e8/call flush/disp32
296
297 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
298
299 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x21c/imm32
300
301 5f/pop-to-edi
302 5e/pop-to-esi
303 5b/pop-to-ebx
304 5a/pop-to-edx
305 59/pop-to-ecx
306 58/pop-to-eax
307
308 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
309 5d/pop-to-ebp
310 c3/return
311
312