Page 1 of 1

io ports question

Posted: Tue Aug 25, 2020 8:56 pm
by ITchimp
if I type 'sudo cat /proc/ioports' I get a list of io address ranges.. but from all the
os tutorial I have studied, that only a specific port number is used as either input
or output... some times input has both control port and data port...

use timer as an example... port 0x40 and 0x43 are used, but the port range is
0x40 ~ 0x47,

I am wondering, what are ports 0x41 0x42 and 0x44, are these addresses used at all...
what would happen if I write to them will that screw up my already programmed PIT?

Re: io ports question

Posted: Tue Aug 25, 2020 9:20 pm
by foliagecanine
From the wiki page for the Programmable Interval Timer:
The PIT chip uses the following I/O ports:

I/O port Usage
0x40 Channel 0 data port (read/write)
0x41 Channel 1 data port (read/write)
0x42 Channel 2 data port (read/write)
0x43 Mode/Command register (write only, a read is ignored)
And from RBIL:
(For reference) 0x43 is the "control word register for counters 0-2"

0x44 is "PIT counter 3 (PS/2)"
0x47 is the "control word register counter 3"

I don't know if PIT counter 3 is used, or even available on modern computers.

Read the wiki page on the PIT to see what would happen if you wrote things to those other ports.

Edit: more info
When I do sudo cat /proc/ioports with my Ubuntu 20.04 install, I just get 0040-0043: timer0

Re: io ports question

Posted: Wed Aug 26, 2020 12:40 am
by ITchimp
Is it guaranteed every address within the address range has a use somewhere?

Re: io ports question

Posted: Wed Aug 26, 2020 3:58 am
by thewrongchristian
ITchimp wrote:Is it guaranteed every address within the address range has a use somewhere?
It is guaranteed that if you don't know what a port is for, it's a bad idea to poke it.

Stick to ports that YOU have documentation for.