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.
This is what I got:
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");
It says Error: operand type mismatch for 'xor' 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 rdx register of key importance? But I looked around online and can't find a list.
Next, I need to set the stack pointer to a specific memory location. How can I do that?
Finally, I need to call a jump instruction and go to a specific memory location. How can I do this?
Thanks for any and all help!