about summary refs log tree commit diff stats
path: root/050_write.subx
diff options
context:
space:
mode:
Diffstat (limited to '050_write.subx')
-rw-r--r--050_write.subx10
1 files changed, 3 insertions, 7 deletions
diff --git a/050_write.subx b/050_write.subx
index 24acf888..2567f444 100644
--- a/050_write.subx
+++ b/050_write.subx
@@ -6,10 +6,8 @@
 # . 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
 
 Entry:  # just exit; can't test _write just yet
-    # . syscall(exit, 0)
     bb/copy-to-ebx  0/imm32
-    b8/copy-to-eax  1/imm32/exit
-    cd/syscall  0x80/imm8
+    e8/call  syscall_exit/disp32
 
 _write:  # fd: int, s: (addr array byte)
     # . prologue
@@ -30,8 +28,7 @@ _write:  # fd: int, s: (addr array byte)
     8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           2/r32/edx   0xc/disp8       .                 # copy *(ebp+12) to edx
     8b/copy                         0/mod/indirect  2/rm32/edx    .           .             .           2/r32/edx   .               .                 # copy *edx to edx
     # . syscall
-    b8/copy-to-eax  4/imm32/write
-    cd/syscall  0x80/imm8
+    e8/call  syscall_write/disp32
     # if (eax < 0) abort
     3d/compare-eax-with  0/imm32
     0f 8c/jump-if-<  $_write:abort/disp32
@@ -50,8 +47,7 @@ $_write:abort:
     # can't write a message here for risk of an infinite loop, so we'll use a special exit code instead
     # . syscall(exit, 255)
     bb/copy-to-ebx  0xff/imm32
-    b8/copy-to-eax  1/imm32/exit
-    cd/syscall  0x80/imm8
+    e8/call  syscall_exit/disp32
     # never gets here
 
 # . . vim:nowrap:textwidth=0