title: Sparc Procedure Call Conventions
body: <p>I would like to do some "inline" assemly programming in Sparc and I am wondering how I can do that with register passing.</p>
  
  <p>Best to explain my issue with a small example</p>
  
  <pre><code>int main()
  {
     int a = 5;
     int b = 6;
     int res;
  
     asm_addition(a,b);
  
     printf("Result: %d\n", res);
     return(0);
  }
    // My assembler addition
  
  .global asm_addition            
  
  .align  4   
  
      add rs1, rs2, rd
      restore
  </code></pre>
  
  <p>Does anyone know which registers I have to use so that the values a and b will be added? Finally, which register do I need to speficy for rd so that the result will then be printed put with the last printf statement following the assemly routine.</p>
  
  <p>Thanks so much for some input!          </p>