J'ai ce code dans le fichier CPP :
#include <conio.h>
#include <stdio.h>
#include <windows.h>
int a = 0;
int main(int argc, char *argv[]) {
asm("mov eax, 0xFF");
asm("mov _a, eax");
printf("Result of a = %d\n", a);
getch();
return 0;
};
Ce code a fonctionné avec cette ligne de commande GCC :
gcc.exe File.cpp -masm=intel -mconsole -o File.exe
Il en résultera un fichier *.exe, et cela a fonctionné dans mon expérience.
Notes:
immediate operand must be use _variable in global variabel, not local variable.
example: mov _nLength, eax NOT mov $nLength, eax or mov nLength, eax
A number in hexadecimal format must use at&t syntax, cannot use intel syntax.
example: mov eax, 0xFF -> TRUE, mov eax, 0FFh -> FALSE.
C'est tout.
5 votes
Vous pouvez convertir des instructions simples facilement dans le shell avec llvm-mc :
echo "packsswb mm0,[bp+si-0x54]" | llvm-mc-3.2 -x86-asm-syntax=intel
dapacksswb -84(%bp,%si), %mm0