about summary refs log tree commit diff stats
path: root/linux
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-07-20 07:30:59 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-07-20 08:43:25 -0700
commit13ef425825cef5fa30f7eb68688b6d114ecbe554 (patch)
treea9853e61dd9fa39a4cf8f8c1ff5e79171e5ce9c3 /linux
parent5f254d0d02d8d6d61ca57ef4188110f11032a930 (diff)
downloadmu-13ef425825cef5fa30f7eb68688b6d114ecbe554.tar.gz
.
Diffstat (limited to 'linux')
-rw-r--r--linux/101_write.subx4
-rw-r--r--linux/102test.subx2
-rw-r--r--linux/103kernel-string-equal.subx2
-rw-r--r--linux/104new-segment.subx2
-rw-r--r--linux/105string-equal.subx2
-rw-r--r--linux/107trace.subx2
-rw-r--r--linux/110stop.subx2
-rw-r--r--linux/110stop.subx.231
-rw-r--r--linux/110stop.subx.0206
-rw-r--r--linux/111read.subx2
-rw-r--r--linux/112read-byte.subx2
-rw-r--r--linux/113write-stream.subx6
-rw-r--r--linux/115write-byte.subx2
-rw-r--r--linux/118parse-hex-int.subx2
-rw-r--r--linux/119error-byte.subx2
-rw-r--r--linux/120allocate.subx8
-rw-r--r--linux/121new-stream.subx2
-rw-r--r--linux/122read-line.subx4
-rw-r--r--linux/123slice.subx4
-rw-r--r--linux/126write-int-decimal.subx4
-rw-r--r--linux/131table.subx14
-rw-r--r--linux/132slurp.subx2
-rw-r--r--linux/202write-int.subx2
-rw-r--r--linux/203stack.subx6
-rw-r--r--linux/apps/ex11.subx2
-rw-r--r--linux/apps/ex5.subx2
-rw-r--r--linux/assort.subx4
-rw-r--r--linux/braces.subx4
-rw-r--r--linux/calls.subx20
-rw-r--r--linux/dquotes.subx4
-rw-r--r--linux/hex.subx4
-rw-r--r--linux/labels_baremetal.subx8
-rw-r--r--linux/mu.subx6
-rw-r--r--linux/pack.subx4
-rw-r--r--linux/random.subx6
-rw-r--r--linux/sigils.subx20
-rw-r--r--linux/survey_baremetal.subx8
-rw-r--r--linux/survey_elf.subx14
-rw-r--r--linux/tests.subx4
39 files changed, 94 insertions, 531 deletions
diff --git a/linux/101_write.subx b/linux/101_write.subx
index 2567f444..e1d64756 100644
--- a/linux/101_write.subx
+++ b/linux/101_write.subx
@@ -18,7 +18,7 @@ _write:  # fd: int, s: (addr array byte)
     51/push-ecx
     52/push-edx
     53/push-ebx
-    # syscall(write, fd, (data) s+4, (size) *s)
+    # syscall_write(fd, (data) s+4, (size) *s)
     # . ebx = fd
     8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           3/r32/ebx   8/disp8         .                 # copy *(ebp+8) to ebx
     # . var data/ecx: (addr byte) = s+4
@@ -45,7 +45,7 @@ $_write:end:
 
 $_write:abort:
     # can't write a message here for risk of an infinite loop, so we'll use a special exit code instead
-    # . syscall(exit, 255)
+    # . syscall_exit(255)
     bb/copy-to-ebx  0xff/imm32
     e8/call  syscall_exit/disp32
     # never gets here
diff --git a/linux/102test.subx b/linux/102test.subx
index 04fbea24..90207e29 100644
--- a/linux/102test.subx
+++ b/linux/102test.subx
@@ -15,7 +15,7 @@ Entry:  # manual test
     e8/call  check-ints-equal/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
-    # syscall(exit, 0)
+    # syscall_exit(0)
     bb/copy-to-ebx  0/imm32
     e8/call  syscall_exit/disp32
 
diff --git a/linux/103kernel-string-equal.subx b/linux/103kernel-string-equal.subx
index 842bf671..29dbb6e2 100644
--- a/linux/103kernel-string-equal.subx
+++ b/linux/103kernel-string-equal.subx
@@ -24,7 +24,7 @@
 
 Entry:  # run all tests
     e8/call  run-tests/disp32  # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
-    # syscall(exit, Num-test-failures)
+    # syscall_exit(Num-test-failures)
     8b/copy                         0/mod/indirect  5/rm32/.disp32            .             .           3/r32/ebx   Num-test-failures/disp32          # copy *Num-test-failures to ebx
     e8/call  syscall_exit/disp32
 
diff --git a/linux/104new-segment.subx b/linux/104new-segment.subx
index 4c249abe..723e1afb 100644
--- a/linux/104new-segment.subx
+++ b/linux/104new-segment.subx
@@ -33,7 +33,7 @@ Entry:   # manual test
     8b/copy                         0/mod/indirect  1/rm32/ecx    .           .             .           0/r32/eax   .               .                 # copy *ecx to eax
     # write to *eax to check that we have access to the newly-allocated segment
     c7          0/subop/copy        0/mod/direct    0/rm32/eax    .           .             .           .           .               0x34/imm32        # copy to *eax
-    # syscall(exit, eax)
+    # syscall_exit(eax)
     89/copy                         3/mod/direct    3/rm32/ebx    .           .             .           0/r32/eax   .               .                 # copy eax to ebx
     e8/call  syscall_exit/disp32
 
diff --git a/linux/105string-equal.subx b/linux/105string-equal.subx
index d3f11402..ae753855 100644
--- a/linux/105string-equal.subx
+++ b/linux/105string-equal.subx
@@ -8,7 +8,7 @@
 Entry:  # run all tests
 #?     e8/call test-compare-equal-strings/disp32
     e8/call  run-tests/disp32  # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
-    # syscall(exit, Num-test-failures)
+    # syscall_exit(Num-test-failures)
     8b/copy                         0/mod/indirect  5/rm32/.disp32            .             .           3/r32/ebx   Num-test-failures/disp32          # copy *Num-test-failures to ebx
     e8/call  syscall_exit/disp32
 
diff --git a/linux/107trace.subx b/linux/107trace.subx
index 457b77a0..b94746a5 100644
-- /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# Helpers for decimal ints.

# if slice doesn't contain a decimal number, return 0
parse-decimal-int-from-slice:  # in: (addr slice) -> out/eax: int
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # . save registers
    51/push-ecx
    # ecx = in
    8b/-> *(ebp+8) 1/r32/ecx
    #
    (parse-decimal-int-helper *ecx *(ecx+4))  # => eax
$parse-decimal-int-from-slice:end:
    # . restore registers
    59/pop-to-ecx
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

# if slice doesn't contain a decimal number, return 0
parse-decimal-int:  # in: (addr array byte) -> result/eax: int
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # . save registers
    51/push-ecx
    52/push-edx
    # eax = in
    8b/-> *(ebp+8) 0/r32/eax
    # var start/ecx: (addr byte) = &in->data
    8d/copy-address *(eax+4) 1/r32/ecx
    # var end/edx: (addr byte) = &in->data[in->size]
    8b/-> *eax 2/r32/edx
    8d/copy-address *(eax+edx+4) 2/r32/edx
    #
    (parse-decimal-int-helper %ecx %edx)  # => eax
$parse-decimal-int:end:
    # . restore registers
    5a/pop-to-edx
    59/pop-to-ecx
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

parse-decimal-int-from-stream:  # in: (addr stream byte) -> result/eax: int
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # . save registers
    51/push-ecx
    52/push-edx
    # eax = in
    8b/-> *(ebp+8) 0/r32/eax
    # var start/ecx: (addr byte) = &in->data[in->read]
    8b/-> *(eax+4) 1/r32/ecx
    8d/copy-address *(eax+ecx+0xc) 1/r32/ecx
    # var end/edx: (addr byte) = &in->data[in->write]
    8b/-> *eax 2/r32/edx
    8d/copy-address *(eax+edx+0xc) 2/r32/edx
    # trim a trailing newline
    {
      # speculatively trim
      4a/decrement-edx
      # if it's a newline, break
      8a/byte-> *edx 0/r32/eax
      25/and-eax-with 0xff/imm32
      3d/compare-eax-and 0xa/imm32/newline
      74/jump-if-= break/disp8
      # not a newline, so restore it
      42/increment-edx
    }
    #
    (parse-decimal-int-helper %ecx %edx)  # => eax
$parse-decimal-int-from-stream:end:
    # . restore registers
    5a/pop-to-edx
    59/pop-to-ecx
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

parse-decimal-int-helper:  # start: (addr byte), end: (addr byte) -> result/eax: int
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # . save registers
    51/push-ecx
    52/push-edx
    53/push-ebx
    56/push-esi
    57/push-edi
    # var curr/esi: (addr byte) = start
    8b/-> *(ebp+8) 6/r32/esi
    # edi = end
    8b/-> *(ebp+0xc) 7/r32/edi
    # var negate?/edx: boolean = false
    ba/copy-to-edx 0/imm32/false
    # if (*curr == '-') ++curr, negate = true
    {
$parse-decimal-int-helper:negative:
      b8/copy-to-eax 0/imm32
      8a/copy-byte *esi 0/r32/AL
      3d/compare-eax-and 0x2d/imm32/-
      75/jump-if-!= break/disp8
      # . ++curr
      46/increment-esi
      # . negate = true
      ba/copy-to-edx  1/imm32/true
    }
    # spill negate?
    52/push-edx
    # var result/eax: int = 0
    b8/copy-to-eax 0/imm32
    # var digit/ecx: int = 0
    b9/copy-to-ecx 0/imm32
    # const TEN/ebx: int = 10
    bb/copy-to-ebx 0xa/imm32
    {
$parse-decimal-int-helper:loop:
      # if (curr >= in->end) break
      39/compare %esi 7/r32/edi
      73/jump-if-addr>= break/disp8
      # if !decimal-digit?(*curr) return 0
      8a/copy-byte *esi 1/r32/CL
      50/push-eax
      (decimal-digit? %ecx)  # => eax
      {
        3d/compare-eax-and 0/imm32/false
        75/jump-if-!= break/disp8
        58/pop-to-eax
        b8/copy-to-eax 0/imm32
        eb/jump $parse-decimal-int-helper:negate/disp8
      }
      58/pop-to-eax
      # digit = from-decimal-char(*curr)
      81 5/subop/subtract %ecx 0x30/imm32/zero
      # TODO: error checking
      # result = result * 10 + digit
      ba/copy-to-edx 0/imm32
      f7 4/subop/multiply-into-edx-eax %ebx
      # TODO: check edx for overflow
      01/add %eax 1/r32/ecx
      # ++curr
      46/increment-esi
      #
      eb/jump loop/disp8
    }
$parse-decimal-int-helper:negate:
    # if (negate?) result = -result
    5a/pop-to-edx
    {
      81 7/subop/compare %edx 0/imm32/false
      74/jump-if-= break/disp8
      f7 3/subop/negate %eax
    }
$parse-decimal-int-helper:end:
    # . restore registers
    5f/pop-to-edi
    5e/pop-to-esi
    5b/pop-to-ebx
    5a/pop-to-edx
    59/pop-to-ecx
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

test-parse-decimal-int-from-slice-single-digit:
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # . save registers
    50/push-eax
    51/push-ecx
    # (eax..ecx) = "3"
    b8/copy-to-eax "3"/imm32
    8b/-> *eax 1/r32/ecx
    8d/copy-address *(eax+ecx+4) 1/r32/ecx
    05/add-to-eax 4/imm32
    # var slice/ecx: slice = {eax, ecx}
    51/push-ecx
    50/push-eax
    89/<- %ecx 4/r32/esp
    #
    (parse-decimal-int-from-slice %ecx)  # => eax
    (check-ints-equal %eax 3 "F - test-parse-decimal-int-from-slice-single-digit")
$test-parse-decimal-int-helper-single-digit:end:
    # . restore registers
    59/pop-to-ecx
    58/pop-to-eax
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

test-parse-decimal-int-from-slice-multi-digit:
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # . save registers
    50/push-eax
    51/push-ecx
    # (eax..ecx) = "34"
    b8/copy-to-eax "34"/imm32
    8b/-> *eax 1/r32/ecx
    8d/copy-address *(eax+ecx+4) 1/r32/ecx
    05/add-to-eax 4/imm32
    # var slice/ecx: slice = {eax, ecx}
    51/push-ecx
    50/push-eax
    89/<- %ecx 4/r32/esp
    #
    (parse-decimal-int-from-slice %ecx)  # => eax
    (check-ints-equal %eax 0x22 "F - test-parse-decimal-int-from-slice-multi-digit")  # 34 in hex
$test-parse-decimal-int-helper-multi-digit:end:
    # . restore registers
    59/pop-to-ecx
    58/pop-to-eax
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

test-parse-decimal-int-from-slice-zero:
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # . save registers
    50/push-eax
    51/push-ecx
    # (eax..ecx) = "00"
    b8/copy-to-eax "00"/imm32
    8b/-> *eax 1/r32/ecx
    8d/copy-address *(eax+ecx+4) 1/r32/ecx
    05/add-to-eax 4/imm32
    # var slice/ecx: slice = {eax, ecx}
    51/push-ecx
    50/push-eax
    89/<- %ecx 4/r32/esp
    #
    (parse-decimal-int-from-slice %ecx)  # => eax
    (check-ints-equal %eax 0 "F - test-parse-decimal-int-from-slice-zero")
$test-parse-decimal-int-helper-zero:end:
    # . restore registers
    59/pop-to-ecx
    58/pop-to-eax
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

test-parse-decimal-int-from-slice-negative:
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # . save registers
    50/push-eax
    51/push-ecx
    # (eax..ecx) = "-3"
    b8/copy-to-eax "-3"/imm32
    8b/-> *eax 1/r32/ecx
    8d/copy-address *(eax+ecx+4) 1/r32/ecx
    05/add-to-eax 4/imm32
    # var slice/ecx: slice = {eax, ecx}
    51/push-ecx
    50/push-eax
    89/<- %ecx 4/r32/esp
    #
    (parse-decimal-int-from-slice %ecx)  # => eax
    (check-ints-equal %eax -3 "F - test-parse-decimal-int-from-slice-negative")
$test-parse-decimal-int-helper-negative:end:
    # . restore registers
    59/pop-to-ecx
    58/pop-to-eax
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

test-parse-decimal-int-from-slice-multi-digit-negative:
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # . save registers
    50/push-eax
    51/push-ecx
    # (eax..ecx) = "-32"
    b8/copy-to-eax "-32"/imm32
    8b/-> *eax 1/r32/ecx
    8d/copy-address *(eax+ecx+4) 1/r32/ecx
    05/add-to-eax 4/imm32
    # var slice/ecx: slice = {eax, ecx}
    51/push-ecx
    50/push-eax
    89/<- %ecx 4/r32/esp
    #
    (parse-decimal-int-from-slice %ecx)  # => eax
    (check-ints-equal %eax -0x20 "F - test-parse-decimal-int-from-slice-multi-digit-negative")  # -32 in hex
$test-parse-decimal-int-helper-multi-digit-negative:end:
    # . restore registers
    59/pop-to-ecx
    58/pop-to-eax
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

decimal-size:  # n: int -> result/eax: int
    # pseudocode:
    #   edi = 0
    #   eax = n
    #   if eax < 0
    #     ++edi  # for '-'
    #     negate eax
    #   while true
    #     edx = 0
    #     eax, edx = eax/10, eax%10
    #     ++edi
    #     if (eax == 0) break
    #   eax = edi
    #
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # . save registers
    51/push-ecx
    52/push-edx
    57/push-edi
    # edi = 0
    bf/copy-to-edi 0/imm32
    # eax = n
    8b/-> *(ebp+8) 0/r32/eax
    # if (n < 0) negate n, increment edi
    {
      3d/compare-eax-with 0/imm32
      7d/jump-if->= break/disp8
      f7 3/subop/negate %eax
      47/increment-edi
    }
    # const ten/ecx = 10
    b9/copy-to-ecx  0xa/imm32
    {
      ba/copy-to-edx 0/imm32
      f7 7/subop/idiv-edx-eax-by %ecx  # eax = edx:eax/10; edx = edx:eax%10
      47/increment-edi
      3d/compare-eax-and 0/imm32
      75/jump-if-!= loop/disp8
    }
$decimal-size:end:
    89/<- %eax 7/r32/edi
    # . restore registers
    5f/pop-to-edi
    5a/pop-to-edx
    59/pop-to-ecx
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

test-decimal-size-of-zero:
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    #
    (decimal-size 0)  # => eax
    (check-ints-equal %eax 1 "F - test-decimal-size-of-zero")
$test-decimal-size-of-zero:end:
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

test-decimal-size-single-digit:
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    #
    (decimal-size 4)  # => eax
    (check-ints-equal %eax 1 "F - test-decimal-size-single-digit")
$test-decimal-size-single-digit:end:
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

test-decimal-size-multi-digit:
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    #
    (decimal-size 0xa)  # => eax
    (check-ints-equal %eax 2 "F - test-decimal-size-multi-digit")
$test-decimal-size-multi-digit:end:
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

test-decimal-size-single-digit-negative:
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    #
    (decimal-size -4)  # => eax
    (check-ints-equal %eax 2 "F - test-decimal-size-single-digit-negative")
$test-decimal-size-single-digit-negative:end:
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

test-decimal-size-multi-digit-negative:
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    #
    (decimal-size -0xa)  # => eax
    (check-ints-equal %eax 3 "F - test-decimal-size-multi-digit-negative")
$test-decimal-size-multi-digit-negative:end:
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

_parse-array-of-decimal-ints:  # ad: (addr allocation-descriptor), s: (addr array byte), out: (addr handle array int)
    # pseudocode
    #   end = &s->data[s->size]
    #   curr = s->data
    #   size = 0
    #   while true
    #     if (curr >= end) break
    #     curr = skip-chars-matching-in-slice(curr, end, ' ')
    #     if (curr >= end) break
    #     curr = skip-chars-not-matching-in-slice(curr, end, ' ')
    #     ++size
    #   allocate-array(ad, size*4, out)
    #   var slice: slice = {s->data, 0}
    #   curr = lookup(out)->data
    #   while true
    #     if (slice->start >= end) break
    #     slice->start = skip-chars-matching-in-slice(slice->start, end, ' ')
    #     if (slice->start >= end) break
    #     slice->end = skip-chars-not-matching-in-slice(slice->start, end, ' ')
    #     *curr = parse-hex-int-from-slice(slice)
    #     curr += 4
    #     slice->start = slice->end
    #   return result
    #
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # . save registers
    50/push-eax
    51/push-ecx
    52/push-edx
    53/push-ebx
    56/push-esi
    57/push-edi
    # esi = s
    8b/-> *(ebp+0xc) 6/r32/esi
    # var curr/ecx: (addr byte) = s->data
    8d/copy-address *(esi+4) 1/r32/ecx
    # var end/edx: (addr byte) = &s->data[s->size]
    # . edx = s->size
    8b/-> *esi 2/r32/edx
    # . edx += curr
    01/add-to %edx 1/r32/ecx
    # var size/ebx: int = 0
    31/xor-with %ebx 3/r32/ebx
$_parse-array-of-decimal-ints:loop1:
    # if (curr >= end) break
    39/compare %ecx 2/r32/edx
    73/jump-if-addr>= $_parse-array-of-decimal-ints:break1/disp8
    # curr = skip-chars-matching-in-slice(curr, end, ' ')
    (skip-chars-matching-in-slice %ecx %edx 0x20)  # => eax
    89/<- %ecx 0/r32/eax
    # if (curr >= end) break
    39/compare %ecx 2/r32/edx
    73/jump-if-addr>= $_parse-array-of-decimal-ints:break1/disp8
    # curr = skip-chars-not-matching-in-slice(curr, end, ' ')
    (skip-chars-not-matching-in-slice %ecx %edx 0x20)  # => eax
    89/<- %ecx 0/r32/eax
    # size += 4
    81 0/subop/add %ebx 4/imm32
    eb/jump $_parse-array-of-decimal-ints:loop1/disp8
$_parse-array-of-decimal-ints:break1:
    (allocate-array *(ebp+8) %ebx *(ebp+0x10))
$_parse-array-of-decimal-ints:pass2:
    # var slice/edi: slice = {s->data, 0}
    68/push 0/imm32/end
    8d/copy-address *(esi+4) 7/r32/edi
    57/push-edi
    89/<- %edi 4/r32/esp
    # curr = lookup(out)->data
    8b/-> *(ebp+0x10) 0/r32/eax
    (lookup *eax *(eax+4))  # => eax
    8d/copy-address *(eax+4) 1/r32/ecx
$_parse-array-of-decimal-ints:loop2:
    # if (slice->start >= end) break
    39/compare *edi 2/r32/edx
    73/jump-if-addr>= $_parse-array-of-decimal-ints:end/disp8
    # slice->start = skip-chars-matching-in-slice(slice->start, end, ' ')
    (skip-chars-matching-in-slice *edi %edx 0x20)  # => eax
    89/<- *edi 0/r32/eax
    # if (slice->start >= end) break
    39/compare *edi 2/r32/edx
    73/jump-if-addr>= $_parse-array-of-decimal-ints:end/disp8
    # slice->end = skip-chars-not-matching-in-slice(slice->start, end, ' ')
    (skip-chars-not-matching-in-slice *edi %edx 0x20)  # => eax
    89/<- *(edi+4) 0/r32/eax
    # *curr = parse-hex-int-from-slice(slice)
    (parse-decimal-int-from-slice %edi)
    89/<- *ecx 0/r32/eax
    # curr += 4
    81 0/subop/add %ecx 4/imm32
    # slice->start = slice->end
    8b/-> *(edi+4) 0/r32/eax
    89/<- *edi 0/r32/eax
    eb/jump $_parse-array-of-decimal-ints:loop2/disp8
$_parse-array-of-decimal-ints:end:
    # . reclaim locals
    81 0/subop/add %esp 8/imm32
    # . restore registers
    5f/pop-to-edi
    5e/pop-to-esi
    5b/pop-to-ebx
    5a/pop-to-edx
    59/pop-to-ecx
    58/pop-to-eax
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

test-parse-array-of-decimal-ints:
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # var h/esi: (handle array int)
    68/push 0/imm32
    68/push 0/imm32
    89/<- %esi 4/r32/esp
    # var ecx: (array int) = [1, 2, 3]
    68/push 3/imm32
    68/push 2/imm32
    68/push 1/imm32
    68/push 0xc/imm32/size
    89/<- %ecx 4/r32/esp
    #
    (_parse-array-of-decimal-ints Heap "1 2 3" %esi)
    (lookup *esi *(esi+4))  # => eax
    (array-equal? %ecx %eax)  # => eax
    (check-ints-equal %eax 1 "F - test-parse-array-of-decimal-ints")
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

test-parse-array-of-decimal-ints-empty:
    # - empty string = empty array
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # var h/esi: handle
    68/push 0/imm32
    68/push 0/imm32
    89/<- %esi 4/r32/esp
    #
    (_parse-array-of-decimal-ints Heap "" %esi)
    (lookup *esi *(esi+4))  # => eax
    (check-ints-equal *eax 0 "F - test-parse-array-of-decimal-ints-empty")
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

test-parse-array-of-decimal-ints-just-whitespace:
    # - just whitespace = empty array
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # var h/esi: handle
    68/push 0/imm32
    68/push 0/imm32
    89/<- %esi 4/r32/esp
    #
    (_parse-array-of-decimal-ints Heap Space %esi)
    (lookup *esi *(esi+4))  # => eax
    (check-ints-equal *eax 0 "F - test-parse-array-of-decimal-ints-just-whitespace")
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

test-parse-array-of-decimal-ints-extra-whitespace:
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    # var h/esi: handle
    68/push 0/imm32
    68/push 0/imm32
    89/<- %esi 4/r32/esp
    # var ecx: (array int) = [1, 2, 3]
    68/push 3/imm32
    68/push 2/imm32
    68/push 1/imm32
    68/push 0xc/imm32/size
    89/<- %ecx 4/r32/esp
    #
    (_parse-array-of-decimal-ints Heap " 1 2  3  " %esi)
    (lookup *esi *(esi+4))  # => eax
    (array-equal? %ecx %eax)  # => eax
    (check-ints-equal %eax 1 "F - test-parse-array-of-decimal-ints-extra-whitespace")
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return

parse-array-of-decimal-ints:  # s: (addr array byte), out: (addr handle array int)
    # . prologue
    55/push-ebp
    89/<- %ebp 4/r32/esp
    #
    (_parse-array-of-decimal-ints Heap *(ebp+8) *(ebp+0xc))
$parse-array-of-decimal-ints:end:
    # . epilogue
    89/<- %esp 5/r32/ebp
    5d/pop-to-ebp
    c3/return
an> - c3/return - -_test-stop-2: # ed : (address exit-descriptor) - # . prolog - 55/push-EBP - 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - # . stop(ed, 1) - # . . push args - 68/push 1/imm32 - ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 . # push *(EBP+8) - # . . call - e8/call stop/disp32 - # should never get past this point -$_test-stop-2:dead-end: - # . epilog - 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP - 5d/pop-to-EBP - c3/return - -# . . vim:nowrap:textwidth=0 diff --git a/linux/110stop.subx.0 b/linux/110stop.subx.0 deleted file mode 100644 index dbe8a663..00000000 --- a/linux/110stop.subx.0 +++ /dev/null @@ -1,206 +0,0 @@ -# stop: dependency-injected wrapper around the exit() syscall -# -# We'd like to be able to write tests for functions that call exit(), and to -# make assertions about whether they exit() or not in a given situation. To -# achieve this we'll call exit() via a smarter wrapper called 'stop'. -# -# In the context of a test, calling a function X that calls 'stop' (directly -# or through further intervening calls) will unwind the stack until X returns, -# so that we can say check any further assertions after the execution of X. To -# achieve this end, we'll pass the return address of X as a 'target' argument -# into X, plumbing it through to 'stop'. When 'stop' gets a non-null target it -# unwinds the stack until the target. If it gets a null target it calls -# exit(). -# -# We'd also like to get the exit status out of 'stop', so we'll combine the -# input target with an output status parameter into a type called 'exit-descriptor'. -# -# So the exit-descriptor looks like this: -# target : address # return address for 'stop' to unwind to -# value : int # exit status stop was called with -# -# 'stop' thus takes two parameters: an exit-descriptor and the exit status. -# -# 'stop' won't bother cleaning up any other processor state besides the stack, -# such as registers. Only ESP will have a well-defined value after 'stop' -# returns. (This is a poor man's setjmp/longjmp, if you know what that is.) -# -# Before you can call any function that may call 'stop', you need to pass in an -# exit-descriptor to it. To create an exit-descriptor use 'tailor-exit-descriptor' -# below. It's not the most pleasant abstraction in the world. -# -# An exit-descriptor's target is its input, computed during 'tailor-exit-descriptor'. -# Its value is its output, computed during stop and available to the test. - -== code -# instruction effective address register displacement immediate -# . op subop mod rm32 base index scale r32 -# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes - -# Configure an exit-descriptor for a call pushing 'nbytes' bytes of args to -# the stack. -# Ugly that we need to know the size of args, but so it goes. -tailor-exit-descriptor: # ed : (address exit-descriptor), nbytes : int -> <void> - # . prolog - 55/push-EBP - 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - # . save registers - 50/push-EAX - 51/push-ECX - # EAX = nbytes - 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 0/r32/EAX 0xc/disp8 . # copy *(EBP+12) to EAX - # Let X be the value of ESP in the caller, before the call to tailor-exit-descriptor. - # The return address for a call in the caller's body will be at: - # X-8 if the caller takes 4 bytes of args for the exit-descriptor (add 4 bytes for the return address) - # X-12 if the caller takes 8 bytes of args - # ..and so on - # That's the value we need to return: X-nbytes-4 - # - # However, we also need to account for the perturbance to ESP caused by the - # call to tailor-exit-descriptor. It pushes 8 bytes of args followed by 4 - # bytes for the return address and 4 bytes to push EBP above. - # So EBP at this point is X-16. - # - # So the return address for the next call in the caller is: - # EBP+8 if the caller takes 4 bytes of args - # EBP+4 if the caller takes 8 bytes of args - # EBP if the caller takes 12 bytes of args - # EBP-4 if the caller takes 16 bytes of args - # ..and so on - # That's EBP+12-nbytes. - # option 1: 6 + 3 bytes -#? 2d/subtract 3/mod/direct 0/rm32/EAX . . . . . 8/imm32 # subtract from EAX -#? 8d/copy-address 0/mod/indirect 4/rm32/sib 5/base/EBP 0/index/EAX . 0/r32/EAX . . # copy EBP+EAX to EAX - # option 2: 2 + 4 bytes - f7 3/subop/negate 3/mod/direct 0/rm32/EAX . . . . . . # negate EAX - 8d/copy-address 1/mod/*+disp8 4/rm32/sib 5/base/EBP 0/index/EAX . 0/r32/EAX 0xc/disp8 . # copy EBP+EAX+12 to EAX - # copy EAX to ed->target - 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 1/r32/ECX 8/disp8 . # copy *(EBP+8) to ECX - 89/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . . # copy EAX to *ECX - # initialize ed->value - c7 0/subop/copy 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 0/imm32 # copy to *(ECX+4) -$tailor-exit-descriptor:end: - # . restore registers - 59/pop-to-ECX - 58/pop-to-EAX - # . epilog - 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP - 5d/pop-to-EBP - c3/return - -stop: # ed : (address exit-descriptor), value : int - # no prolog; one way or another, we're going to clobber registers - # EAX = ed - 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none . 0/r32/EAX 4/disp8 . # copy *(ESP+4) to EAX - # if (ed->target == 0) really exit - 81 7/subop/compare 0/mod/indirect 0/rm32/EAX . . . . . 0/imm32 # compare *EAX - 75/jump-if-not-equal $stop:fake/disp8 - # . syscall(exit, value) - 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none . 3/r32/EBX 8/disp8 . # copy *(ESP+8) to EBX - b8/copy-to-EAX 1/imm32/exit - cd/syscall 0x80/imm8 -$stop:fake: - # otherwise: - # ed->value = value+1 - 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none . 1/r32/ECX 8/disp8 . # copy *(ESP+8) to ECX - 41/increment-ECX - 89/copy 1/mod/*+disp8 0/rm32/EAX . . . 1/r32/ECX 4/disp8 . # copy ECX to *(EAX+4) - # perform a non-local jump to ed->target - 8b/copy 0/mod/indirect 0/rm32/EAX . . . 4/r32/ESP . . # copy *EAX to ESP -$stop:end: - c3/return # doesn't return to caller - -test-stop-skips-returns-on-exit: - # This looks like the standard prolog, but is here for different reasons. - # A function calling 'stop' can't rely on EBP persisting past the call. - # - # Use EBP here as a stable base to refer to locals and arguments from in the - # presence of push/pop/call instructions. - # *Don't* use EBP as a way to restore ESP. - 55/push-EBP - 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - # Make room for an exit descriptor on the stack. That's almost always the - # right place for it, available only as long as it's legal to use. Once this - # containing function returns we'll need a new exit descriptor. - # var ed/EAX : (address exit-descriptor) - 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # subtract from ESP - 89/copy 3/mod/direct 0/rm32/EAX . . . 4/r32/ESP . . # copy ESP to EAX - # Size the exit-descriptor precisely for the next call below, to _test-stop-1. - # tailor-exit-descriptor(ed, 4) - # . . push args - 68/push 4/imm32/nbytes-of-args-for-_test-stop-1 - 50/push-EAX - # . . call - e8/call tailor-exit-descriptor/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # . _test-stop-1(ed) - # . . push args - 50/push-EAX - # . . call - e8/call _test-stop-1/disp32 - # registers except ESP may be clobbered at this point - # restore args - 58/pop-to-EAX - # check that _test-stop-1 tried to call exit(1) - # check-ints-equal(ed->value, 2, msg) # i.e. stop was called with value 1 - # . . push args - 68/push "F - test-stop-skips-returns-on-exit"/imm32 - 68/push 2/imm32 - # . . push ed->value - ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 . # push *(EAX+4) - # . . call - e8/call check-ints-equal/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP - # . epilog - # don't restore ESP from EBP; manually reclaim locals - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - 5d/pop-to-EBP - c3/return - -_test-stop-1: # ed : (address exit-descriptor) - # . prolog - 55/push-EBP - 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - # _test-stop-2(ed) - # . . push args - ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 . # push *(EBP+8) - # . . call - e8/call _test-stop-2/disp32 - # should never get past this point -$_test-stop-1:dead-end: - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # signal test failed: check-ints-equal(1, 0, msg) - # . . push args - 68/push "F - test-stop-skips-returns-on-exit"/imm32 - 68/push 0/imm32 - 68/push 1/imm32 - # . . call - e8/call check-ints-equal/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP - # . epilog - 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP - 5d/pop-to-EBP - c3/return - -_test-stop-2: # ed : (address exit-descriptor) - # . prolog - 55/push-EBP - 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - # . stop(ed, 1) - # . . push args - 68/push 1/imm32 - ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 . # push *(EBP+8) - # . . call - e8/call stop/disp32 - # should never get past this point -$_test-stop-2:dead-end: - # . epilog - 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP - 5d/pop-to-EBP - c3/return - -# . . vim:nowrap:textwidth=0 diff --git a/linux/111read.subx b/linux/111read.subx index 1f5a557d..43426fde 100644 --- a/linux/111read.subx +++ b/linux/111read.subx @@ -210,7 +210,7 @@ _read: # fd: int, s: (addr stream byte) -> num-bytes-read/eax: int 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . . # copy *esi to eax # edx = s->size 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 8/disp8 . # copy *(esi+8) to edx - # syscall(read, fd, &s->data[s->write], s->size - s->write) + # syscall_read(fd, &s->data[s->write], s->size - s->write) # . . fd: ebx 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 3/r32/ebx 8/disp8 . # copy *(ebp+8) to ebx # . . data: ecx = &s->data[s->write] diff --git a/linux/112read-byte.subx b/linux/112read-byte.subx index 7510a9e8..ea6700b9 100644 --- a/linux/112read-byte.subx +++ b/linux/112read-byte.subx @@ -307,7 +307,7 @@ $read-byte:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/113write-stream.subx b/linux/113write-stream.subx index d7e975c0..a217f052 100644 --- a/linux/113write-stream.subx +++ b/linux/113write-stream.subx @@ -10,7 +10,7 @@ #? 68/push _test-stream2/imm32 #? 68/push 1/imm32/stdout #? e8/call write-stream/disp32 -#? # syscall(exit, Num-test-failures) +#? # syscall_exit(Num-test-failures) #? 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx #? e8/call syscall_exit/disp32 @@ -91,7 +91,7 @@ _write-stream: # fd: int, s: (addr stream byte) 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 7/r32/edi 4/disp8 . # copy *(esi+4) to edi # edx = s->write 8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . . # copy *esi to edx - # syscall(write, fd, &s->data[s->read], s->write - s->read) + # syscall_write(fd, &s->data[s->read], s->write - s->read) # . . fd: ebx 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 3/r32/ebx 8/disp8 . # copy *(ebp+8) to ebx # . . data: ecx = &s->data[s->read] @@ -126,7 +126,7 @@ $_write-stream:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/115write-byte.subx b/linux/115write-byte.subx index d38db24c..08d656e8 100644 --- a/linux/115write-byte.subx +++ b/linux/115write-byte.subx @@ -247,7 +247,7 @@ $append-byte:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/118parse-hex-int.subx b/linux/118parse-hex-int.subx index ac911d97..c37d14ce 100644 --- a/linux/118parse-hex-int.subx +++ b/linux/118parse-hex-int.subx @@ -930,7 +930,7 @@ $from-hex-char:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/119error-byte.subx b/linux/119error-byte.subx index 1ce0a3d6..0e4f1c59 100644 --- a/linux/119error-byte.subx +++ b/linux/119error-byte.subx @@ -18,7 +18,7 @@ #? 68/push Stderr/imm32 #? 50/push-eax #? e8/call error-byte/disp32 -#? # . syscall(exit, Num-test-failures) +#? # . syscall_exit(Num-test-failures) #? 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx #? e8/call syscall_exit/disp32 diff --git a/linux/120allocate.subx b/linux/120allocate.subx index 11de944b..254c5f33 100644 --- a/linux/120allocate.subx +++ b/linux/120allocate.subx @@ -57,7 +57,7 @@ Entry: e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'. $array-equal-main:end: - # syscall(exit, Num-test-failures) + # syscall_exit(Num-test-failures) 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx e8/call syscall_exit/disp32 @@ -161,7 +161,7 @@ $allocate-raw:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -292,7 +292,7 @@ $lookup:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32/exit-status e8/call syscall_exit/disp32 @@ -574,7 +574,7 @@ $allocate-region:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/121new-stream.subx b/linux/121new-stream.subx index 41d1c31b..83bb9a2b 100644 --- a/linux/121new-stream.subx +++ b/linux/121new-stream.subx @@ -66,7 +66,7 @@ $new-stream:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/122read-line.subx b/linux/122read-line.subx index 02dcc0fd..fecd2942 100644 --- a/linux/122read-line.subx +++ b/linux/122read-line.subx @@ -102,7 +102,7 @@ $read-line-buffered:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -286,7 +286,7 @@ $read-line:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/123slice.subx b/linux/123slice.subx index c3a4943a..f23abc24 100644 --- a/linux/123slice.subx +++ b/linux/123slice.subx @@ -856,7 +856,7 @@ $write-slice:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -1120,7 +1120,7 @@ $slice-to-string:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/126write-int-decimal.subx b/linux/126write-int-decimal.subx index bff585a7..04f8b021 100644 --- a/linux/126write-int-decimal.subx +++ b/linux/126write-int-decimal.subx @@ -122,7 +122,7 @@ $write-int32-decimal:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -458,7 +458,7 @@ $to-decimal-digit:abort: e8/call flush/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/131table.subx b/linux/131table.subx index 018e37ef..aa47204b 100644 --- a/linux/131table.subx +++ b/linux/131table.subx @@ -122,7 +122,7 @@ $get:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -313,7 +313,7 @@ $get-slice:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -530,7 +530,7 @@ $get-or-insert:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -816,7 +816,7 @@ $get-or-insert-handle:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -1133,7 +1133,7 @@ $get-or-insert-slice:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -1434,7 +1434,7 @@ $get-or-stop:stop: $get-or-stop:terminus: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # syscall(exit, 1) + # syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 @@ -1660,7 +1660,7 @@ $get-slice-or-stop:stop: $get-slice-or-stop:terminus: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # syscall(exit, 1) + # syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 diff --git a/linux/132slurp.subx b/linux/132slurp.subx index ed590fa0..b4043d9e 100644 --- a/linux/132slurp.subx +++ b/linux/132slurp.subx @@ -98,7 +98,7 @@ $slurp:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/202write-int.subx b/linux/202write-int.subx index 97e681c7..745c34ef 100644 --- a/linux/202write-int.subx +++ b/linux/202write-int.subx @@ -45,7 +45,7 @@ $write-int:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/203stack.subx b/linux/203stack.subx index 965f7301..039aca08 100644 --- a/linux/203stack.subx +++ b/linux/203stack.subx @@ -158,7 +158,7 @@ $push:abort: e8/call flush/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -276,7 +276,7 @@ $pop:abort: e8/call flush/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -377,7 +377,7 @@ $top:abort: e8/call flush/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/apps/ex11.subx b/linux/apps/ex11.subx index 434d824d..67eb790f 100644 --- a/linux/apps/ex11.subx +++ b/linux/apps/ex11.subx @@ -316,7 +316,7 @@ write-stderr: # s: (addr array byte) -> <void> 51/push-ecx 52/push-edx 53/push-ebx - # syscall(write, 2/stderr, (data) s+4, (size) *s) + # syscall_write(2/stderr, (data) s+4, (size) *s) # . . fd = 2 (stderr) bb/copy-to-ebx 2/imm32 # . . x = s+4 diff --git a/linux/apps/ex5.subx b/linux/apps/ex5.subx index d7bab0ce..f9bbc661 100644 --- a/linux/apps/ex5.subx +++ b/linux/apps/ex5.subx @@ -24,7 +24,7 @@ Entry: # . syscall e8/call syscall_read/disp32 - # syscall(write, stdout, x, 1) + # syscall_write(stdout, x, 1) # . fd = 1 (stdout) bb/copy-to-ebx 1/imm32 # . data = x (location to read from) diff --git a/linux/assort.subx b/linux/assort.subx index d69a3bd9..2e656429 100644 --- a/linux/assort.subx +++ b/linux/assort.subx @@ -55,7 +55,7 @@ Entry: # run tests if necessary, convert stdin if not 74/jump-if-= $subx-assort-main:interactive/disp8 # run-tests() e8/call run-tests/disp32 - # syscall(exit, *Num-test-failures) + # syscall_exit(*Num-test-failures) 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx eb/jump $subx-assort-main:end/disp8 $subx-assort-main:interactive: @@ -76,7 +76,7 @@ $subx-assort-main:interactive: e8/call subx-assort/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32 # add to esp - # syscall(exit, 0) + # syscall_exit(0) bb/copy-to-ebx 0/imm32 $subx-assort-main:end: e8/call syscall_exit/disp32 diff --git a/linux/braces.subx b/linux/braces.subx index 58e3ec59..6fa698e9 100644 --- a/linux/braces.subx +++ b/linux/braces.subx @@ -64,12 +64,12 @@ Entry: # run tests if necessary, a REPL if not 74/jump-if-= $subx-braces-main:interactive/disp8 # (run-tests) - # syscall(exit, *Num-test-failures) + # syscall_exit(*Num-test-failures) 8b/-> *Num-test-failures 3/r32/ebx eb/jump $subx-braces-main:end/disp8 $subx-braces-main:interactive: (subx-braces Stdin Stdout) - # syscall(exit, 0) + # syscall_exit(0) bb/copy-to-ebx 0/imm32 $subx-braces-main:end: e8/call syscall_exit/disp32 diff --git a/linux/calls.subx b/linux/calls.subx index 2c962e77..cb93e0d1 100644 --- a/linux/calls.subx +++ b/linux/calls.subx @@ -56,7 +56,7 @@ Entry: # run tests if necessary, convert stdin if not 74/jump-if-= $subx-calls-main:interactive/disp8 # run-tests() e8/call run-tests/disp32 - # syscall(exit, *Num-test-failures) + # syscall_exit(*Num-test-failures) 8b/-> *Num-test-failures 3/r32/ebx eb/jump $subx-calls-main:end/disp8 $subx-calls-main:interactive: @@ -69,7 +69,7 @@ $subx-calls-main:interactive: e8/call subx-calls/disp32 # . . discard args 81 0/subop/add %esp 8/imm32 - # syscall(exit, 0) + # syscall_exit(0) bb/copy-to-ebx 0/imm32 $subx-calls-main:end: e8/call syscall_exit/disp32 @@ -590,7 +590,7 @@ $emit-call:error1: e8/call flush/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -1079,7 +1079,7 @@ $next-word-string-or-expression-without-metadata:error0: e8/call flush/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -1117,7 +1117,7 @@ $next-word-string-or-expression-without-metadata:error1: e8/call flush/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -1155,7 +1155,7 @@ $next-word-string-or-expression-without-metadata:error2: e8/call flush/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -1193,7 +1193,7 @@ $next-word-string-or-expression-without-metadata:error3: e8/call flush/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -1231,7 +1231,7 @@ $next-word-string-or-expression-without-metadata:error4a: e8/call flush/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -1269,7 +1269,7 @@ $next-word-string-or-expression-without-metadata:error4: e8/call flush/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -1307,7 +1307,7 @@ $next-word-string-or-expression-without-metadata:error5: e8/call flush/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/dquotes.subx b/linux/dquotes.subx index 2fb65d42..6a5c917f 100644 --- a/linux/dquotes.subx +++ b/linux/dquotes.subx @@ -51,7 +51,7 @@ Entry: # run tests if necessary, convert stdin if not 74/jump-if-= $subx-dquotes-main:interactive/disp8 # run-tests() e8/call run-tests/disp32 - # syscall(exit, *Num-test-failures) + # syscall_exit(*Num-test-failures) 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx eb/jump $subx-dquotes-main:end/disp8 $subx-dquotes-main:interactive: @@ -72,7 +72,7 @@ $subx-dquotes-main:interactive: e8/call subx-dquotes/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32 # add to esp - # syscall(exit, 0) + # syscall_exit(0) bb/copy-to-ebx 0/imm32 $subx-dquotes-main:end: e8/call syscall_exit/disp32 diff --git a/linux/hex.subx b/linux/hex.subx index 242dc5d4..29ac3b5c 100644 --- a/linux/hex.subx +++ b/linux/hex.subx @@ -49,7 +49,7 @@ Entry: # run tests if necessary, convert stdin if not 74/jump-if-= $subx-hex-main:interactive/disp8 # run-tests() e8/call run-tests/disp32 - # syscall(exit, *Num-test-failures) + # syscall_exit(*Num-test-failures) 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx eb/jump $subx-hex-main:end/disp8 $subx-hex-main:interactive: @@ -64,7 +64,7 @@ $subx-hex-main:interactive: e8/call subx-hex/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32 # add to esp - # syscall(exit, 0) + # syscall_exit(0) bb/copy-to-ebx 0/imm32 $subx-hex-main:end: e8/call syscall_exit/disp32 diff --git a/linux/labels_baremetal.subx b/linux/labels_baremetal.subx index e4a29b62..a4ea991d 100644 --- a/linux/labels_baremetal.subx +++ b/linux/labels_baremetal.subx @@ -80,7 +80,7 @@ Entry: # run tests if necessary, convert stdin if not # run-tests() #? e8/call test-emit-output-with-padding/disp32 e8/call run-tests/disp32 - # syscall(exit, *Num-test-failures) + # syscall_exit(*Num-test-failures) 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx eb/jump $subx-labels-main:end/disp8 $subx-labels-main:interactive: @@ -118,7 +118,7 @@ $subx-labels-main:interactive: #? e8/call write-stream/disp32 #? # . . discard args #? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # syscall(exit, 0) + # syscall_exit(0) bb/copy-to-ebx 0/imm32 $subx-labels-main:end: e8/call syscall_exit/disp32 @@ -1135,7 +1135,7 @@ $emit-output:abort: e8/call flush/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -2162,7 +2162,7 @@ $stream-add2:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/mu.subx b/linux/mu.subx index c90df5ba..4f69e96a 100644 --- a/linux/mu.subx +++ b/linux/mu.subx @@ -493,7 +493,7 @@ Entry: 74/jump-if-= break/disp8 # (run-tests) - # syscall(exit, *Num-test-failures) + # syscall_exit(*Num-test-failures) 8b/-> *Num-test-failures 3/r32/ebx eb/jump $mu-main:end/disp8 } @@ -501,7 +501,7 @@ Entry: (write-buffered Stdout "== code\n") (convert-mu Stdin Stdout Stderr 0) (flush Stdout) - # syscall(exit, 0) + # syscall_exit(0) bb/copy-to-ebx 0/imm32 $mu-main:end: e8/call syscall_exit/disp32 @@ -18450,7 +18450,7 @@ check-no-tokens-left: # line: (addr stream byte) (write-stream 2 %ecx) (write-buffered Stderr "'\n") (flush Stderr) - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/pack.subx b/linux/pack.subx index 7ed01c5e..e50a5b9b 100644 --- a/linux/pack.subx +++ b/linux/pack.subx @@ -50,7 +50,7 @@ Entry: # run tests if necessary, convert stdin if not 74/jump-if-= $subx-pack-main:interactive/disp8 # run-tests() e8/call run-tests/disp32 - # syscall(exit, *Num-test-failures) + # syscall_exit(*Num-test-failures) 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx eb/jump $subx-pack-main:end/disp8 $subx-pack-main:interactive: @@ -63,7 +63,7 @@ $subx-pack-main:interactive: e8/call subx-pack/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x8/imm32 # add to esp - # syscall(exit, 0) + # syscall_exit(0) bb/copy-to-ebx 0/imm32 $subx-pack-main:end: e8/call syscall_exit/disp32 diff --git a/linux/random.subx b/linux/random.subx index 639638cc..d7bc03ac 100644 --- a/linux/random.subx +++ b/linux/random.subx @@ -10,7 +10,7 @@ # . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes Entry: - # stream/esi = syscall(open, "/dev/null", O_RDONLY, 0) # we can't use 'fd' because it looks like a hex byte + # stream/esi = syscall_open("/dev/null", O_RDONLY, 0) # we can't use 'fd' because it looks like a hex byte bb/copy-to-ebx Filename/imm32 b9/copy-to-ecx 0/imm32/rdonly ba/copy-to-edx 0x180/imm32/fixed-perms @@ -20,7 +20,7 @@ Entry: $loop: - # syscall(read, Stream, N, 4) + # syscall_read(Stream, N, 4) 89/copy 3/mod/direct 3/rm32/ebx . . . 6/r32/esi . . # copy esi to ebx b9/copy-to-ecx N/imm32 ba/copy-to-edx 4/imm32/size @@ -44,7 +44,7 @@ $loop: eb/jump $loop/disp8 - # syscall(exit, 0) + # syscall_exit(0) bb/copy-to-ebx 0/imm32 e8/call syscall_exit/disp32 diff --git a/linux/sigils.subx b/linux/sigils.subx index dd53efbe..ae2fc576 100644 --- a/linux/sigils.subx +++ b/linux/sigils.subx @@ -87,7 +87,7 @@ Entry: # run tests if necessary, convert stdin if not 74/jump-if-= $subx-sigils-main:interactive/disp8 # run-tests() e8/call run-tests/disp32 - # syscall(exit, *Num-test-failures) + # syscall_exit(*Num-test-failures) 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx eb/jump $subx-sigils-main:end/disp8 $subx-sigils-main:interactive: @@ -100,7 +100,7 @@ $subx-sigils-main:interactive: e8/call subx-sigils/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # syscall(exit, 0) + # syscall_exit(0) bb/copy-to-ebx 0/imm32 $subx-sigils-main:end: e8/call syscall_exit/disp32 @@ -427,7 +427,7 @@ $subx-sigils:error1: e8/call flush/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -1803,7 +1803,7 @@ $next-word-or-expression:error1: e8/call flush/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -1841,7 +1841,7 @@ $next-word-or-expression:error2: e8/call flush/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -2569,7 +2569,7 @@ $parse-effective-address:error1: e8/call flush/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -2607,7 +2607,7 @@ $parse-effective-address:error2: e8/call flush/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -2645,7 +2645,7 @@ $parse-effective-address:error3: e8/call flush/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -2683,7 +2683,7 @@ $parse-effective-address:error4: e8/call flush/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -4155,7 +4155,7 @@ $next-hex-int:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/survey_baremetal.subx b/linux/survey_baremetal.subx index d1d62906..5a8f46af 100644 --- a/linux/survey_baremetal.subx +++ b/linux/survey_baremetal.subx @@ -72,7 +72,7 @@ Entry: # run tests if necessary, convert stdin if not 74/jump-if-= $subx-survey-main:interactive/disp8 # run-tests() e8/call run-tests/disp32 - # syscall(exit, *Num-test-failures) + # syscall_exit(*Num-test-failures) 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx eb/jump $subx-survey-main:end/disp8 $subx-survey-main:interactive: @@ -93,7 +93,7 @@ $subx-survey-main:interactive: #? e8/call write-stream/disp32 #? # . . discard args #? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # syscall(exit, 0) + # syscall_exit(0) bb/copy-to-ebx 0/imm32 $subx-survey-main:end: e8/call syscall_exit/disp32 @@ -764,7 +764,7 @@ $compute-addresses:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -778,7 +778,7 @@ $compute-addresses:error-bad-segment-address: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/survey_elf.subx b/linux/survey_elf.subx index bfa76830..838feb88 100644 --- a/linux/survey_elf.subx +++ b/linux/survey_elf.subx @@ -79,7 +79,7 @@ Entry: # run tests if necessary, convert stdin if not 74/jump-if-= $subx-survey-main:interactive/disp8 # run-tests() e8/call run-tests/disp32 - # syscall(exit, *Num-test-failures) + # syscall_exit(*Num-test-failures) 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx eb/jump $subx-survey-main:end/disp8 $subx-survey-main:interactive: @@ -100,7 +100,7 @@ $subx-survey-main:interactive: #? e8/call write-stream/disp32 #? # . . discard args #? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # syscall(exit, 0) + # syscall_exit(0) bb/copy-to-ebx 0/imm32 $subx-survey-main:end: e8/call syscall_exit/disp32 @@ -935,7 +935,7 @@ $compute-offsets:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -2336,7 +2336,7 @@ $emit-segments:imm8-abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -2366,7 +2366,7 @@ $emit-segments:abort: e8/call flush/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -3514,7 +3514,7 @@ $stream-add5:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here @@ -3609,7 +3609,7 @@ $stream-add6:abort: e8/call _write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # . syscall(exit, 1) + # . syscall_exit(1) bb/copy-to-ebx 1/imm32 e8/call syscall_exit/disp32 # never gets here diff --git a/linux/tests.subx b/linux/tests.subx index 1075b113..1c2d7068 100644 --- a/linux/tests.subx +++ b/linux/tests.subx @@ -48,7 +48,7 @@ Entry: # run tests if necessary, convert stdin if not 74/jump-if-= $subx-tests-main:interactive/disp8 # run-tests() e8/call run-tests/disp32 - # syscall(exit, *Num-test-failures) + # syscall_exit(*Num-test-failures) 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx eb/jump $subx-tests-main:end/disp8 $subx-tests-main:interactive: @@ -61,7 +61,7 @@ $subx-tests-main:interactive: e8/call subx-gen-run-tests/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # syscall(exit, 0) + # syscall_exit(0) bb/copy-to-ebx 0/imm32 $subx-tests-main:end: e8/call syscall_exit/disp32