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