about summary refs log tree commit diff stats
path: root/linux
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-03-14 19:25:39 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-03-14 19:25:39 -0700
commit1dc1a65ea054159ba315f624e6c2f95ee83e6d44 (patch)
tree87a4ffed0d38f842f2d389fd19eb97bdee40f44e /linux
parent499aad0bc7360bb7f4de09600a183ac655611983 (diff)
downloadmu-1dc1a65ea054159ba315f624e6c2f95ee83e6d44.tar.gz
survey_baremetal: support /imm8
Diffstat (limited to 'linux')
-rwxr-xr-xlinux/survey_baremetalbin51427 -> 51449 bytes
-rw-r--r--linux/survey_baremetal.subx16
2 files changed, 14 insertions, 2 deletions
diff --git a/linux/survey_baremetal b/linux/survey_baremetal
index 47775832..c14bc7fc 100755
--- a/linux/survey_baremetal
+++ b/linux/survey_baremetal
Binary files differdiff --git a/linux/survey_baremetal.subx b/linux/survey_baremetal.subx
index 5dd502f0..1d904b22 100644
--- a/linux/survey_baremetal.subx
+++ b/linux/survey_baremetal.subx
@@ -1070,7 +1070,7 @@ $emit-output:check-metadata:
     # . esi = eax
     89/copy                         3/mod/direct    6/rm32/esi    .           .             .           0/r32/eax   .               .                 # copy eax to esi
 $emit-output:check-imm8:
-    # if (has-metadata?(word-slice, "imm8")) abort
+    # if (!has-metadata?(word-slice, "imm8")) goto next check
     # . eax = has-metadata?(edx, "imm8")
     # . . push args
     68/push  "imm8"/imm32
@@ -1081,7 +1081,19 @@ $emit-output:check-imm8:
     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
     # . if (eax != false) abort
     3d/compare-eax-and  0/imm32/false
-    0f 85/jump-if-!=  $emit-output:imm8-abort/disp32
+    74/jump-if-=  $emit-output:check-imm32/disp8
+$emit-output:emit-imm8:
+    # emit-hex(out, *address, 1)
+    # . . push args
+    68/push  1/imm32
+    ff          6/subop/push        0/mod/indirect  6/rm32/esi    .           .             .           .           .               .                 # push *esi
+    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
+    # . . call
+    e8/call  emit-hex/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
+    # continue
+    e9/jump  $emit-output:word-loop/disp32
 $emit-output:check-imm32:
     # if (!has-metadata?(word-slice, "imm32")) goto next check
     # . eax = has-metadata?(edx, "imm32")