summaryrefslogtreecommitdiff
path: root/static/plan9-4e/man3/arch.3
diff options
context:
space:
mode:
authorJacob McDonnell <jacob@jacobmcdonnell.com>2026-04-26 16:38:00 -0400
committerJacob McDonnell <jacob@jacobmcdonnell.com>2026-04-26 16:38:00 -0400
commit97d5c458cfa039d857301e1ca7d5af3beb37131d (patch)
treeb460cd850d0537eb71806ba30358840377b27688 /static/plan9-4e/man3/arch.3
parentb89dc2331a50c63f8b33272a5c4c61ab98abdaa3 (diff)
build: Better Build System
Diffstat (limited to 'static/plan9-4e/man3/arch.3')
-rw-r--r--static/plan9-4e/man3/arch.365
1 files changed, 65 insertions, 0 deletions
diff --git a/static/plan9-4e/man3/arch.3 b/static/plan9-4e/man3/arch.3
new file mode 100644
index 00000000..25a5331a
--- /dev/null
+++ b/static/plan9-4e/man3/arch.3
@@ -0,0 +1,65 @@
+.TH ARCH 3
+.SH NAME
+arch \- architecture-specific information and control
+.SH SYNOPSIS
+.nf
+.B bind -a #P /dev
+
+.B /dev/cputype
+.B /dev/ioalloc
+.B /dev/iob
+.B /dev/iol
+.B /dev/iow
+.B /dev/irqalloc
+.SH DESCRIPTION
+.PP
+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.
+.PP
+Reads from
+.I cputype
+recover the processor type and clock rate.
+.PP
+Reads from
+.I ioalloc
+return I/O ranges used by each device, one line
+per range. Each line contains three fields separated by white space: first address
+in hexadecimal,
+last address, name of device.
+.PP
+Reads from
+.I 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.
+.PP
+Reads and writes to
+.IR iob ,
+.IR iow ,
+and
+.I 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.
+.SH EXAMPLE
+The following code reads from an x86 byte I/O port.
+.IP
+.EX
+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\en", port);
+ return data;
+}
+.EE
+.SH SOURCE
+.B /sys/src/9/pc/devarch.c