title: How to save the registers on x86_64 for an interrupt service routine?
body: <p>I am looking at some old code from a school project, and in trying to compile it on my laptop I ran into some problems. It was originally written for an old 32 bit version of gcc. Anyway I was trying to convert some of the assembly over to 64 bit compatible code and hit a few snags.</p>
  
  <p>Here is the original code:</p>
  
  <pre><code>pusha
  pushl   %ds
  pushl   %es
  pushl   %fs
  pushl   %gs
  pushl   %ss
  </code></pre>
  
  <p><code>pusha</code> is not valid in 64 bit mode. So what would be the proper way to do this in x86_64 assembly while in 64 bit mode?</p>
  
  <p>There has got to be a reason why <code>pusha</code> is not valid in 64 bit mode, so I have a feeling manually pushing all the registers may not be a good idea.</p>