title: GCC inline assembly to manipulate all registers?
body: <p>I am trying to do some assembly calls in C (GCC 4.6.3, x86 (64-bit CPU), Ubuntu 12.04 64-bit) to zero out register values and set the stack pointer, and ultimately call a jump instruction.</p>
  
  <p>This is what I got:</p>
  
  <pre><code>asm("xor %eax, %eax");
  asm("xor %ebx, %ebx");
  asm("xor %ecx, %ecx");
  asm("xor %edx, %edx");
  
  asm("xor %cs, %cs");
  asm("xor %ds, %ds");
  asm("xor %es, %es");
  asm("xor %fs, %fs");
  asm("xor %gs, %gs");
  asm("xor %ss, %ss");
  
  asm("xor %esi, %esi");
  asm("xor %edi, %edi");
  asm("xor %ebp, %ebp");
  asm("xor %esp, %esp");
  
  asm("xor %cr0, %cr0");
  asm("xor %cr1, %cr1");
  asm("xor %cr2, %cr2");
  asm("xor %cr3, %cr3");
  asm("xor %cr4, %cr4");
  
  asm("xor %cr8, %cr8");
  </code></pre>
  
  <p>It says <code>Error: operand type mismatch for 'xor'</code> for all of the registers except the first four when I try to compile. Basically, I need to zero out all register contents (not sure how to do that). Apparently there is an <code>rdx</code> register of key importance? But I looked around online and can't find a list.</p>
  
  <p>Next, I need to set the stack pointer to a specific memory location. How can I do that?</p>
  
  <p>Finally, I need to call a <code>jump</code> instruction and go to a specific memory location. How can I do this?</p>
  
  <p>Thanks for any and all help!</p>