VC内联汇编和GCC内联汇编的语法区别

VC:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>

main(){
int a = 1;
int b = 2;
int c;
__asm{
mov eax,a
mov ebx,b
mov ecx,1h
add eax,ebx
mov c,ecx
}
printf("%x\n", c);
}

GCC:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>

main(){
int a = 1;
int b = 2;
int c;
asm(
"add %2,%0" //1
:"=g"(c) //2
:"0"(a),"g"(b) //3
:"memory" //4
);
printf("%x\n", c);
}
写给迷茫的朋友 反汇编技术笔记-基础知识
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×