VC2005 asm开发环境 cpuid
来源:互联网 发布:卖家加入农村淘宝 编辑:程序博客网 时间:2024/04/28 05:29
新建一个c++project,配置asm的编译规则,然后在cpp中录入如下代码:
#include "stdafx.h"
#include <intrin.h>
extern "C" int __stdcall FUNC(int arg1);
int sum(int a, int b)
{
int c;
__asm
{
mov EAX, a;
mov EDX, b;
add EAX, EDX;
mov c, EAX;
}
return c+10000;
}
int _tmain(int argc, _TCHAR* argv[])
{
int a = 0x1000000;
int b = 100;
int c = sum(a, b);
int d = FUNC(a);
printf("Result: %d, %x", c, d);
int arr[4];
for (int a = 0; a < 5; a++)
{
__cpuid(arr,a);
printf("The code %d gives %d\n",a, arr[0]);
}
__cpuid(arr, 0x80000000);
printf("The code %d gives %x\n",0x80000000, arr[0]);
if (arr[0] >= 0x80000001)
{
__cpuid(arr, 0x80000001);
printf("The code %d gives %x\n",0x80000001, arr[3]);
if (!(arr[3] & (1 << 29)))
{
printf("x32");
}
else
{
printf("x64");
}
}
else
{
printf("x32");
}
return 0;
}
另外新建一个asm文件:
.386
.model flat, stdcall
.data
.code
FUNC proc, arg1 : DWORD
mov EAX, arg1
mov EDX, 1
add EAX, EDX
RET
FUNC endp
end
另外我们可以使用/d1reportSingleClassLayout和/d1reportAllClassLayout这个编译开关,它可以让MSVC 编译器(译注:至少是MSVC 6.0 以上的版本)生成一个.layout 文件,在该文件中包含有大量的极具价值的类的布局信息,包括基类在派生类中的位置,虚函数表,虚基类表(virtual base class table 我们下面会深入讨论),类的成员变量等信息(实际上我们这些图表都是从.layout文件中取出的)。
设置方法:在Project Properties->C++->Command Line->Additional Options里面加上/d1reportSingleClassLayoutDerived
- VC2005 asm开发环境 cpuid
- 打算写一个ASM集成开发环境
- 如何建立asm汇编开发环境
- vc2005配置QT4环境
- vc2005配置QT4环境
- vc2005配置QT4环境
- CPUID
- CPUID
- OCX--VC2005开发OCX
- VC2005简单配置SDL环境
- vc2005 编译搭建ace 环境
- 微软DS开发套件-在VC2005中集成NDS编译环境
- 关于vc2005编译asm文件出错的一个处理方法
- 在没有安装VC2005的环境下运行VC2005程序
- VC2005开发MFC ActiveX控件
- VC2005
- vc2005
- XP模拟ASM环境
- 标准类库 STL C++(转)
- import工程时,提示no project.properties file的解决方案
- NYOJ 448 寻找最大数 解题报告
- Linux 编程 出现警告warning: implicit declaration of function 'pread'('pwrite')
- CCLayer 和 CCMenu 事件优先级处理
- VC2005 asm开发环境 cpuid
- 浅谈场景编辑器开发
- 诠释.net中 Form.show()与 Form.ShowDialog()
- jpcsp源码解读13:动态二进制翻译1
- 累,缺少自信啊
- sed学习心得
- 我们一起老去
- org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
- S3C6410实时时钟RTC 秒字符设备