|
|
The UNIX I/O model generally uses kernel-level device drivers for all access to the hardware. User-level processes call these device drivers through system calls rather than directly accessing the PC 's I/O and address busses. However, acfg utilities are a special case and must be able to search the I/O and memory address space looking for hardware before the device driver has been linked into the UNIX kernel.
If the acfg needs access to the I/O bus, it must issue the sysi86( ) system call to enable I/O bus access. The system call is:
#include <sys/sysi86.h>A small piece of assembler code is linked into each acfg utility to provide function calls that use these instructions. The assembler module is given a name such as io.s; the sample source code for drivers that use an acfg utility include examples. The following functions are implemented:sysi86(SI86V86, V86SC_IOPL, 0x3000)
For more information, see ``Programmed I/O (PIO)''
To access the memory address bus, the acfg should address the /dev/mem driver. To read from physical memory, open the device for reading, seek to the start address, and read the region into the user process from the file descriptor.