diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-11-12 22:00:51 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-11-12 22:00:51 -0800 |
commit | 11a5fffade1ddf3e1787506a46045001cab3f477 (patch) | |
tree | f27f508913411b490f3ebc53b5305211b7501598 /subx/056write.subx | |
parent | 0fe9e7b9dcdaf6110da9a4e2a417234faaf3977e (diff) | |
download | mu-11a5fffade1ddf3e1787506a46045001cab3f477.tar.gz |
4743
Diffstat (limited to 'subx/056write.subx')
-rw-r--r-- | subx/056write.subx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/subx/056write.subx b/subx/056write.subx index 9cb7a3c7..a8ac3fca 100644 --- a/subx/056write.subx +++ b/subx/056write.subx @@ -42,7 +42,10 @@ Test-stream: b8/copy-to-EAX 1/imm32 cd/syscall 0x80/imm8 -write: # f : fd or (address stream), s : (address array byte) -> <void> +write: # f : fd or (address stream), s : (address array byte) -> bytes_written/EAX + # (If we ever leave the Linux kernel behind, it may be better to return + # the number of bytes *not* written. Success would then be signaled by + # returning 0.) # prolog 55/push-EBP 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP @@ -58,9 +61,8 @@ write: # f : fd or (address stream), s : (address array byte) -> <void> 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP eb/jump $write:end/disp8 $write:fake: - # otherwise, treat 'f' as an stream to append to + # otherwise, treat 'f' as a stream to append to # save registers - 50/push-EAX 51/push-ECX 52/push-EDX 53/push-EBX @@ -89,7 +91,6 @@ $write:fake: 5b/pop-to-EBX 5a/pop-to-EDX 59/pop-to-ECX - 58/pop-to-EAX $write:end: # epilog 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP |