summaryrefslogtreecommitdiff
path: root/man/3/arch
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2006-12-22 20:52:35 +0000
committerCharles.Forsyth <devnull@localhost>2006-12-22 20:52:35 +0000
commit46439007cf417cbd9ac8049bb4122c890097a0fa (patch)
tree6fdb25e5f3a2b6d5657eb23b35774b631d4d97e4 /man/3/arch
parent37da2899f40661e3e9631e497da8dc59b971cbd0 (diff)
20060303-partial
Diffstat (limited to 'man/3/arch')
-rw-r--r--man/3/arch63
1 files changed, 63 insertions, 0 deletions
diff --git a/man/3/arch b/man/3/arch
new file mode 100644
index 00000000..ffb03c69
--- /dev/null
+++ b/man/3/arch
@@ -0,0 +1,63 @@
+.TH ARCH 3 x86
+.SH NAME
+arch \- x86 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
+This device presents textual information about PC hardware and allows
+user-level control of the I/O ports on x86-class 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 Limbo code reads from an x86 byte I/O port.
+.IP
+.EX
+inportb(port: int): byte
+{
+ data := array[1] of byte;
+
+ if(iobfd == nil)
+ iobfd = sys->open("#P/iob", Sys->ORDWR);
+
+ sys->seek(iobfd, port, 0);
+ if(sys->read(iobfd, data, len data) != len data)
+ fatal(sys->sprint("inportb(16r%4.4x): %r\en", port));
+ return data[0];
+}
+.EE
+.SH SOURCE
+.B /os/pc/devarch.c