about summary refs log tree commit diff stats
path: root/308allocate-array.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-08-22 14:35:44 -0700
committerKartik Agaram <vc@akkartik.com>2020-08-22 14:35:44 -0700
commit15b9880136b6b4754a6e6498c81932e553246d9f (patch)
tree2ad3b055a2383ffbd980193310e0775b1d0c170c /308allocate-array.subx
parentdb894e7968808512392c46d62b2bee68b891db04 (diff)
downloadmu-15b9880136b6b4754a6e6498c81932e553246d9f.tar.gz
6727 - bugfix in a multiply instruction
Also more error-detection for this case all across the toolchain.
Diffstat (limited to '308allocate-array.subx')
-rw-r--r--308allocate-array.subx5
1 files changed, 4 insertions, 1 deletions
diff --git a/308allocate-array.subx b/308allocate-array.subx
index 01eb1dc3..2d3d1a9d 100644
--- a/308allocate-array.subx
+++ b/308allocate-array.subx
@@ -6,12 +6,15 @@ allocate-array2:  # ad: (addr allocation-descriptor), array-len: int, elem-size:
     89/<- %ebp 4/r32/esp
     # . save registers
     50/push-eax
+    52/push-edx
     #
     8b/-> *(ebp+0xc) 0/r32/eax
-    f7 4/subop/multiply-into 0/r32/eax *(ebp+0x10)
+    f7 4/subop/multiply-into-eax-edx *(ebp+0x10)
+    # TODO: check edx for overflow
     (allocate-array *(ebp+8) %eax *(ebp+0x14))
 $allocate-array2:end:
     # . restore registers
+    5a/pop-to-edx
     58/pop-to-eax
     # . epilogue
     89/<- %esp 5/r32/ebp