title: ljmp syntax in gcc inline assembly
body: <p>I was thinking of using a far jump to set the code segment (CS) register. Getting into why I'm doing this and why I'm dealing with segmentation at all would take a while, so bear with me and consider it an academic exercise. I can't seem to get the syntax right. </p>
  
  <p><code>Error: suffix or operands invalid for 'ljmp'</code></p>
  
  <p>I know it's foolish to put <code>cs</code> into another register, but I figured I'd try it since using <code>%0</code> wasn't working (the <code>ax</code> register doesn't work either). </p>
  
  <p>I'm looking at some code that compiles fine and this is driving me crazy, since I thought <code>ljmp</code> would be the same: <code>__asm volatile ( "lcall $0x8, $far_call" );</code></p>
  
  <p>I would of course welcome other hacky ways of affecting the CS register. </p>
  
  <pre><code>void set_cs(u16 cs) {
      __asm__ volatile (
          "mov %0, %%ax \n\t"
          "ljmp %%ax, $fake_label \n\t"
          "fake_label: \n\t"
          :
          : "r" (cs)
          : "ax"
      );
  }
  </code></pre>