about summary refs log tree commit diff stats
path: root/mu-init-test.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-03-15 21:03:12 -0700
committerKartik Agaram <vc@akkartik.com>2020-03-15 21:03:12 -0700
commitc48ce3c8bfb6d1578f2530ed84b8e7b25d435b6d (patch)
tree9a7b23b95d9960853aad1be4e6e95b12f300ade8 /mu-init-test.subx
parentf559236bdf9103c5f88d8dfc098f3afe3de64e4a (diff)
downloadmu-c48ce3c8bfb6d1578f2530ed84b8e7b25d435b6d.tar.gz
6153 - switch 'main' to use Mu strings
At the SubX level we have to put up with null-terminated kernel strings
for commandline args. But so far we haven't done much with them. Rather
than try to support them we'll just convert them transparently to standard
length-prefixed strings.

In the process I realized that it's not quite right to treat the combination
of argc and argv as an array of kernel strings. Argc counts the number
of elements, whereas the length of an array is usually denominated in bytes.
Diffstat (limited to 'mu-init-test.subx')
-rw-r--r--mu-init-test.subx8
1 files changed, 4 insertions, 4 deletions
diff --git a/mu-init-test.subx b/mu-init-test.subx
index 6cfe51b2..1b2d1683 100644
--- a/mu-init-test.subx
+++ b/mu-init-test.subx
@@ -1,10 +1,10 @@
 # Just a test stub for mu-init.subx
 #
 # Try it out like this:
-#   $ ./translate_subx init.linux 0*.subx mu-init.subx mu-init-test.subx
+#   $ ./translate_subx init.linux [0-9]*.subx mu-init.subx mu-init-test.subx
 #   $ ./a.elf  # should run all tests
 
-main:  # args: (address array kernel-string) -> result/ebx: int
+main:  # args: (addr array (addr array byte)) -> result/ebx: int
     # . prologue
     55/push-ebp
     89/<- %ebp 4/r32/esp
@@ -15,10 +15,10 @@ main:  # args: (address array kernel-string) -> result/ebx: int
     8b/-> *(ebp+8) 6/r32/esi
     {
       # if (argc <= 1) break
-      81 7/subop/compare *esi 1/imm32
+      81 7/subop/compare *esi 4/imm32
       7e/jump-if-<= break/disp8
       # if (argv[1] != "test") break
-      (kernel-string-equal? *(esi+8) "test")  # => eax
+      (string-equal? *(esi+8) "test")  # => eax
       3d/compare-eax-and 0/imm32
       74/jump-if-= break/disp8
       #