Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I work with a PCIe board that requires 256 byte TLP payload size. I got CPU that supports that (Core i7-3930K) and Intel motherboard, DX79SR that does not offer TLP payload size setting in BIOS. By default there is 128 byte max TLP payload and I need to change it to 256 byte, without 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.

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.

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. 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. I have found that _outp() functions don't work in user mode though.

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. It's Windows XP 32 bit now, Win7 x64 will be later, Visual Studio 2010 C++ or WDK.

like image 540
user1871691 Avatar asked Nov 03 '22 09:11

user1871691


1 Answers

Basically what you have to do is use the out, respectively in x86 asm instructions. 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). 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.

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.

like image 198
Voo Avatar answered Nov 08 '22 06:11

Voo