2020-07-14 05:21:26 +00:00
|
|
|
# 2-arg version of allocate-array.
|
2020-11-17 09:06:43 +00:00
|
|
|
# Really only intended to be called from code generated by mu.subx.
|
2020-07-14 05:21:26 +00:00
|
|
|
|
2020-09-07 20:51:54 +00:00
|
|
|
== code
|
|
|
|
|
2020-07-29 04:17:32 +00:00
|
|
|
allocate-array2: # ad: (addr allocation-descriptor), array-len: int, elem-size: int, out: (addr handle array _)
|
2020-07-14 05:21:26 +00:00
|
|
|
# . prologue
|
|
|
|
55/push-ebp
|
|
|
|
89/<- %ebp 4/r32/esp
|
|
|
|
# . save registers
|
|
|
|
50/push-eax
|
2020-08-22 21:35:44 +00:00
|
|
|
52/push-edx
|
2020-07-14 05:21:26 +00:00
|
|
|
#
|
|
|
|
8b/-> *(ebp+0xc) 0/r32/eax
|
2020-09-16 05:21:15 +00:00
|
|
|
f7 4/subop/multiply-into-edx-eax *(ebp+0x10)
|
2020-08-22 21:35:44 +00:00
|
|
|
# TODO: check edx for overflow
|
2020-07-14 05:21:26 +00:00
|
|
|
(allocate-array *(ebp+8) %eax *(ebp+0x14))
|
|
|
|
$allocate-array2:end:
|
|
|
|
# . restore registers
|
2020-08-22 21:35:44 +00:00
|
|
|
5a/pop-to-edx
|
2020-07-14 05:21:26 +00:00
|
|
|
58/pop-to-eax
|
|
|
|
# . epilogue
|
|
|
|
89/<- %esp 5/r32/ebp
|
|
|
|
5d/pop-to-ebp
|
|
|
|
c3/return
|