title: x86 Assembler - Which registers to push?
body: <p>An x86 assembler routine typically begins with the following prologue:</p>
  
  <pre><code>push        ebp                ; Save ebp
  mov         ebp, esp           ; Set stack frame pointer
  sub         esp, localbytes    ; Allocate space for locals
  push        &lt;registers&gt;        ; Save registers
  </code></pre>
  
  <p>I have seen functions <code>push</code> anywhere from 1 to 4 registers.</p>
  
  <p><strong>Besides pushing <code>ebp</code>, which is required, what determines whether you push <code>edi</code>, <code>esi</code>, and/or <code>ebx</code> as well?</strong></p>
  
  <p>Should you always push them? I can't find a reference to settle this issue for me.</p>