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