about summary refs log tree commit diff stats
path: root/subx/056write.subx
diff options
context:
space:
mode:
Diffstat (limited to 'subx/056write.subx')
-rw-r--r--subx/056write.subx8
1 files changed, 4 insertions, 4 deletions
diff --git a/subx/056write.subx b/subx/056write.subx
index 3496d980..c76d0737 100644
--- a/subx/056write.subx
+++ b/subx/056write.subx
@@ -27,10 +27,8 @@
     b8/copy-to-EAX  1/imm32
     cd/syscall  0x80/imm8
 
-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.)
+# TODO: come up with a way to signal when a write to disk fails
+write:  # f : fd or (address stream), s : (address array byte) -> <void>
     # . prolog
     55/push-EBP
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
@@ -48,6 +46,7 @@ write:  # f : fd or (address stream), s : (address array byte) -> bytes_written/
 $write:fake:
     # otherwise, treat 'f' as a stream to append to
     # . save registers
+    50/push-EAX
     51/push-ECX
     52/push-EDX
     53/push-EBX
@@ -76,6 +75,7 @@ $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