forsyth20121205-174063a80cc13 years agoHistory
63 lines · 1.4 KB · Text
RawDownload
.TH ARCH 3 x86.SH NAMEarch \- 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 DESCRIPTIONThis device presents textual information about PC hardware and allowsuser-level control of the I/O ports on x86-class machines..PPReads from.I cputyperecover the processor type and clock rate..PPReads from.I ioallocreturn I/O ranges used by each device, one lineper range.  Each line contains three fields separated by white space: first addressin hexadecimal,last address, name of device..PPReads from.I irqallocreturn the enabled interrupts, one line perinterrupt.  Each line contains three fields separated by white space:the trap number, the IRQ it is assigned to, and the name ofthe device using it..PPReads and writes to.IR iob ,.IR iow ,and.I iolcause 8-bit wide, 16-bit wide, and 32-bit wide requests toI/O ports.The port accessed is determined by the byte offset of thefile descriptor..SH EXAMPLEThe following Limbo code reads from an x86 byte I/O port..IP.EXinportb(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