diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-07-20 07:30:59 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-07-20 08:43:25 -0700 |
commit | 13ef425825cef5fa30f7eb68688b6d114ecbe554 (patch) | |
tree | a9853e61dd9fa39a4cf8f8c1ff5e79171e5ce9c3 /linux | |
parent | 5f254d0d02d8d6d61ca57ef4188110f11032a930 (diff) | |
download | mu-13ef425825cef5fa30f7eb68688b6d114ecbe554.tar.gz |
.
Diffstat (limited to 'linux')
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 --- a/linux/107trace.subx +++ b/linux/107trace.subx @@ -947,7 +947,7 @@ $_append-4: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/110stop.subx b/linux/110stop.subx index f6cb6fae..6b81e526 100644 --- a/linux/110stop.subx +++ b/linux/110stop.subx @@ -110,7 +110,7 @@ $stop:end1: # never gets here c3/return # doesn't return to caller $stop:real: - # . syscall(exit, value) + # . 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 e8/call syscall_exit/disp32 $stop:end2: diff --git a/linux/110stop.subx. b/linux/110stop.subx. deleted file mode 100644 index 965d7ae5..00000000 --- a/linux/110stop.subx. +++ /dev/null @@ -1,231 +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. The value will initially be empty. What should the -# target be? The simplest way to compute the target requires violating the -# usual pattern of function calls. -# -# Normally function calls follow this pattern: -# * push all args on the stack -# * call -# * increment ESP to pop all args off the stack -# -# When passing in a new exit descriptor, the process of calling looks like this: -# * allocate space for the exit descriptor on the stack -# * assign the exit descriptor to some register 'r' -# ... some time later ... -# * push all args on the stack, including register 'r' -# * save ESP to *r (the target of the exit descriptor) -# -# The value saved to the target isn't quite right, so stop needs to adjust its -# exit-descriptor argument 'ed': -# copy *ed to ESP -# decrement ESP by 4 (from last arg to return address) -# ret -# -# Performing the decrement inside 'stop' reduces our overhead for creating exit -# descriptors to a single 2-byte instruction. -# We only adjust the target if we ever actually call 'stop'. -# -# There's no good way to abstract away the target computation, since it depends -# on the number of args a function is called with. - -== 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 - # call/ed(ed) _test-stop-1(ed) - # w/exit(ed) _test-stop-1(ed) - # . _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/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 |