https://github.com/akkartik/mu/blob/main/120allocate.subx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 == data
20
21
22
23 Handle-size:
24 8/imm32
25
26
27 Heap:
28
29 0x02000000/imm32
30
31 0x80000000/imm32
32
33 Next-alloc-id:
34 0x100/imm32
35
36 == code
37
38
39
40
41
42
43 allocate:
44
45 55/push-ebp
46 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
47
48 50/push-eax
49
50
51 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
52 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
53 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
54
55 e8/call allocate-raw/disp32
56
57 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
58
59 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0x10/disp8 .
60 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 0/r32/eax 4/disp8 .
61 05/add-to-eax 4/imm32
62
63
64 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
65 50/push-eax
66
67 e8/call zero-out/disp32
68
69 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
70 $allocate:end:
71
72 58/pop-to-eax
73
74 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
75 5d/pop-to-ebp
76 c3/return
77
78
79
80 allocate-raw:
81
82 55/push-ebp
83 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
84
85 50/push-eax
86 51/push-ecx
87 52/push-edx
88 53/push-ebx
89 56/push-esi
90 57/push-edi
91
92 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 .
93
94 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 2/r32/edx 0x10/disp8 .
95
96 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 3/r32/ebx 0xc/disp8 .
97
98 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Next-alloc-id/disp32
99 89/copy 0/mod/indirect 2/rm32/edx . . . 0/r32/eax . .
100
101 8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . .
102 $allocate-raw:save-payload-in-eax:
103 89/copy 1/mod/*+disp8 2/rm32/edx . . . 0/r32/eax 4/disp8 .
104
105 8b/copy 1/mod/*+disp8 2/rm32/edx . . . 7/r32/edi 4/disp8 .
106 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 6/r32/esi Next-alloc-id/disp32
107 89/copy 0/mod/indirect 7/rm32/edi . . . 6/r32/esi . .
108 $allocate-raw:increment-next-alloc-id:
109
110 ff 0/subop/increment 0/mod/indirect 5/rm32/.disp32 . . . Next-alloc-id/disp32
111
112
113 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 3/index/ebx . 0/r32/eax 4/disp8 .
114 3b/compare 1/mod/*+disp8 1/rm32/ecx . . . 0/r32/eax 4/disp8 .
115 73/jump-if->=-signed $allocate-raw:abort/disp8
116 $allocate-raw:commit:
117
118 89/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . .
119 $allocate-raw:end:
120
121 5f/pop-to-edi
122 5e/pop-to-esi
123 5b/pop-to-ebx
124 5a/pop-to-edx
125 59/pop-to-ecx
126 58/pop-to-eax
127
128 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
129 5d/pop-to-ebp
130 c3/return
131
132 $allocate-raw:abort:
133 (abort "allocate: failed")
134
135
136 test-allocate-raw-success:
137
138 55/push-ebp
139 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
140
141
142 89/<- %ecx 4/r32/esp
143
144 81 5/subop/subtract %esp 0x10/imm32
145 89/<- %edx 4/r32/esp
146
147 51/push-ecx
148 52/push-edx
149 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
150
151 8b/copy 0/mod/indirect 1/rm32/ecx . . . 3/r32/ebx . .
152
153 68/push 0/imm32
154 68/push 0/imm32
155 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
156
157 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Next-alloc-id/disp32 0x34/imm32
158
159
160 52/push-edx
161 68/push 3/imm32
162 51/push-ecx
163
164 e8/call allocate-raw/disp32
165
166 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
167
168
169 68/push "F - test-allocate-raw-success: sets alloc-id in handle"/imm32
170 68/push 0x34/imm32
171 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
172
173 e8/call check-ints-equal/disp32
174
175 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
176
177
178 68/push "F - test-allocate-raw-success: sets payload in handle"/imm32
179 53/push-ebx
180 ff 6/subop/push 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
181
182 e8/call check-ints-equal/disp32
183
184 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
185
186
187 68/push "F - test-allocate-raw-success: sets alloc-id in payload"/imm32
188 68/push 0x34/imm32
189 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
190
191 e8/call check-ints-equal/disp32
192
193 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
194
195
196 68/push "F - test-allocate-raw-success: increments Next-alloc-id"/imm32
197 68/push 0x35/imm32
198 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Next-alloc-id/disp32
199
200 e8/call check-ints-equal/disp32
201
202 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
203
204
205 68/push "F - test-allocate-raw-success: updates allocation descriptor"/imm32
206 68/push 7/imm32
207 8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . .
208 29/subtract 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
209 50/push-eax
210
211 e8/call check-ints-equal/disp32
212
213 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
214
215 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Next-alloc-id/disp32 0x100/imm32
216
217 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x20/imm32
218
219 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
220 5d/pop-to-ebp
221 c3/return
222
223 lookup:
224
225 55/push-ebp
226 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
227
228 51/push-ecx
229
230 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
231
232 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 .
233
234 81 7/subop/compare 3/mod/direct 1/rm32/ecx . . . . . 0/imm32
235 74/jump-if-= $lookup:end/disp8
236
237 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 .
238
239 39/compare 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
240 75/jump-if-!= $lookup:abort/disp8
241
242 05/add-to-eax 4/imm32
243 $lookup:end:
244
245 59/pop-to-ecx
246
247 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
248 5d/pop-to-ebp
249 c3/return
250
251 $lookup:abort:
252 (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 "lookup failed: (" 3 0)
253 (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 *(ebp+8) 3 0)
254 (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 ", " 3 0)
255 (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 *(ebp+0xc) 3 0)
256 (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 ") -> " 3 0)
257 (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 *eax 3 0)
258 (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 ". Contents of a few words starting from address 0: " 3 0)
259 b8/copy-to-eax 0/imm32
260 (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 *eax 2 0)
261 (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 " " 2 0)
262 40/increment-eax
263 (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 *eax 3 0)
264 (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 " " 2 0)
265 40/increment-eax
266 (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 *eax 3 0)
267 (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 " " 2 0)
268 40/increment-eax
269 (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 *eax 3 0)
270 (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 " " 2 0)
271 40/increment-eax
272 (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 *eax 3 0)
273 (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 " " 2 0)
274 40/increment-eax
275 (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 *eax 3 0)
276 (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 " " 2 0)
277 40/increment-eax
278 (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 *eax 3 0)
279 (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 " " 2 0)
280 40/increment-eax
281 (draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0 *eax 3 0)
282 (abort "\n")
283
284
285 test-lookup-success:
286
287 55/push-ebp
288 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
289
290
291 89/<- %ecx 4/r32/esp
292
293 81 5/subop/subtract %esp 0x10/imm32
294 89/<- %edx 4/r32/esp
295
296 51/push-ecx
297 52/push-edx
298 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
299
300 68/push 0/imm32/address
301 68/push 0/imm32/alloc-id
302 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
303
304 8b/copy 0/mod/indirect 3/rm32/ebx . . . 2/r32/edx . .
305
306
307 51/push-ecx
308 68/push 2/imm32/size
309 53/push-ebx
310
311 e8/call allocate-raw/disp32
312
313 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
314
315
316 ff 6/subop/push 1/mod/*+disp8 1/rm32/ecx . . . . 4/disp8 .
317 ff 6/subop/push 0/mod/indirect 1/rm32/ecx . . . . . .
318
319 e8/call lookup/disp32
320
321 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
322
323
324
325 68/push "F - test-lookup-success"/imm32
326 81 0/subop/add 3/mod/direct 2/rm32/edx . . . . . 4/imm32
327 52/push-edx
328 50/push-eax
329
330 e8/call check-ints-equal/disp32
331
332 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
333
334 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Next-alloc-id/disp32 0x100/imm32
335
336 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x20/imm32
337
338 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
339 5d/pop-to-ebp
340 c3/return
341
342 test-lookup-null-returns-null:
343
344 55/push-ebp
345 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
346
347 68/push 0/imm32/address
348 68/push 0/imm32/alloc-id
349 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
350
351
352 ff 6/subop/push 1/mod/*+disp8 1/rm32/ecx . . . . 4/disp8 .
353 ff 6/subop/push 0/mod/indirect 1/rm32/ecx . . . . . .
354
355 e8/call lookup/disp32
356
357 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
358
359
360 68/push "F - test-lookup-null-returns-null"/imm32
361 68/push 0/imm32
362 50/push-eax
363
364 e8/call check-ints-equal/disp32
365
366 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
367
368 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
369
370 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
371 5d/pop-to-ebp
372 c3/return
373
374 _pending-test-lookup-failure:
375
376 55/push-ebp
377 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
378
379
380 89/<- %ecx 4/r32/esp
381
382 81 5/subop/subtract %esp 0x10/imm32
383 89/<- %edx 4/r32/esp
384
385 51/push-ecx
386 52/push-edx
387 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
388
389 68/push 0/imm32/address
390 68/push 0/imm32/alloc-id
391 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
392
393 8b/copy 0/mod/indirect 6/rm32/esi . . . 3/r32/ebx . .
394
395
396
397 51/push-ecx
398 68/push 2/imm32/size
399 56/push-esi
400
401 e8/call allocate/disp32
402
403 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
404
405 89/copy 0/mod/indirect 6/rm32/esi . . . 3/r32/ebx . .
406
407
408 68/push 0/imm32/address
409 68/push 0/imm32/alloc-id
410 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
411
412
413 52/push-edx
414 68/push 2/imm32/size
415 56/push-esi
416
417 e8/call allocate/disp32
418
419 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
420
421
422 68/push "F - test-lookup-failure"/imm32
423 ff 6/subop/push 1/mod/*+disp8 2/rm32/ecx . . . . 4/disp8 .
424 ff 6/subop/push 1/mod/*+disp8 1/rm32/ecx . . . . 4/disp8 .
425
426 e8/call check-ints-equal/disp32
427
428 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
429
430
431 ff 6/subop/push 1/mod/*+disp8 1/rm32/ecx . . . . 4/disp8 .
432 ff 6/subop/push 0/mod/indirect 1/rm32/ecx . . . . . .
433
434 e8/call lookup/disp32
435
436
437 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
438
439 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Next-alloc-id/disp32 0x100/imm32
440
441 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x20/imm32
442
443 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
444 5d/pop-to-ebp
445 c3/return
446
447
448 handle-equal?:
449
450 55/push-ebp
451 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
452
453 51/push-ecx
454
455 b8/copy-to-eax 0/imm32/false
456 $handle-equal?:compare-alloc-id:
457
458 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 .
459
460 39/compare 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 0x10/disp8 .
461 75/jump-if-!= $handle-equal?:end/disp8
462 $handle-equal?:compare-address:
463
464 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 0xc/disp8 .
465
466 39/compare 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 0x14/disp8 .
467 75/jump-if-!= $handle-equal?:end/disp8
468 $handle-equal?:return-true:
469
470 b8/copy-to-eax 1/imm32/true
471 $handle-equal?:end:
472
473 59/pop-to-ecx
474
475 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
476 5d/pop-to-ebp
477 c3/return
478
479 copy-handle:
480
481 55/push-ebp
482 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
483
484 50/push-eax
485 51/push-ecx
486
487 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 0x10/disp8 .
488
489 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 8/disp8 .
490 89/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . .
491 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 .
492 89/copy 1/mod/*+disp8 1/rm32/ecx . . . 0/r32/eax 4/disp8 .
493 $copy-handle:end:
494
495 59/pop-to-ecx
496 58/pop-to-eax
497
498 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
499 5d/pop-to-ebp
500 c3/return
501
502
503 allocate-region:
504
505 55/push-ebp
506 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
507
508 50/push-eax
509 51/push-ecx
510
511
512 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
513 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
514 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
515
516 e8/call allocate/disp32
517
518 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
519
520 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0x10/disp8 .
521 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 0/r32/eax 4/disp8 .
522
523 05/add-to-eax 4/imm32
524
525 3d/compare-eax-and 0/imm32
526 74/jump-if-= $allocate-region:abort/disp8
527
528
529 89/copy 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . .
530 81 0/subop/add 3/mod/direct 1/rm32/ecx . . . . . 8/imm32
531 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
532
533 89/copy 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . .
534 03/add 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 0xc/disp8 .
535 89/copy 1/mod/*+disp8 0/rm32/eax . . . 1/r32/ecx 4/disp8 .
536
537 59/pop-to-ecx
538 58/pop-to-eax
539
540 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
541 5d/pop-to-ebp
542 c3/return
543
544
545
546
547
548
549
550 $allocate-region:abort:
551 (abort "allocate-region: failed to allocate")
552
553
554
555
556 allocate-array:
557
558 55/push-ebp
559 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
560
561 50/push-eax
562 51/push-ecx
563 52/push-edx
564
565 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 0xc/disp8 .
566
567 8d/copy-address 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 4/disp8 .
568
569
570 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
571 52/push-edx
572 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
573
574 e8/call allocate/disp32
575
576 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
577
578 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0x10/disp8 .
579 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 0/r32/eax 4/disp8 .
580
581 05/add-to-eax 4/imm32
582
583 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
584 $allocate-array:end:
585
586 5a/pop-to-edx
587 59/pop-to-ecx
588 58/pop-to-eax
589
590 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
591 5d/pop-to-ebp
592 c3/return
593
594 test-allocate-array:
595
596 55/push-ebp
597 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
598
599
600 89/<- %ecx 4/r32/esp
601
602 81 5/subop/subtract %esp 0x10/imm32
603 89/<- %edx 4/r32/esp
604
605 51/push-ecx
606 52/push-edx
607 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
608
609 8b/copy 0/mod/indirect 1/rm32/ecx . . . 3/r32/ebx . .
610
611 68/push 0/imm32
612 68/push 0/imm32
613 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
614
615 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Next-alloc-id/disp32 0x34/imm32
616
617
618 52/push-edx
619 68/push 3/imm32
620 51/push-ecx
621
622 e8/call allocate-array/disp32
623
624 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
625
626
627 68/push "F - test-allocate-array: sets alloc-id in handle"/imm32
628 68/push 0x34/imm32
629 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
630
631 e8/call check-ints-equal/disp32
632
633 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
634
635
636 68/push "F - test-allocate-array: sets payload in handle"/imm32
637 53/push-ebx
638 ff 6/subop/push 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
639
640 e8/call check-ints-equal/disp32
641
642 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
643
644
645 68/push "F - test-allocate-array: sets alloc-id in payload"/imm32
646 68/push 0x34/imm32
647 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
648
649 e8/call check-ints-equal/disp32
650
651 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
652
653
654 68/push "F - test-allocate-array: sets array size in payload"/imm32
655 68/push 3/imm32
656 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
657
658 e8/call check-ints-equal/disp32
659
660 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
661
662
663 68/push "F - test-allocate-array: increments Next-alloc-id"/imm32
664 68/push 0x35/imm32
665 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Next-alloc-id/disp32
666
667 e8/call check-ints-equal/disp32
668
669 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
670
671
672 68/push "F - test-allocate-array: updates allocation descriptor"/imm32
673 68/push 0xb/imm32
674 8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . .
675 29/subtract 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
676 50/push-eax
677
678 e8/call check-ints-equal/disp32
679
680 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
681
682 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Next-alloc-id/disp32 1/imm32
683
684 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x20/imm32
685
686 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
687 5d/pop-to-ebp
688 c3/return
689
690 copy-array:
691
692 55/push-ebp
693 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
694
695 50/push-eax
696 51/push-ecx
697 52/push-edx
698 56/push-esi
699
700 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
701
702 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . .
703 81 0/subop/add 3/mod/direct 1/rm32/ecx . . . . . 4/imm32
704
705
706 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
707 51/push-ecx
708 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
709
710 e8/call allocate/disp32
711
712 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
713
714 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0x10/disp8 .
715 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 0/r32/eax 4/disp8 .
716
717 05/add-to-eax 4/imm32
718
719 01/add 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . .
720
721
722 8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . .
723 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 2/index/edx . 2/r32/edx 4/disp8 .
724 52/push-edx
725
726 56/push-esi
727
728 51/push-ecx
729
730 50/push-eax
731
732 e8/call _append-4/disp32
733
734 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
735 $copy-array:end:
736
737 5e/pop-to-esi
738 5a/pop-to-edx
739 59/pop-to-ecx
740 58/pop-to-eax
741
742 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
743 5d/pop-to-ebp
744 c3/return
745
746 test-copy-array:
747
748 55/push-ebp
749 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
750
751 68/push 5/imm32
752 68/push 4/imm32
753 68/push 3/imm32
754 68/push 0xc/imm32/size
755 89/copy 3/mod/direct 6/rm32/esi . . . 4/r32/esp . .
756
757
758 89/<- %ecx 4/r32/esp
759
760 81 5/subop/subtract %esp 0x20/imm32
761 89/<- %edx 4/r32/esp
762
763 51/push-ecx
764 52/push-edx
765 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
766
767 8b/copy 0/mod/indirect 1/rm32/ecx . . . 3/r32/ebx . .
768
769 68/push 0/imm32
770 68/push 0/imm32
771 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
772
773 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Next-alloc-id/disp32 0x34/imm32
774
775
776 52/push-edx
777 56/push-esi
778 51/push-ecx
779
780 e8/call copy-array/disp32
781
782 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
783
784
785 68/push "F - test-copy-array: sets alloc-id in handle"/imm32
786 68/push 0x34/imm32
787 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
788
789 e8/call check-ints-equal/disp32
790
791 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
792
793
794 68/push "F - test-copy-array: sets payload in handle"/imm32
795 53/push-ebx
796 ff 6/subop/push 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
797
798 e8/call check-ints-equal/disp32
799
800 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
801
802
803 68/push "F - test-copy-array: sets alloc-id in payload"/imm32
804 68/push 0x34/imm32
805 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
806
807 e8/call check-ints-equal/disp32
808
809 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
810
811
812 ff 6/subop/push 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
813 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
814
815 e8/call lookup/disp32
816
817 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
818
819
820 68/push "F - test-copy-array: sets array size in payload"/imm32
821 68/push 0xc/imm32
822 ff 6/subop/push 0/mod/indirect 0/rm32/eax . . . . . .
823
824 e8/call check-ints-equal/disp32
825
826 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
827
828
829 68/push "F - test-copy-array: increments Next-alloc-id"/imm32
830 68/push 0x35/imm32
831 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Next-alloc-id/disp32
832
833 e8/call check-ints-equal/disp32
834
835 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
836
837
838 68/push "F - test-copy-array: updates allocation descriptor"/imm32
839 68/push 0x14/imm32
840 8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . .
841 29/subtract 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
842 50/push-eax
843
844 e8/call check-ints-equal/disp32
845
846 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
847
848 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Next-alloc-id/disp32 1/imm32
849
850 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x40/imm32
851
852 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
853 5d/pop-to-ebp
854 c3/return
855
856
857 zero-out:
858
859
860
861
862
863
864
865
866
867
868 55/push-ebp
869 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
870
871 50/push-eax
872 51/push-ecx
873 52/push-edx
874 56/push-esi
875
876 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
877
878 31/xor 3/mod/direct 1/rm32/ecx . . . 1/r32/ecx . .
879
880 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 2/r32/edx 0xc/disp8 .
881 $zero-out:loop:
882
883 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
884 7d/jump-if->= $zero-out:end/disp8
885
886 c6 0/subop/copy-byte 0/mod/direct 6/rm32/esi . . . . . 0/imm8
887
888 46/increment-esi
889
890 41/increment-ecx
891 eb/jump $zero-out:loop/disp8
892 $zero-out:end:
893
894 5e/pop-to-esi
895 5a/pop-to-edx
896 59/pop-to-ecx
897 58/pop-to-eax
898
899 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
900 5d/pop-to-ebp
901 c3/return
902
903 test-zero-out:
904
905 55/push-ebp
906 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
907
908 68/push 0x37363534/imm32
909 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
910
911
912 68/push 3/imm32/size
913 51/push-ecx
914
915 e8/call zero-out/disp32
916
917 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
918
919
920
921 68/push "F - test-zero-out"/imm32
922 68/push 0x37000000/imm32
923 ff 6/subop/push 0/mod/indirect 1/rm32/ecx . . . . . .
924
925 e8/call check-ints-equal/disp32
926
927 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
928
929 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
930
931 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
932 5d/pop-to-ebp
933 c3/return
934
935