简体   繁体   English

在Windows中访问Intel CPU I / O寄存器的简便方法

[英]Easy way to access Intel CPU I/O registers in Windows

I work with a PCIe board that requires 256 byte TLP payload size. 我使用需要256字节TLP有效载荷大小的PCIe板。 I got CPU that supports that (Core i7-3930K) and Intel motherboard, DX79SR that does not offer TLP payload size setting in BIOS. 我得到的CPU支持(Core i7-3930K)和Intel主板,DX79SR不提供BIOS中的TLP有效负载大小设置。 By default there is 128 byte max TLP payload and I need to change it to 256 byte, without BIOS. 默认情况下,最大TLP有效负载为128字节,我需要将其更改为256字节,无需BIOS。 I found PCIUtils software that displays this value in Windows but it's a multi-purpose portable software and it's too complicated to find what I need. 我发现PCIUtils软件在Windows中显示了这个值,但它是一个多功能的便携式软件,它太复杂了,无法找到我需要的东西。

Intel documents describe what values I need to set in CPU I/O registers and there is another document saying that I/O locations are C8Fh and CFCh. 英特尔文档描述了我需要在CPU I / O寄存器中设置的 ,还有另一个文档说I / O位置是C8Fh和CFCh。

This is where I'm stuck, I don't know where to start if I want to set to set these registers. 这就是我被困住的地方,如果我想设置这些寄存器,我不知道从哪里开始。 I am an experienced Windows S/W developer but I have never dealt with drivers. 我是一位经验丰富的Windows S / W开发人员,但我从未处理过驱动程序。 I do have source code for the drivers of this PCIe board that I can modify, build and run but I have no idea how to write data to I/O registers of Intel CPU. 我有这个PCIe板驱动程序的源代码,我可以修改,构建和运行,但我不知道如何将数据写入Intel CPU的I / O寄存器。 I have found that _outp() functions don't work in user mode though. 我发现_outp()函数在用户模式下不起作用。

Please point me where to start, either from executable (easier) or driver. 请指出我从哪里开始,可执行(更容易)或驱动程序。 I think all I need is to do is to read/write from I/O ports C8Fh and CFCh, if I'm not mistaken. 我认为我所需要做的就是从I / O端口C8Fh和CFCh读取/写入,如果我没有弄错的话。 It's Windows XP 32 bit now, Win7 x64 will be later, Visual Studio 2010 C++ or WDK. 它现在是Windows XP 32位,Win7 x64将会更晚,Visual Studio 2010 C ++或WDK。

Basically what you have to do is use the out , respectively in x86 asm instructions. 基本上你要做的就是分别in x86 asm指令中使用out The thing is that in protected mode those two instructions are locked so that you can't use them in userland mode. 问题是在保护模式下,这两个指令被锁定,因此您无法在用户空间模式下使用它们。

The best place to start is to get the WDK (windows driver kit) and look at their samples (you only need a software driver for this). 最好的起点是获取WDK(Windows驱动程序工具包)并查看他们的示例(您只需要一个软件驱动程序)。 If the driver for the PCI board is a kernel mode driver though you could just add the calls in the DriverEntry function and be done with it. 如果PCI板的驱动程序是内核模式驱动程序,您可以在DriverEntry函数中添加调用并完成它。

If that's not an option, you'll have to build your own software kernel mode driver - here is some simple example code with instructions on how to build and deploy one. 如果这不是一个选项,你将不得不构建自己的软件内核模式驱动程序 - 这里有一些简单的示例代码,其中包含有关如何构建和部署一个的简单示例代码。 The actual code should be trivial, since you only want to execute some instructions in kernel mode. 实际代码应该是微不足道的,因为您只想在内核模式下执行某些指令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM