about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-12-28 21:15:10 -0800
committerKartik Agaram <vc@akkartik.com>2020-12-28 21:16:08 -0800
commitcb7139956ee876f4070cba672610b2bbffe1931e (patch)
treea2d7c5ba99f4bceec0dd27b7f944500dba9133de /apps
parent5da03f118cf7c1accfc74b5a8dfff5e8a46a4fb9 (diff)
downloadmu-cb7139956ee876f4070cba672610b2bbffe1931e.tar.gz
7451
Diffstat (limited to 'apps')
-rwxr-xr-xapps/survey_baremetalbin56298 -> 56302 bytes
-rw-r--r--apps/survey_baremetal.subx24
-rwxr-xr-xapps/survey_elfbin56298 -> 56302 bytes
-rw-r--r--apps/survey_elf.subx24
4 files changed, 28 insertions, 20 deletions
diff --git a/apps/survey_baremetal b/apps/survey_baremetal
index 6a9257c6..7af84283 100755
--- a/apps/survey_baremetal
+++ b/apps/survey_baremetal
Binary files differdiff --git a/apps/survey_baremetal.subx b/apps/survey_baremetal.subx
index 3807254d..cfdfe712 100644
--- a/apps/survey_baremetal.subx
+++ b/apps/survey_baremetal.subx
@@ -1813,6 +1813,15 @@ $emit-output:end:
     5d/pop-to-ebp
     c3/return
 
+# global scratch space for emit-segments
+== data
+
+emit-segments:datum:  # slice
+  0/imm32/start
+  0/imm32/end
+
+== code
+
 emit-segments:  # in: (addr stream byte), out: (addr buffered-file), labels: (addr stream {(handle array byte), label-info})
     # pseudocode:
     #   var offset-of-next-instruction = 0
@@ -1865,7 +1874,6 @@ emit-segments:  # in: (addr stream byte), out: (addr buffered-file), labels: (ad
     #   line: ecx
     #   word-slice: edx
     #   offset-of-next-instruction: ebx
-    #   datum: edi
     #   info: esi (inner loop only)
     #   temporaries: eax, esi (outer loop)
     #
@@ -1889,10 +1897,6 @@ emit-segments:  # in: (addr stream byte), out: (addr buffered-file), labels: (ad
     68/push  0/imm32/end
     68/push  0/imm32/start
     89/copy                         3/mod/direct    2/rm32/edx    .           .             .           4/r32/esp   .               .                 # copy esp to edx
-    # var datum/edi: slice
-    68/push  0/imm32/end
-    68/push  0/imm32/start
-    89/copy                         3/mod/direct    7/rm32/edi    .           .             .           4/r32/esp   .               .                 # copy esp to edi
     # offset-of-next-instruction/ebx = 0
     31/xor                          3/mod/direct    3/rm32/ebx    .           .             .           3/r32/ebx   .               .                 # clear ebx
 $emit-segments:line-loop:
@@ -2075,9 +2079,9 @@ $emit-segments:2-character:
     e9/jump  $emit-segments:word-loop/disp32
 $emit-segments:check-metadata:
     # - if we get here, 'word-slice' must be a label to be looked up
-    # datum/edi = next-token-from-slice(word-slice->start, word-slice->end, "/")
+    # datum = next-token-from-slice(word-slice->start, word-slice->end, "/")
     # . . push args
-    57/push-edi
+    68/push  emit-segments:datum/imm32
     68/push  0x2f/imm32/slash
     ff          6/subop/push        1/mod/*+disp8   2/rm32/edx    .           .             .           .           4/disp8         .                 # push *(edx+4)
     ff          6/subop/push        0/mod/indirect  2/rm32/edx    .           .             .           .           .               .                 # push *edx
@@ -2096,7 +2100,7 @@ $emit-segments:check-metadata:
 #?     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
 #?     # . write-slice-buffered(Stderr, datum)
 #?     # . . push args
-#?     57/push-edi
+#?     68/push  emit-segments:datum/imm32
 #?     68/push  Stderr/imm32
 #?     # . . call
 #?     e8/call  write-slice-buffered/disp32
@@ -2123,7 +2127,7 @@ $emit-segments:check-metadata:
     # . . push args
     68/push  "label table"/imm32
     68/push  0x18/imm32/row-size
-    57/push-edi
+    68/push  emit-segments:datum/imm32
     ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x10/disp8      .                 # push *(ebp+16)
     # . . call
     e8/call  get-slice/disp32
@@ -2328,7 +2332,7 @@ $emit-segments:next-line:
     e9/jump  $emit-segments:line-loop/disp32
 $emit-segments:end:
     # . reclaim locals
-    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x21c/imm32       # add to esp
+    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x214/imm32       # add to esp
     # . restore registers
     5f/pop-to-edi
     5e/pop-to-esi
diff --git a/apps/survey_elf b/apps/survey_elf
index 6a9257c6..7af84283 100755
--- a/apps/survey_elf
+++ b/apps/survey_elf
Binary files differdiff --git a/apps/survey_elf.subx b/apps/survey_elf.subx
index b8d3a392..f84ca2b1 100644
--- a/apps/survey_elf.subx
+++ b/apps/survey_elf.subx
@@ -1820,6 +1820,15 @@ $emit-output:end:
     5d/pop-to-ebp
     c3/return
 
+# global scratch space for emit-segments
+== data
+
+emit-segments:datum:  # slice
+  0/imm32/start
+  0/imm32/end
+
+== code
+
 emit-segments:  # in: (addr stream byte), out: (addr buffered-file), labels: (addr stream {(handle array byte), label-info})
     # pseudocode:
     #   var offset-of-next-instruction = 0
@@ -1872,7 +1881,6 @@ emit-segments:  # in: (addr stream byte), out: (addr buffered-file), labels: (ad
     #   line: ecx
     #   word-slice: edx
     #   offset-of-next-instruction: ebx
-    #   datum: edi
     #   info: esi (inner loop only)
     #   temporaries: eax, esi (outer loop)
     #
@@ -1896,10 +1904,6 @@ emit-segments:  # in: (addr stream byte), out: (addr buffered-file), labels: (ad
     68/push  0/imm32/end
     68/push  0/imm32/start
     89/copy                         3/mod/direct    2/rm32/edx    .           .             .           4/r32/esp   .               .                 # copy esp to edx
-    # var datum/edi: slice
-    68/push  0/imm32/end
-    68/push  0/imm32/start
-    89/copy                         3/mod/direct    7/rm32/edi    .           .             .           4/r32/esp   .               .                 # copy esp to edi
     # offset-of-next-instruction/ebx = 0
     31/xor                          3/mod/direct    3/rm32/ebx    .           .             .           3/r32/ebx   .               .                 # clear ebx
 $emit-segments:line-loop:
@@ -2082,9 +2086,9 @@ $emit-segments:2-character:
     e9/jump  $emit-segments:word-loop/disp32
 $emit-segments:check-metadata:
     # - if we get here, 'word-slice' must be a label to be looked up
-    # datum/edi = next-token-from-slice(word-slice->start, word-slice->end, "/")
+    # datum = next-token-from-slice(word-slice->start, word-slice->end, "/")
     # . . push args
-    57/push-edi
+    68/push  emit-segments:datum/imm32
     68/push  0x2f/imm32/slash
     ff          6/subop/push        1/mod/*+disp8   2/rm32/edx    .           .             .           .           4/disp8         .                 # push *(edx+4)
     ff          6/subop/push        0/mod/indirect  2/rm32/edx    .           .             .           .           .               .                 # push *edx
@@ -2103,7 +2107,7 @@ $emit-segments:check-metadata:
 #?     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
 #?     # . write-slice-buffered(Stderr, datum)
 #?     # . . push args
-#?     57/push-edi
+#?     68/push  emit-segments:datum/imm32
 #?     68/push  Stderr/imm32
 #?     # . . call
 #?     e8/call  write-slice-buffered/disp32
@@ -2130,7 +2134,7 @@ $emit-segments:check-metadata:
     # . . push args
     68/push  "label table"/imm32
     68/push  0x18/imm32/row-size
-    57/push-edi
+    68/push  emit-segments:datum/imm32
     ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0x10/disp8      .                 # push *(ebp+16)
     # . . call
     e8/call  get-slice/disp32
@@ -2335,7 +2339,7 @@ $emit-segments:next-line:
     e9/jump  $emit-segments:line-loop/disp32
 $emit-segments:end:
     # . reclaim locals
-    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x21c/imm32       # add to esp
+    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x214/imm32       # add to esp
     # . restore registers
     5f/pop-to-edi
     5e/pop-to-esi