title: Saving registers values before system call
body: <p>In my x86 ASM textbook there is an <a href="http://www.stolyarov.info/files/stud_io_inc_linux" rel="nofollow">example</a> of a macro which writes a string in the standard output stream:</p>
  
  <pre><code>%macro  PRINT 1
      pusha
      pushf
      jmp %%astr
  %%str   db  %1, 0
  %%strln equ $-%%str
  %%astr: _syscall_write 1, %%str, %%strln
      popf
      popa
  %endmacro
  </code></pre>
  
  <p>What I can not understand is why do we push and pop all general purpose registers values to / from the stack? <code>_syscall_write</code> does not modify any registers but <code>EAX</code> which will hold the result of the system call. So why don't we just push and pop just <code>EAX</code>? Won't it be more efficient?</p>