diff options
-rw-r--r-- | subx/050write_stderr.subx | 6 | ||||
-rw-r--r-- | subx/051test.subx | 2 | ||||
-rw-r--r-- | subx/055trace.subx | 2 | ||||
-rw-r--r-- | subx/apps/crenshaw2-1.subx | 8 | ||||
-rw-r--r-- | subx/examples/ex11.subx | 6 | ||||
-rw-r--r-- | subx/examples/ex12.subx | 4 | ||||
-rw-r--r-- | subx/examples/ex4.subx | 10 | ||||
-rw-r--r-- | subx/examples/ex5.subx | 10 | ||||
-rw-r--r-- | subx/examples/ex6.subx | 6 | ||||
-rw-r--r-- | subx/examples/ex7.subx | 18 |
10 files changed, 36 insertions, 36 deletions
diff --git a/subx/050write_stderr.subx b/subx/050write_stderr.subx index 0eb402df..2225b968 100644 --- a/subx/050write_stderr.subx +++ b/subx/050write_stderr.subx @@ -5,7 +5,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 # main: (manual test if this is the last file loaded) - # exit(0) -- we don't bother testing write-stderr just yet + # syscall(exit, 0) -- we don't bother testing write-stderr just yet bb/copy-to-EBX 0/imm32 b8/copy-to-EAX 1/imm32 cd/syscall 0x80/imm8 @@ -19,7 +19,7 @@ write-stderr: # s : (address array byte) -> <void> 51/push-ECX 52/push-EDX 53/push-EBX - # 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 @@ -28,7 +28,7 @@ write-stderr: # s : (address array byte) -> <void> # size = *s 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 2/r32/EDX 8/disp8 . # copy *(EBP+8) to EDX 8b/copy 0/mod/indirect 2/rm32/EDX . . . 2/r32/EDX . . # copy *EDX to EDX - # call write() + # syscall b8/copy-to-EAX 4/imm32/write cd/syscall 0x80/imm8 # restore registers diff --git a/subx/051test.subx b/subx/051test.subx index 1e3968bf..bbae6eff 100644 --- a/subx/051test.subx +++ b/subx/051test.subx @@ -10,7 +10,7 @@ 68/push 34/imm32 e8/call check-ints-equal/disp32 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # exit(0) + # syscall(exit, 0) bb/copy-to-EBX 0/imm32 b8/copy-to-EAX 1/imm32 cd/syscall 0x80/imm8 diff --git a/subx/055trace.subx b/subx/055trace.subx index c3392d5b..1ed42e8a 100644 --- a/subx/055trace.subx +++ b/subx/055trace.subx @@ -45,7 +45,7 @@ Test-trace-stream: # main: (manual test if this is the last file loaded) e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'. - # exit(Num-test-failures) + # syscall(exit, Num-test-failures) 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 1/r32/EBX Num-test-failures/disp32 # copy *Num-test-failures to EBX b8/copy-to-EAX 1/imm32 cd/syscall 0x80/imm8 diff --git a/subx/apps/crenshaw2-1.subx b/subx/apps/crenshaw2-1.subx index d5bd2a01..7b4a8deb 100644 --- a/subx/apps/crenshaw2-1.subx +++ b/subx/apps/crenshaw2-1.subx @@ -26,7 +26,7 @@ e8/call abort/disp32 # discard arg 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # exit(0) + # syscall(exit, 0) bb/copy-to-EBX 0/imm32 b8/copy-to-EAX 1/imm32/exit cd/syscall 0x80/imm8 @@ -43,7 +43,7 @@ abort: # s : (address array byte) -> <void> e8/call error/disp32 # discard arg 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # exit(1) + # syscall(exit, 1) bb/copy-to-EBX 1/imm32 b8/copy-to-EAX 1/imm32/exit cd/syscall 0x80/imm8 @@ -90,7 +90,7 @@ write-stdout: # s : (address array byte) -> <void> 51/push-ECX 52/push-EDX 53/push-EBX - # write(1/stdout, (data) s+4, (size) *s) + # syscall(write, 1/stdout, (data) s+4, (size) *s) # fd = 1 (stdout) bb/copy-to-EBX 1/imm32 # x = s+4 @@ -99,7 +99,7 @@ write-stdout: # s : (address array byte) -> <void> # size = *s 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 2/r32/EDX 8/disp8 . # copy *(EBP+8) to EDX 8b/copy 0/mod/indirect 2/rm32/EDX . . . 2/r32/EDX . . # copy *EDX to EDX - # call write() + # syscall b8/copy-to-EAX 4/imm32/write cd/syscall 0x80/imm8 # restore registers diff --git a/subx/examples/ex11.subx b/subx/examples/ex11.subx index 038bd4c6..cd8cdf4d 100644 --- a/subx/examples/ex11.subx +++ b/subx/examples/ex11.subx @@ -22,7 +22,7 @@ # main: e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'. - # exit(EAX) + # syscall(exit, EAX) 89/copy 3/mod/direct 3/rm32/EBX . . . 0/r32/EAX . . # copy EAX to EBX b8/copy-to-EAX 1/imm32 cd/syscall 0x80/imm8 @@ -312,7 +312,7 @@ write-stderr: # s : (address array byte) -> <void> 51/push-ECX 52/push-EDX 53/push-EBX - # 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 @@ -321,7 +321,7 @@ write-stderr: # s : (address array byte) -> <void> # size = *s 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 2/r32/EDX 8/disp8 . # copy *(EBP+8) to EDX 8b/copy 0/mod/indirect 2/rm32/EDX . . . 2/r32/EDX . . # copy *EDX to EDX - # call write() + # syscall b8/copy-to-EAX 4/imm32/write cd/syscall 0x80/imm8 # restore registers diff --git a/subx/examples/ex12.subx b/subx/examples/ex12.subx index ba760707..b35c8c95 100644 --- a/subx/examples/ex12.subx +++ b/subx/examples/ex12.subx @@ -11,7 +11,7 @@ # 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 - # mmap(0x1000) + # syscall(mmap, 0x1000) bb/copy-to-EBX mmap-new-segment/imm32 b8/copy-to-EAX 0x5a/imm32/mmap cd/syscall 0x80/imm8 @@ -19,7 +19,7 @@ # store to *EAX c7/copy 0/mod/direct 0/rm32/EAX . . . . . 0x34/imm32 # copy to *EAX - # exit(EAX) + # syscall(exit, EAX) 89/copy 3/mod/direct 3/rm32/EBX . . . 0/r32/EAX . . # copy EAX to EBX b8/copy-to-EAX 1/imm32/exit cd/syscall 0x80/imm8 diff --git a/subx/examples/ex4.subx b/subx/examples/ex4.subx index 9e062cb2..6a9236eb 100644 --- a/subx/examples/ex4.subx +++ b/subx/examples/ex4.subx @@ -5,29 +5,29 @@ # $ subx run examples/ex4 == code -# read(stdin, x, 1) +# syscall(read, stdin, x, 1) # fd = 0 (stdin) bb/copy-to-EBX 0/imm32 # initialize x (location to write result to) b9/copy-to-ECX x/imm32 # size = 1 character ba/copy-to-EDX 1/imm32 - # read(fd, x, size) + # syscall b8/copy-to-EAX 3/imm32/read cd/syscall 0x80/imm8 -# write(stdout, x, 1) +# syscall(write, stdout, x, 1) # fd = 1 (stdout) bb/copy-to-EBX 1/imm32 # initialize x (location to read from) b9/copy-to-ECX x/imm32 # size = 1 character ba/copy-to-EDX 1/imm32 - # write(fd, x, size) + # syscall b8/copy-to-EAX 4/imm32/write cd/syscall 0x80/imm8 -# exit(EBX) +# syscall(exit, EBX) b8/copy-to-EAX 1/imm32/exit cd/syscall 0x80/imm8 diff --git a/subx/examples/ex5.subx b/subx/examples/ex5.subx index 4dad3043..cdc009bf 100644 --- a/subx/examples/ex5.subx +++ b/subx/examples/ex5.subx @@ -13,29 +13,29 @@ # allocate x on the stack 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # subtract from ESP - # read(stdin, x, 1) + # syscall(read, stdin, x, 1) # fd = 0 (stdin) bb/copy-to-EBX 0/imm32 # initialize x (location to write result to) 8d/copy-address 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none 1/r32/ECX 4/disp8 . # copy ESP+4 to ECX # size = 1 character ba/copy-to-EDX 1/imm32 - # read(fd, x, size) + # syscall b8/copy-to-EAX 3/imm32/read cd/syscall 0x80/imm8 - # write(stdout, x, 1) + # syscall(write, stdout, x, 1) # fd = 1 (stdout) bb/copy-to-EBX 1/imm32 # initialize x (location to read from) 8d/copy-address 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none 1/r32/ECX 4/disp8 . # copy ESP+4 to ECX # size = 1 character ba/copy-to-EDX 1/imm32 - # write(fd, x, size) + # syscall b8/copy-to-EAX 4/imm32/write cd/syscall 0x80/imm8 - # exit(EBX) + # syscall(exit, EBX) b8/copy-to-EAX 1/imm32/exit cd/syscall 0x80/imm8 diff --git a/subx/examples/ex6.subx b/subx/examples/ex6.subx index 1c726c65..2b8aa212 100644 --- a/subx/examples/ex6.subx +++ b/subx/examples/ex6.subx @@ -10,18 +10,18 @@ # 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 - # write(stdout, x, size) + # syscall(write, stdout, x, size) # fd = 1 (stdout) bb/copy-to-EBX 1/imm32 # initialize x (location to write result to) b9/copy-to-ECX x/imm32 # initialize size 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 2/r32/EDX size/disp32 . # copy *size to EDX - # write(fd, x, size) + # syscall b8/copy-to-EAX 4/imm32/write cd/syscall 0x80/imm8 - # exit(EBX) + # syscall(exit, EBX) b8/copy-to-EAX 1/imm32/exit cd/syscall 0x80/imm8 diff --git a/subx/examples/ex7.subx b/subx/examples/ex7.subx index 615f5d21..2cf65ab3 100644 --- a/subx/examples/ex7.subx +++ b/subx/examples/ex7.subx @@ -15,13 +15,13 @@ # 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 - # creat(filename) + # syscall(creat, filename) bb/copy-to-EBX filename/imm32 b9/copy-to-ECX 0x180/imm32/fixed-perms b8/copy-to-EAX 8/imm32/creat cd/syscall 0x80/imm8 - # stream = open(filename, O_WRONLY, 0) # we can't use 'fd' because it looks like a hex byte + # stream = syscall(open, filename, O_WRONLY, 0) # we can't use 'fd' because it looks like a hex byte bb/copy-to-EBX filename/imm32 b9/copy-to-ECX 1/imm32/wronly ba/copy-to-EDX 0x180/imm32/fixed-perms @@ -31,7 +31,7 @@ bb/copy-to-EBX stream/imm32 89/copy 0/mod/indirect 3/rm32/EBX . . . 0/r32/EAX . . # copy EAX to *EBX - # write(stream, "a", 1) + # syscall(write, stream, "a", 1) # load stream bb/copy-to-EBX stream/imm32 8b/copy 0/mod/indirect 3/rm32/EBX . . . 3/r32/EBX . . # copy *EBX to EBX @@ -41,7 +41,7 @@ b8/copy-to-EAX 4/imm32/write cd/syscall 0x80/imm8 - # close(stream) + # syscall(close, stream) # load stream bb/copy-to-EBX stream/imm32 8b/copy 0/mod/indirect 3/rm32/EBX . . . 3/r32/EBX . . # copy *EBX to EBX @@ -49,7 +49,7 @@ b8/copy-to-EAX 6/imm32/close cd/syscall 0x80/imm8 - # stream = open(filename, O_RDONLY, 0) + # stream = syscall(open, filename, O_RDONLY, 0) bb/copy-to-EBX filename/imm32 b9/copy-to-ECX 0/imm32/rdonly ba/copy-to-EDX 0x180/imm32/fixed-perms @@ -59,7 +59,7 @@ bb/copy-to-EBX stream/imm32 89/copy 0/mod/indirect 3/rm32/EBX . . . 0/r32/EAX . . # copy EAX to *EBX - # read(stream, b, 1) + # syscall(read, stream, b, 1) # load stream bb/copy-to-EBX stream/imm32 8b/copy 0/mod/indirect 3/rm32/EBX . . . 3/r32/EBX . . # copy *EBX to EBX @@ -69,7 +69,7 @@ b8/copy-to-EAX 3/imm32/read cd/syscall 0x80/imm8 - # close(stream) + # syscall(close, stream) # load stream bb/copy-to-EBX stream/imm32 8b/copy 0/mod/indirect 3/rm32/EBX . . . 3/r32/EBX . . # copy *EBX to EBX @@ -77,12 +77,12 @@ b8/copy-to-EAX 6/imm32/close cd/syscall 0x80/imm8 - # unlink(filename) + # syscall(unlink, filename) bb/copy-to-EBX filename/imm32 b8/copy-to-EAX 0xa/imm32/unlink cd/syscall 0x80/imm8 - # exit(b) + # syscall(exit, b) # load b bb/copy-to-EBX b/imm32 8b/copy 0/mod/indirect 3/rm32/EBX . . . 3/r32/EBX . . # copy *EBX to EBX |