diff options
Diffstat (limited to 'linux.e')
| -rw-r--r-- | linux.e | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/linux.e b/linux.e index fb386f9..60bc54e 100644 --- a/linux.e +++ b/linux.e @@ -152,28 +152,29 @@ ~ the syscall wants it in rsi, which we also care about, so we have to do a ~ little juggling. ~ -~ (length to write, base address -- *) +~ (length to write, base address, file descriptor -- result code or length) : sys-write [ here @ + :rdi pop-reg64 ~ file descriptor from stack :rcx pop-reg64 ~ address from stack :rdx pop-reg64 ~ length from stack, passed directly :rsi push-reg64 ~ save rsi 1 :rax mov-reg64-imm64 ~ syscall number - 1 :rdi mov-reg64-imm64 ~ file descriptor :rcx :rsi mov-reg64-reg64 ~ pass address syscall :rsi pop-reg64 ~ restore rsi + :rax push-reg64 ~ return length here ! ] ;asm -~ (length to read, base address -- result code) +~ (length to read, base address, file descriptor -- result code or length) : sys-read [ here @ + :rdi pop-reg64 ~ file descriptor from stack :rcx pop-reg64 ~ address from stack :rdx pop-reg64 ~ length from stack, passed directly :rsi push-reg64 ~ save rsi 0 :rax mov-reg64-imm64 ~ syscall number - 0 :rdi mov-reg64-imm64 ~ file descriptor :rcx :rsi mov-reg64-reg64 ~ pass address syscall :rsi pop-reg64 ~ restore rsi |