title: Are rdi and rsi caller saved or callee saved registers?
body: <p>From the wikipedia x86 calling convention, it says that for the Microsoft x64 calling convention: </p>
  
  <blockquote>
    <p>The registers RBX, RBP, <strong>RDI, RSI</strong>, RSP, R12, R13, R14, and R15 are considered nonvolatile (callee-saved).</p>
  </blockquote>
  
  <p>But for System V AMD64 ABI:</p>
  
  <blockquote>
    <p>If the callee wishes to use registers RBX, RBP, and R12–R15, it must restore their original values before returning control to the caller.</p>
  </blockquote>
  
  <p>It did not mention anything about rdi and rsi. </p>
  
  <p>I also read that <em>%rax, %rcx, %rdx, <strong>%rdi, %rsi</strong>, %rsp, and %r8-r11 are considered caller-save registers</em> (from a pdf)</p>
  
  <p>My question is, is calling convention various across different platform?(I try to write some libc function in asm for unix environment)</p>
  
  <p>I could not find any article discussing about this topic, resources to this topic will be helpful as well. I wanted to know the advantage and disadvantage of these conventions.</p>