about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-04-10 15:14:34 -0700
committerKartik Agaram <vc@akkartik.com>2020-05-18 00:44:46 -0700
commitfb18cadaa765feb3f7d8b7ac7909dc89b4856ca5 (patch)
treea7628dc1996da9e4141a22570645b9b3ab207b30 /apps
parent5dc0ddfc9d1603ca9ee7a1d964e511113c93bc99 (diff)
downloadmu-fb18cadaa765feb3f7d8b7ac7909dc89b4856ca5.tar.gz
fix a crash when translating apps/ex1
Diffstat (limited to 'apps')
-rwxr-xr-xapps/surveybin54048 -> 54048 bytes
-rw-r--r--apps/survey.subx12
2 files changed, 6 insertions, 6 deletions
diff --git a/apps/survey b/apps/survey
index 90dc2786..526b0630 100755
--- a/apps/survey
+++ b/apps/survey
Binary files differdiff --git a/apps/survey.subx b/apps/survey.subx
index f2825525..94bd10ff 100644
--- a/apps/survey.subx
+++ b/apps/survey.subx
@@ -3177,7 +3177,7 @@ $emit-headers:end:
 emit-elf-header:  # out: (addr buffered-file), segments: (addr stream {(handle array byte), segment-info}), labels: (addr stream {(handle array byte), label-info})
     # pseudocode
     #   *$Elf_e_entry = get(labels, "Entry")->address
-    #   *$Elf_e_phnum = segments->write / 16         # size of a row
+    #   *$Elf_e_phnum = segments->write / 20         # size of a row
     #   emit-hex-array(out, Elf_header)
     #   write-buffered(out, "\n")
     #
@@ -3191,10 +3191,10 @@ emit-elf-header:  # out: (addr buffered-file), segments: (addr stream {(handle a
     # *$Elf_e_entry = get(labels, "Entry")->address
     # . eax = labels
     8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           0/r32/eax   0x10/disp8      .                 # copy *(ebp+16) to eax
-    # . label-info/eax = get(labels, "Entry", row-size=16, "label table")
+    # . label-info/eax = get(labels, "Entry", row-size=24, "label table")
     # . . push args
     68/push  "label table"/imm32
-    68/push  0x10/imm32/row-size
+    68/push  0x18/imm32/row-size
     68/push  "Entry"/imm32
     50/push-eax
     # . . call
@@ -3205,13 +3205,13 @@ emit-elf-header:  # out: (addr buffered-file), segments: (addr stream {(handle a
     8b/copy                         1/mod/*+disp8   0/rm32/eax    .           .             .           0/r32/eax   8/disp8         .                 # copy *(eax+8) to eax
     # . *$Elf_e_entry = eax
     89/copy                         0/mod/indirect  5/rm32/.disp32            .             .           0/r32/eax   $Elf_e_entry/disp32               # copy eax to *$Elf_e_entry
-    # *$Elf_e_phnum = segments->write / 0x10
+    # *$Elf_e_phnum = segments->write / 20
     # . eax = segments
     8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           0/r32/eax   0xc/disp8       .                 # copy *(ebp+12) to eax
     # . len/eax = segments->write
     8b/copy                         0/mod/indirect  0/rm32/eax    .           .             .           0/r32/eax   .               .                 # copy *eax to eax
-    # . eax = len / 0x10  (destroying edx)
-    b9/copy-to-ecx  0x10/imm32
+    # . eax = len / 20  (clobbering ecx and edx)
+    b9/copy-to-ecx  0x14/imm32
     31/xor                          3/mod/direct    2/rm32/edx    .           .             .           2/r32/edx   .               .                 # clear edx
     f7          7/subop/idiv        3/mod/direct    1/rm32/ecx    .           .             .           .           .               .                 # divide edx:eax by ecx, storing quotient in eax and remainder in edx
     # . *$Elf_e_phnum = eax