io ports question

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
ITchimp
Member
Member
Posts: 134
Joined: Sat Aug 18, 2018 8:44 pm

io ports question

Post 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?
foliagecanine
Member
Member
Posts: 148
Joined: Sun Aug 23, 2020 4:35 pm

Re: io ports question

Post 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
My OS: TritiumOS
https://github.com/foliagecanine/tritium-os
void warranty(laptop_t laptop) { if (laptop.broken) return laptop; }
I don't get it: Why's the warranty void?
ITchimp
Member
Member
Posts: 134
Joined: Sat Aug 18, 2018 8:44 pm

Re: io ports question

Post by ITchimp »

Is it guaranteed every address within the address range has a use somewhere?
thewrongchristian
Member
Member
Posts: 426
Joined: Tue Apr 03, 2018 2:44 am

Re: io ports question

Post 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.
Post Reply