1、MSR简介
Model Specific Register (MSR) as the name implies is model specific and may change from processor model number (n) to processor model number (n+1).
MSR 总体来是为了设置CPU 的工作环境和标示CPU 的工作状态,包括温度控制,性能监控等,具体来说,分为以下几项:
1. Thermal
2. Frequency
3. C State
4. Microcode
5. EIST
6. TM
7. Key Features Of CPU
8. Voltage
9. Cache Control
10. MTRR
11. DCA(Direct Cache Access)
12. Machine Check
13. 硬件联机控制
14.other
2、汇编指令简介
MSR 是CPU 的一组64 位寄存器,可以分别通过RDMSR 和WRMSR 两条指令进行读和写的操作,前提要在ECX 中写入MSR 的地址。MSR 的指令必须执行在level 0 或实模式下。
RDMSR 读模式定义寄存器。对于RDMSR 指令,将会返回相应的MSR 中64bit 信息到(EDX:EAX)寄存器中
WRMSR 写模式定义寄存器。对于WRMSR 指令,把要写入的信息存入(EDX:EAX)中,执行写指令后,即可将相应的信息存入ECX 指定的MSR 中。
我用CPUID指令探测到我的处理器的指令集是3,这个值小于6,这是肯定无法使用 在586以后才出现的RDMSR指令的。
但我不死心,于是在浩如烟海的NTDDK文档中搜索,终于找到了
一个叫X86_ReadRDMSR的API,
这个API有两个参数,我不知道如何使用,
但我试着在驱动中调用这个函数,
invoke X86_ReadRDMSR, 101H, offset buffer
果然如我所料,调用成功了,读出了101H号SERVICE的地址。
看来我们在程序中应尽量不要使用硬编码,而要使用系统提供好的
API接口。要不然你写的程序在别人的机器上却无法运行,那又有何价值呢,呵呵,一点感悟...
我在masm32 sdk里面的randlibk.inc头文件中找到了你说的X86_ReadRDMSR