title: How to understand the inline assembler in function of " __xchg"?
body: <p>the codes is:</p>
  
  <pre><code> static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
   {
           switch (size) {
                   case 1:
                           __asm__ __volatile__("xchgb %b0,%1"
                                   :"=q" (x)
                                   :"m" (*__xg(ptr)), "" (x)
                                   :"memory");
                           break;
                   case 2:
                           __asm__ __volatile__("xchgw %w0,%1"
                                   :"=r" (x)
                                   :"m" (*__xg(ptr)), "" (x)
                                   :"memory");
                           break;
                   case 4:
                           __asm__ __volatile__("xchgl %0,%1"
                                   :"=r" (x)
                                   :"m" (*__xg(ptr)), "" (x)
                                   :"memory");
                           break;
           }
           return x;
   }
  </code></pre>
  
  <p>What' the meaning of <code>"=q"</code>?<br> And How to understand the semantic of <code>"" (x)</code>?<br>thank you.</p>