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);
}
Windows 7、Windows XP SP3关闭DEP堆栈执行保护 VirtualBox导入Vmware生成的vmdk格式虚拟机镜像
Your browser is out-of-date!

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

×