A forum for reverse engineering, OS internals and malware analysis 

Forum for discussion about kernel-mode development.
 #12652  by Kamala
 Fri Apr 13, 2012 2:31 am
Hi,

When I try to write to port 0x64 (keyboard controller command port), 0xcf9 etc. to reset the system, it works under Fedora, Debian but not under Windows or Ubuntu. It looks like I am missing something obvious that Windows/Ubuntu does while others don't or viseversa. Would you happen to know what it might be? Thanks.

Kamala
 #12744  by Kamala
 Mon Apr 16, 2012 7:08 pm
Hi,

The code I used is rather trivial test code and it is comparable to the ones in the below link -

http://smackerelofopinion.blogspot.com/ ... ng-pc.html

Cut and paste of the code from that link is below -

ioperm(0x64, 1, 1);
outb(0xfe, 0x64);

or

ioperm(0xcf9, 1, 1);
outb(0x02, 0xcf9);
usleep(10); /* a very small delay is required, this is plenty */
outb(0x04, 0xcf9);

Both the above works on Fedora and Debian I tried but not on Ubuntu. Thanks.

Kamala
 #12768  by Vrtule
 Tue Apr 17, 2012 10:11 pm
I suppose that you execute the code in kernelmode (as a part of a driver). By default, Applications do not have privilege to communicate through I/O ports.

Few years ago, I tested the method based on Keyboard Controller on Windows XP SP2 and it worked fine.