title: printf format specifier in SPARC assembly argument?
body: <p>How do you get the equivalent of this C with SPARC assembly:</p>
  
  <pre><code>printf( "Hello, my name is %s.\n", name );
  </code></pre>
  
  <p>using the function prototype: </p>
  
  <pre><code>void printName( const char* msg, const char* name )
  </code></pre>
  
  <p>where msg is "Hello, my name is %s.\n".</p>
  
  <p>I know that I can define "Hello, my name is %s.\n" in the data segment with .asciz without having the first argument msg, but is there a way to pass a string into an assembly function that would have a %s identifier in it? Can a char* even take in a format identifier? I've tried the following but I get a core dump.</p>
  
  <p><strong>Function call in C:</strong></p>
  
  <pre><code>char * msg = "Hello, my name is %s.\n";
  char * name = "Foo";
  
  printName( msg, name );
  </code></pre>
  
  <p><strong>Assembly:</strong></p>
  
  <pre><code>mov %i0, %o0
  mov %i1, %o1
  call printf, 2
  nop
  </code></pre>
  
  <p>Maybe I'm not approaching the function prototype correctly?</p>