about summary refs log tree commit diff stats
path: root/108write.subx
diff options
context:
space:
mode:
Diffstat (limited to '108write.subx')
-rw-r--r--108write.subx3
1 files changed, 3 insertions, 0 deletions
diff --git a/108write.subx b/108write.subx
index 988e21db..84060c62 100644
--- a/108write.subx
+++ b/108write.subx
@@ -25,6 +25,9 @@ write:  # f: fd or (addr stream byte), s: (addr array byte)
     # . prologue
     55/push-ebp
     89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
+    # if (s == 0) return
+    81          7/subop/compare     1/mod/*+disp8   5/rm32/ebp    .           .             .           .           0xc/disp8       0/imm32           # compare *(ebp+12)
+    74/jump-if-=  $write:end/disp8
     # if (f < 0x08000000) _write(f, s) and return  # f can't be a user-mode address, so treat it as a kernel file descriptor
     81          7/subop/compare     1/mod/*+disp8   5/rm32/ebp    .           .             .           .           8/disp8         0x08000000/imm32  # compare *(ebp+8)
     73/jump-if-addr>=  $write:fake/disp8