ARCH(3) ARCH(3)
NAME
arch - architecture-specific information and control
SYNOPSIS
bind -a #P /dev
/dev/cputype
/dev/ioalloc
/dev/iob
/dev/iol
/dev/iow
/dev/irqalloc
DESCRIPTION
This device presents textual information about PC hardware
and allows user-level control of the I/O ports on x86-class
and DEC Alpha machines.
Reads from cputype recover the processor type and clock
rate.
Reads from ioalloc return I/O ranges used by each device,
one line per range. Each line contains three fields sepa-
rated by white space: first address in hexadecimal, last
address, name of device.
Reads from irqalloc return the enabled interrupts, one line
per interrupt. Each line contains three fields separated by
white space: the trap number, the IRQ it is assigned to, and
the name of the device using it.
Reads and writes to iob, iow, and iol cause 8-bit wide, 16-
bit wide, and 32-bit wide requests to I/O ports. The port
accessed is determined by the byte offset of the file
descriptor.
EXAMPLE
The following code reads from an x86 byte I/O port.
uchar
inportb(long port)
{
uchar data;
if(iobfd == -1)
iobfd = open("#P/iob", ORDWR);
seek(iobfd, port, 0);
if(read(iobfd, &data, sizeof(data)) != sizeof(data))
sysfatal("inportb(0x%4.4x): %r\n", port);
Page 1 Plan 9 (printed 10/28/25)
ARCH(3) ARCH(3)
return data;
}
SOURCE
/sys/src/9/pc/devarch.c
Page 2 Plan 9 (printed 10/28/25)