|
Generally speaking, to translate to ATT syntax, do the following:
Add a suffix to the instruction indicating the operand size (even though it's usually implicit in the register operands), prepend the register name with a '%', and reverse the source and destination operands.
Example: mov bl, al ==> movb %al, %bl.
Immediate values are indicated by a '$':
movl $0xffff, %eax
Indirect memory references use parentheses:
mov dword ptr [edi+4], edx ==> movl %edx, (%edi+4)
That's sort of from the seat of my pants, might have something wrong. GCC also has another mechanism using an instruction template with register constraints, but it seems unnecessarily complicated to me.
|