about summary refs log tree commit diff stats
path: root/mu-init.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-03-22 12:11:49 -0700
committerKartik Agaram <vc@akkartik.com>2020-05-18 00:44:46 -0700
commit546a92985f7da2491077d641a2c118b4af7f6913 (patch)
tree1e6ab75543a3028e78c9454fbb6bd6b6a076e0ee /mu-init.subx
parent1f38b75e31d713fc72a9d29d360fe5ad66ba22fe (diff)
downloadmu-546a92985f7da2491077d641a2c118b4af7f6913.tar.gz
start migrating handles to fat pointers
CI will fail from this commit onward. Currently working:
  $ bootstrap translate init.linux 0[4-7]*.subx 080zero-out.subx -o a.elf  &&  ./a.elf test
  $ bootstrap run a.elf test
  $ chmod +x a.elf;  ./a.elf test

Plan: migrate functions that used to return handles to pass in a new arg
of type (addr handle). That's a bit of a weird type. There should be few
of these functions. (Open question: do we even want to expose this type
in the Mu language?)

Functions that just need to read from heap without modifying the handle
will receive `(addr T)` or `(handle T)` types as arguments.

As I sanitize each new file, I need to update signatures for any new functions
and add them to a list. I also need to update calls to any functions on
the list.
Diffstat (limited to 'mu-init.subx')
-rw-r--r--mu-init.subx8
1 files changed, 6 insertions, 2 deletions
diff --git a/mu-init.subx b/mu-init.subx
index 2377822e..74d90b7a 100644
--- a/mu-init.subx
+++ b/mu-init.subx
@@ -27,9 +27,13 @@ $Entry:initialize-args:
     8b/-> *esi 2/r32/edx
     # argc is in words; convert it to bytes
     c1/shift 4/subop/left %edx 2/imm8
+    # var tmp/eax: handle
+    68/push 0/imm32
+    68/push 0/imm32
+    89/<- %eax 4/r32/esp
     # var args/edi: (addr array (addr array byte))
-    (allocate-array Heap %edx)  # => eax
-    89/<- %edi 0/r32/eax
+    (allocate-array Heap %edx %eax)
+    8b/-> *(eax+4) 7/r32/edi
     # var curr/ecx: (addr kernel-string) = argv
     8d/copy-address *(esi+4) 1/r32/ecx
     # var max/edx: (addr kernel-string) = argv+4+argc