hasiuk@spp2.UUCP (Lee Hasiuk) (12/15/85)
I have posted to net.sources a package which will allow users of Sun Unix 4.2 to develop device drivers without reloading and rebooting their systems. Although the code is Sun specific, the principles behind it should be applicable to almost any Unix implementation, and I hope that some of you 'device driver types' out there find it useful to port and distribute versions for other machines (or improvements for the Sun version, which is by no means perfect). The basic idea behind the package is to take advantage of the fact that executable code may be placed into the data space of the kernel and run in place. The package consists of a device driver template, which accesses its open, close, read, write, and ioctl routines indirectly through an array whose name appears in the kernel's namelist. Also in the driver is an array into which a 'loadable' device driver may be loaded by writing to /dev/kmem. The name of this array also appears in the namelist. The bulk of the code is a program which root runs in user mode which looks in the namelist of /vmunix, finds the addresses of these arrays, ld's the driver .o file against /vmunix to resolve global symbols (such as calls to sleep and wakeup) producing an executable which runs at the starting address of the large array. The 'loader' program then copies the driver into the kernel, and fills in the indirection array with the entry points of the loadable driver. Although the program will allow driver development while a system is on-line and servicing other users, this practice is not recommended because drivers with bugs frequently crash a system. The major savings of using loadable drivers comes from the reduction in the number of link/reboot cycles. My feeling is that once you try loadable drivers, you'll never want to go back to doing it the 'old way'. Lee Hasiuk {ucbvax, decvax, ihnp4}!trwrb!trwspp!spp2!hasiuk