Showing posts with label port. Show all posts
Showing posts with label port. Show all posts

Monday, April 23, 2012

User program write to IO ports on Windows

http://retired.beyondlogic.org/porttalk/porttalk.htm

Download the PortTalk 2.2 folder.
Look at the README file, you will know how to use it.

C:\porttalk>allowio beep /a
allow program beep.exe to write all the ports

C:\porttalk\AllowIO>allowio 0x42 0x43 0x61 beep.exe
allow the beep.exe to access port 0x42 0x43 and 0x61


Look at the IoExample folder, you will know how to write the sample user program to write ports.

In addition, we could use assembly IO instruction to write to port.
out dx, al
compile the assembly code into WritePort.exe file, and use AllowIo.exe to set the bitmap permission for this executable program
AllowIo.exe WritePort.exe /a

Again, AllowIo.exe provides the facility to modify the IO permission bitmap and write/read to IO ports via IOCTL calls.

Tuesday, October 19, 2010

write to port

(1) http://www.faqs.org/docs/Linux-mini/IO-Port-Programming.html

(2) http://ubuntuforums.org/showthread.php?t=1211949

resource 1, we need to change the include file
from
#include <asm/io.h>
to
#include <sys/io.h>

resource 2 is another example of IO programming in C

We also could use in and out assembly instructions to write something to port.
However, in and out instruction have been locked in protected mode.

mov 0xff %al
mov 0xb2 %dx
out %al %dx

write 0xff to port 0xb2