Changes to the Kernel in 4.2BSD July 25, 1983 Samuel J. Leffler Computer Systems Research Group Department of Electrical Engineering and Computer Science University of California, Berkeley Berkeley, California 94720 (415) 642-7780 This document summarizes the changes to the kernel between the September 1981 4.1BSD release and the July 1983 4.2BSD distribution. The information is presented in both overall terms (e.g. organizational changes), and as specific comments about individual files. See the source code itself for more details. The system has undergone too many changes to detail everything. Instead the major areas of change will pointed out, followed by a brief description of the contents of files present in the 4.1BSD release. Where important changes and/or bug fixes were applied they are described. The networking support is not discussed in this document, refer to ``4.2BSD Networking Implementation Notes'' for a discussion of the internal structure of the network facili- ties. Major changes include: o+ organizational changes to isolate VAX specific portions of the system o+ changes to support the new file system organization o+ changes to support the new interprocess communication facilities o+ changes for the new networking support; in particular, the DARPA standard Internet protocols TCP, UDP, IP, and ICMP, and the _n_e_t_w_o_r_k _i_n_t_e_r_f_a_c_e _d_r_i_v_e_r_s which provide hardware support o+ changes for the new signal facilities September 28, 1987 - 2 - o+ changes for the new time and interval timer facilities o+ changes to eliminate references to global variables; in particular, the global variables _u._u__b_a_s_e, _u._u__o_f_f_s_e_t, _u._u__s_e_g_f_l_g, and _u._u__c_o_u_n_t have been almost completely replaced by _u_i_o structures which are passed by reference; the _u._u__e_r_r_o_r variable has not been completely purged from low level portions of the system, but is in many places now returned as a function value; the _u_i_o changes were necessitated by the new scatter-gather i/o facili- ties o+ changes for the new disk quota facilities o+ changes for more flexible configuration of the disk space used for paging and swapping _1. _C_a_r_r_y_i_n_g _o_v_e_r _l_o_c_a_l _s_o_f_t_w_a_r_e With the massive changes made to the system, both in organization and in content, it may take some time to under- stand how to carry over local software. The majority of this document is devoted to describing the contents of each important source file in the system. If you have local software other than device drivers to incorporate in the system you should first read this document completely, then study the source code to more fully understand the changes as they affect you. Locally written device drivers will need to be con- verted to work in the new system. The changes required of device drivers are: 1) The calling convention for the driver _i_o_c_t_l routine has changed. Any data copied in or out of the system is now done at the highest level inside _i_o_c_t_l(). The third parameter to the driver _i_o_c_t_l routine is a data buffer passed by reference. Values to be returned by a driver must be copied into the associated buffer from which the system then copies them into the user address space. 2) The _r_e_a_d, _w_r_i_t_e, and _i_o_c_t_l entry points in device drivers must return 0 or an error code from <_e_r_r_n_o._h>. 3) The _r_e_a_d and _w_r_i_t_e entry points should no longer refer- ence global variables out of the user area. A new _u_i_o parameter is passed to these routines which should, in turn, be passed to the _p_h_y_s_i_o() routine if the driver supports raw i/o. 4) Disk drivers which are to support swapping/paging must have a new routine which returns the size, in sectors, of a disk partition. This value is used in calculating September 28, 1987 - 3 - the size of swapping/paging areas at boot time. 5) Code which previously used the _i_o_m_o_v_e, _p_a_s_s_c, or _c_p_a_s_s routines will have to be modified to use the new _u_i_o_m_o_v_e, _u_r_e_a_d_c, and _u_w_r_i_t_e_c routines. The new rou- tines all use a _u_i_o structure to communicate the i/o base, offset, count, and segflag values previously passed globally in the user area. 6) Include files have been rearranged and new ones have been created. Common machine-dependent files such as _m_t_p_r._h, _p_t_e._h, _r_e_g._h, and _p_s_l._h are no longer in the ``h'' directory; see below under organizational changes. 7) The handling of UNIBUS resets has changed. The reset routine should no longer deallocate UNIBUS resources allocated to pending i/o requests (this is done in the _u_b_a_r_e_s_e_t routine). For most drivers this means the reset routine simply needs to invalidate any _u_b__i_n_f_o values stored in local data structures to insure new UNIBUS resources will be allocated the next time the ``device start'' routine is entered. _2. _O_r_g_a_n_i_z_a_t_i_o_n_a_l _c_h_a_n_g_e_s The directory organization and file names are very dif- ferent from 4.1BSD. The new directory layout breaks machine-specific and network-specific portions of the system out into separate directories. A new file, _m_a_c_h_i_n_e is a symbolic link to a directory for the target machine, e.g. _v_a_x. This allows a single set of sources to be shared between multiple machine types (by including header files as ``../machine/file''). The directory naming conventions, as they relate to the network support, are intended to allow expansion in supporting multiple ``protocol families''. The following directories comprise the system sources for the VAX: /sys/h machine independent include files /sys/sys machine independent system source files /sys/conf site configuration files and basic templates /sys/net network independent, but network related code /sys/netinet DARPA Internet code /sys/netimp IMP support code /sys/netpup PUP-1 support code /sys/vax VAX specific mainline code /sys/vaxif VAX network interface code /sys/vaxmba VAX MASSBUS device drivers and related code /sys/vaxuba VAX UNIBUS device drivers and related code September 28, 1987 - 4 - Files indicated as _m_a_c_h_i_n_e _i_n_d_e_p_e_n_d_e_n_t are shared among 4.2BSD systems running on the VAX and Motorola 68010. Files indicated as _m_a_c_h_i_n_e _d_e_p_e_n_d_e_n_t are located in directories indicative of the machine on which they are used; the 4.2BSD release from Berkeley contains support only for the VAX. Files marked _n_e_t_w_o_r_k _i_n_d_e_p_e_n_d_e_n_t form the ``core'' of the networking subsystem, and are shared among all network software; the 4.2BSD release from Berkeley contains complete support only for the DARPA Internet protocols IP, TCP, UDP, and ICMP. _3. _B_u_g _f_i_x_e_s _a_n_d _c_h_a_n_g_e_s This section contains a brief description of each file which is not part of the network subsystem, and also indi- cates important changes and bug fixes applied to the source code contained in the file. _3._1. /_s_y_s/_h Files residing here are intended to be machine indepen- dent. Consequently, the header files for device drivers which were present in this directory in 4.1BSD have been moved to other directories; e.g. /sys/vaxuba. Many files which had been duplicated in /usr/include are now present only in /sys/h. Further, the 4.1BSD /usr/include/sys direc- tory is now normally a symbolic link to this directory. By having only a single copy of these files the ``multiple update'' problem no longer occurs. (It is still possible to have /usr/include/sys be a copy of the /sys/h for sites where it is not feasible to allow the general user community access to the system source code.) The following files are new to /sys/h in 4.2BSD: domain.h describes the internal structure of a commun- ications domain; part of the new ipc facili- ties errno.h had previously been only in /usr/include; the file /usr/include/errno.h is now a symbolic link to this file fs.h replaces the old filsys.h description of the file system organization gprof.h describes various data structures used in profiling the kernel; see _g_p_r_o_f(1) for details kernel.h is an offshoot of systm.h and param.h; con- tains constants and definitions related to the logical UNIX ``kernel'' September 28, 1987 - 5 - mbuf.h describes the memory managment support used mostly by the network; see ``4.2BSD Network- ing Implementation Notes'' for more informa- tion mman.h contains definitions for planned changes to the memory management facilities (not imple- mented in 4.2BSD) nami.h defines various structures and manifest con- stants used in conjunctions with the _n_a_m_e_i routine (part of this file reflects future plans for changes to _n_a_m_e_i rather than current use) protosw.h contains a description of the protocol switch table and related manifest constants and data structures use in communicating with routines located in the table quota.h contains definitions related to the new disk quota facilities resource.h contains definitions used in the _g_e_t_r_u_s_a_g_e, _g_e_t_r_l_i_m_i_t, and _g_e_t_p_r_i_o_r_i_t_y system calls (among others) socket.h contains user-visible definitions related to the new socket ipc facilities socketvar.h contains implementation definitions for the socket ipc facilities ttychars.h contains definitions related to tty character handling; in particular, manifest constants for the system standard erase, kill, inter- rupt, quit, etc. characters are stored here (all the appropriate user programs use these manifest definitions) ttydev.h contains definitions related to hardware specific portions of tty handling (such as baud rates); to be expanded in the future uio.h contains definitions for users wishing to use the new scatter-gather i/o facilities; also contains the kernel _u_i_o structure used in implementing scatter-gather i/o un.h contains user-visible definitions related to the ``unix'' ipc domain unpcb.h contains the definition of the protocol con- trol block used in the ``unix'' ipc domain September 28, 1987 - 6 - wait.h contains definitions used in the _w_a_i_t and _w_a_i_t_3(2) system calls; previously in /usr/include/wait.h The following files have undergone significant change: buf.h reflects the changes made to the buffer cache for the new file system organization - buffers are variable sized with pages allo- cated to buffers on demand from a pool of pages dedicated to the buffer cache; one new structure member has been added to eliminate overloading of a commonly unreferenced struc- ture member; a new flag B_CALL, when set, causes the function _b__i_o_d_o_n_e to be called when i/o completes on a buffer (this is used to wakeup the pageout daemon); macros have been added for manipulating the buffer queues, these replace the previous subrou- tines used to insert and delete buffers from the queues conf.h reflects changes made in the handling of swap space and changes made for the new _s_e_l_e_c_t(2) system call; the block device table has a new member, _d__p_s_i_z_e, which returns the size of a disk partition, in sectors, given a major/minor value; the character device table has a new member, _d__s_e_l_e_c_t, which is passed a _d_e_v__t value and an FREAD (FWRITE) flag and returns 1 when data may be read (written), and 0 otherwise; the _s_w_d_e_v_t structure now includes the size, in sectors, of a swap par- tition dir.h is completely different since directory entries are now variable length; definitions for the user level interface routines described in _d_i_r_e_c_t_o_r_y(3) are also present file.h has a very different _f_i_l_e structure defini- tion and definitions for the new _o_p_e_n and _f_l_o_c_k system calls; symbolic definitions for many constants commonly supplied to _a_c_c_e_s_s and _l_s_e_e_k, are also present inode.h reflects the new hashed cacheing scheme as well additions made to the on-disk and in- core inodes; on-disk inodes now contain a count of the actual number of disk blocks allocated a file (used mostly by the disk quota facilities), larger time stamps (for planned changes), more direct block pointers, and room for future growth; in-core inodes September 28, 1987 - 7 - have new fields for the advisory locking facilities, a back pointer to the file system super block information (to eliminate look- ups), and a pointer to a structure used in implementing disk quotas. ioctl.h has all request codes constructed from _IO, _IOR, _IOW, and _IOWR macros which encode whether the request requires data copied in, out, or in and out of the kernel address space; the size of the data parameter (in bytes) is also encoded in the request, allow- ing the _i_o_c_t_l() routine to perform all user- kernel address space copies mount.h the _m_o_u_n_t structure has a new member used in the disk quota facilities param.h has had numerous items deleted from it; in particular, many definitions logically part of the ``kernel'' have been moved to kernel.h, and machine-dependent values and definitions are now found in param.h files located in machine/param.h; contains a mani- fest constant, NGROUPS, which defines the maximum size of the group access list proc.h has changed extensively as a result of the new signals, the different resource usage structure, the disk quotas, and the new timers; in addition, new members are present to simplify searching the process tree for siblings; the SDLYU and SDETACH bits are gone, the former is replaced by a second parameter to _p_a_g_e_i_n, the latter is no longer needed due to changes in the handling of open's on /dev/tty by processes which have had their controlling terminal revoked with _v_h_a_n_g_u_p signal.h reflects the new signal facilities; several new signals have been added: SIGIO for signal driven i/o; SIGURG for notification when an urgent condition arises; and SIGPROF and SIGVTALRM for the new timer facilities; structures used in the _s_i_g_v_e_c(2) and _s_i_g_- _s_t_a_c_k(2) system calls, as well as signal handler invocations are defined here stat.h has been updated to reflect the changes to the inode structure; in addition a new field _s_t__b_l_k_s_i_z_e contains an ``optimal blocking factor'' for performing i/o (for files this is the block size of the underlying file September 28, 1987 - 8 - system) systm.h has been trimmed back a bit as various items were moved to kernel.h time.h contains the definitions for the new time and interval timer facilities; time zone defini- tions for the half dozen time zones under- stood by the system are also included here tty.h reflects changes made to the internal struc- ture of the terminal handler; the ``local'' structures have been merged into the standard flags and character definitions though the user interface is virtually identical to that of 4.1BSD; the TTYHOG value has been changed from 256 to 255 to account for a counting problem in the terminal handler on input buffer overflow user.h has been extensively modified; members have been grouped and categorized to reflect the ``4.2BSD System Manual'' presentation; new members have been added and existing members changed to reflect: the new groups facili- ties, changes to resource accounting and lim- iting, new timer facilities, and new signal facilities vmmac.h has had many macro definitions changed to eliminate assumptions about the hardware vir- tual memory support; in particular, the stack and user area page table maps are no longer assumed to be adjacent or mapped by a single page table base register vmparam.h now includes machine-dependent definitions from a file machine/vmparam.h. vmsystm.h has had several machine-dependent definitions moved to machine/vmparam.h _3._2. /_s_y_s/_s_y_s This directory contains the ``mainstream'' kernel code. Files in this directory are intended to be shared between 4.2BSD implementations on all machines. As there is little correspondence between the current files in this directory and those which were present in 4.1BSD a general overview of each files's contents will be presented rather than a file- by-file comparison. Files in the _s_y_s directory are named with prefixes which indicate their placement in the internal system September 28, 1987 - 9 - layering. The following table summarizes these naming con- ventions. init_ system initialization kern_ kernel (authentication, process management, etc.) quota_ disk quotas sys_ system calls and similar tty_ terminal handling ufs_ file system uipc_ interprocess communication vm_ virtual memory _3._2._1. _I_n_i_t_i_a_l_i_z_a_t_i_o_n _c_o_d_e init_main.c contains system startup code init_sysent.c contains the definition of the _s_y_s_e_n_t table - the table of system calls supported by 4.2BSD _3._2._2. _K_e_r_n_e_l-_l_e_v_e_l _s_u_p_p_o_r_t kern_acct.c contains code used in per-process account- ing kern_clock.c contains code for clock processing; work was done here to minimize time spent in the _h_a_r_d_c_l_o_c_k routine; support for kernel pro- filing and statistics collection from an alternate clock source have been added; a bug which caused the system to lose time has been fixed; the code which drained ter- minal multiplexor silos has been made the default mode of operation and moved to locore.s kern_descrip.c contains code for management of descrip- tors; descriptor related system calls such as _d_u_p and _c_l_o_s_e (the upper-most levels) are present here kern_exec.c contains code for the _e_x_e_c system call kern_exit.c contains code for the _e_x_i_t system call kern_fork.c contains code for the _f_o_r_k (and _v_f_o_r_k) sys- tem call kern_mman.c contains code for memory management related calls; the contents of this file is expected to change when the revamped memory September 28, 1987 - 10 - management facilities are added to the sys- tem kern_proc.c contains code related to process manage- ment; in particular, support routines for process groups kern_prot.c contains code related to access control and protection; the notions of user ID, group ID, and the group access list are imple- mented here kern_resource.c code related to resource accounting and limits; the _g_e_t_r_u_s_a_g_e and ``get'' and ``set'' resource limit system calls are found here kern_sig.c the signal facilities; in particular, ker- nel level routines for posting and process- ing signals kern_subr.c support routines for manipulating the _u_i_o structure: _u_i_o_m_o_v_e, _u_r_e_a_d_c, and _u_w_r_i_t_e_c kern_synch.c code related to process synchonization and scheduling: _s_l_e_e_p and _w_a_k_e_u_p among others kern_time.c code related to processing time; the han- dling of interval timers and time of day kern_xxx.c miscellaneous system facilities and code for supporting 4.1BSD compatibility mode (kernel level) _3._2._3. _D_i_s_k _q_u_o_t_a_s quota_kern.c ``kernel'' of disk quota suppport quota_subr.c miscellaneous support routines for disk quotas quota_sys.c disk quota system call routines quota_ufs.c portions of the disk quota facilities which interface to the file system routines _3._2._4. _G_e_n_e_r_a_l _s_u_b_r_o_u_t_i_n_e_s subr_mcount.c code used when profiling the kernel subr_prf.c _p_r_i_n_t_f and friends; also, code related to handling of the diagnostic message buffer subr_rmap.c subroutines which manage resource maps September 28, 1987 - 11 - subr_xxx.c miscellaneous routines and code for rou- tines implemented with special VAX instruc- tions, e.g. bcopy _3._2._5. _S_y_s_t_e_m _l_e_v_e_l _s_u_p_p_o_r_t sys_generic.c code for the upper-most levels of the ``generic'' system calls: _r_e_a_d, _w_r_i_t_e, _i_o_c_t_l, and _s_e_l_e_c_t; a ``must read'' file for the system guru trying to shake out 4.1BSD bad habits sys_inode.c code supporting the ``generic'' system calls of sys_generic.c as they apply to inodes; the guts of the byte stream file i/o interface sys_process.c code related to process debugging: _p_t_r_a_c_e and its support routine _p_r_o_c_x_m_t; this file is expected to change as better process debugging facilities are developed sys_socket.c code supporting the ``generic'' system calls of sys_generic.c as they apply to sockets _3._2._6. _T_e_r_m_i_n_a_l _h_a_n_d_l_i_n_g tty.c the terminal handler proper; both 4.1BSD and version 7 terminal interfaces have been merged into a single set of routines which are selected as line disciplines; a bug which caused new line delays past column 127 to be calculated incorrectly has been fixed; the high water marks for terminals running in tandem mode at 19.2 or 38.4 kilobaud have been upped tty_bk.c the old Berknet line discipline (defunct) tty_conf.c initialized data structures related to ter- minal handling; tty_pty.c support for pseudo-terminals; actually two device drivers in one; additions over 4.1BSD pseudo-terminals include a simple ``packet protocol'' used to support flow- control and output flushing on interrupt, as well as a ``transparent'' mode used in programs such as emacs tty_subr.c c-list support routines tty_tb.c two line disciplines for supporting RS232 September 28, 1987 - 12 - interfaces to Genisco and Hitachi tablets tty_tty.c trivial support routines for ``/dev/tty'' _3._2._7. _F_i_l_e _s_y_s_t_e_m _s_u_p_p_o_r_t ufs_alloc.c code which handles allocation and dealloca- tion of file system related resources: disk blocks, on-disk inodes, etc. ufs_bio.c block i/o support; the buffer cache proper; see description of buf.h and ``A Fast File System for UNIX'' for information ufs_bmap.c code which handles logical file system to logical disk block number mapping; under- stands structure of indirect blocks and files with holes; handles automatic exten- sion of files on write ufs_dsort.c sort routine implementing prioritized seek sort algorithm for disk i/o operations ufs_fio.c code handling file system specific issues of access control and protection ufs_inode.c inode management routines; in-core inodes are now hashed and cached; inode synchroni- zation has been revamped since 4.1BSD to eliminate race conditions present in 4.1 ufs_mount.c code related to demountable file systems ufs_nami.c the _n_a_m_e_i routine (and related support rou- tines) - the routine that maps pathnames to inode numbers ufs_subr.c miscellaneous subroutines: this code is shared with certain user programs such as _f_s_c_k(8); for a good time look at the _b_u_f_s_- _t_a_t_s routine in this file ufs_syscalls.c file system related system calls, every- thing from _o_p_e_n to _u_n_l_i_n_k; many new system calls are found here: _r_e_n_a_m_e, _m_k_d_i_r, _r_m_d_i_r, _t_r_u_n_c_a_t_e, etc. ufs_tables.c static tables used in block and fragment accounting; this file is shared with user programs such as _f_s_c_k(8) ufs_xxx.c miscellaneous routines and 4.1BSD compati- bility code; all of the code which still understands the old inode format is in here September 28, 1987 - 13 - _3._2._8. _I_n_t_e_r_p_r_o_c_e_s_s _c_o_m_m_u_n_i_c_a_t_i_o_n uipc_domain.c code implementing the ``communication domain'' concept; this file must be aug- mented to incorporate new domains uipc_mbuf.c memory management routines for the ipc and network facilities; refer to the document ``4.2BSD Networking Implementation Notes'' for a detailed description of the routines in this file uipc_pipe.c leftover code for connecting two sockets into a pipe; actually a special case of the code for the _s_o_c_k_e_t_p_a_i_r system call uipc_proto.c UNIX ipc communication domain configuration definitions; contains UNIX domain data structure initialization uipc_socket.c top level socket support routines; these routines handle the interface to the proto- col request routines, move data between user address space and socket data queues, understand the majority of the logic in process synchronization as it relates to the ipc facilities uipc_socket2.c lower level socket support routines; pro- vide nitty gritty bit twiddling of socket data structures; manage placement of data on socket data queues uipc_syscalls.c user interface code to ipc system calls: _s_o_c_k_e_t, _b_i_n_d, _c_o_n_n_e_c_t, _a_c_c_e_p_t, etc.; con- cerned exclusively with system call argu- ment passing and validation uipc_usrreq.c UNIX ipc domain support; user request rou- tine and supporting utility routines _3._2._9. _V_i_r_t_u_a_l _m_e_m_o_r_y _s_u_p_p_o_r_t The code in the virtual memory subsystem has changed very little from 4.1BSD; changes made in these files were either to gain portability, handle the new swap space confi- guration scheme, or fix bugs. vm_drum.c code for the management of disk space used in paging and swapping vm_mem.c management of physical memory; the ``core map'' is implemented here as well as the routines which lock down pages for physical September 28, 1987 - 14 - i/o (the latter will have to change when the memory management facilities are modi- fied to support sharing of pages); a sign extension bug on block numbers extracted from the core map has been fixed (this caused the system to crash with certain disk partition layouts on RA81 disks) vm_mon.c support for virtual memory monitoring; code in this file is included in the system only if the PGINPROF and/or TRACE options are configured vm_page.c the code which handles and processes page faults: _p_a_g_e_i_n; race conditions in access- ing pages in transit and requests to lock pages for raw i/o have been fixed in this code; a major path through _p_a_g_e_i_n whose sole purpose was to implement the software simulated reference bit has been ``parallel coded'' in assembly language (this appears to decrease system time by at least 5% when a system is paging heavily); _p_a_g_e_i_n now has a second parameter indicating if the page to be faulted in should be left locked (this eliminated the need for the SDLYU flag in the _p_r_o_c structure) vm_proc.c mainly code to manage virtual memory allo- cation during process creation and destruc- tion (the virtual memory equivalent of ``passing the buck'' is done here). vm_pt.c code for manipulating process page tables; knowledge of the user area is found here as it relates to the user address space page tables vm_sched.c the code for process 0, the scheduler, lives here; other routines which monitor and meter virtual memory activity (used in implementing high level scheduling poli- cies) also are present; this code has been better parameterized to isolate machine- dependent heuristics used in the scheduling policies vm_subr.c miscellaneous routines: some for manipulat- ing accessability of virtual memory, others for mapping virtual addresses to logical segments (text, data, stack) vm_sw.c indirect driver for interleaved, multi- controller, paging area; modified to September 28, 1987 - 15 - support interleaved partitions of different sizes vm_swap.c code to handle process related issues of swapping vm_swp.c code to handle swap i/o vm_text.c code to handle shared text segments - the ``text'' table _3._3. /_s_y_s/_c_o_n_f This directory contains files used in configuring sys- tems. The format of configuration files has changed slightly; it is described completely in a new document ``Building 4.2BSD UNIX Systems with Config''. Several new files exist for use by the _c_o_n_f_i_g(8) program, and several old files have had their meaning changed slightly. LINT a new configuration file for use in linting kernels devices.vax maps block device names to major device numbers (on the VAX) files now has only files containing machine- independent code files._x_x_x (where _x_x_x is a system name) optional, _x_x_x- specific _f_i_l_e_s files files.vax new file describing files which contain machine-dependent code makefile.vax makefile template specific to the VAX param.c updated calculations of _n_t_e_x_t and _n_f_i_l_e to reflect network requirements; new quantities added for disk quotas _3._3._1. /_s_y_s/_v_a_x_u_b_a This directory contains UNIBUS device drivers and their related include files. The latter have moved from /sys/h in an effort to isolate machine-dependent portions of the sys- tem. The following device drivers were not present in the 4.1BSD release. ad.c a driver for the Data Translation A/D converter ik.c an Ikonas frame buffer graphics interphase; user access to the device is implemented by mapping the device registers directly into the virtual address September 28, 1987 - 16 - space of a user (the routines to map memory are included in uba.c only if an Ikonas is configured in the system) kgclock.c a driver for a DL11-W or KL11-W used as an auxili- ary real-time clock source for kernel profiling and/or statistics gathering; if this device is present, the system will automatically collect its i/o statistics (and if profiling, pc samples) off the secondary clock; very useful in kernel profil- ing as the second clock source eliminates most of the statistical anomalies and shows the true time spent in the clock routine ps.c driver for an Evans and Sutherland Picture System 2 rl.c driver for RL11 controller with RL02 cartridge disks; does not support RL01 disks though it should only require additions to disk geometry and partition tables rx.c driver for RX211 floppy disk controller; provides both block and character device interfaces; _i_o_c_t_l calls support floppy disk formatting and ``deleted data mark'' sensing and writing; makes a great paging device ut.c driver for tape controllers which emulate a TU45 on the UNIBUS; in particular, the System Indus- tries Model 9700 triple density tape drive uu.c driver for dual UNIBUS TU58 cartridge tape cassettes accessed through a DL11 serial line; uses assembly language code in locore.s which pro- vides pseudo-DMA on input (necessary to avoid data overruns); using this driver while the system runs multi-user degrades response severely (developed at Berkeley exclusively to produce distribution TU58 cassettes) In addition to the above device drivers, many drivers present in 4.1BSD now sport corresponding include files which contain device register definitions. For example, the DH11 driver is now broken into three files: dh.c, dhreg.h, and dmreg.h. The following drivers have been significantly modified, or had bugs fixed in them, since the 4.1BSD release: dh.c changes to reflect the revised tty data organiza- tion dmf.c a bug where device register accesses caused September 28, 1987 - 17 - unwitting modification of certain status bits has been fixed; modem control has been fixed; a rem- nant of the DH11 include file which caused incorrect definitions for even/odd parity has been fixed; changes to reflect the revised tty data organization dz.c now supports the DZ32; changes to reflect the revised tty data organization lp.c now takes a non-zero flags value specified in the configuration file as the printer width (default is 132 columns); thus, to configure an 80 column printer, include ``flags 80'' in the device specification rk.c a race condition has been fixed where a seek fin- ishing on one drive appeared as an i/o transfer completeing on another (this bug actually was present in all UNIBUS disk drivers); changes for _u_i_o and swap space configuration tm.c a typo which made the system crash with multiple slaves on a single controller has been fixed; an incorrect priority level change in the watchdog timer routine which caused the system to crash when a device operation timed out has been fixed; changes for _u_i_o processing of raw i/o ts.c changes for _u_i_o processing of raw i/o uba.c a new support routine for allocating UNIBUS memory for memory-mapped devices such as the 3Com Ether- net interface; the handling of UNIBUS resets has been changed, all UNIBUS resources are now reclaimed in the _u_b_a_r_e_s_e_t routine prior to calling individual device driver reset routines - this implies driver reset routines should no longer free up allocated UNIBUS resources; new routines for mapping UNIBUS memory into the virtual address space of a process have been added to support the Ikonas device driver; changes to fix the race condition described above in the RK07 device driver; processes awaiting UNIBUS map registers now sleep on a different event than those waiting for buffered data paths uda.c the problem with multiplexing buffered data paths on an 11/750 has been fixed; a bug in the setup of the _u_i__d_k field has been fixed; now properly defines the field indicating the disk transfer rate; changes for _u_i_o processing and swap space configuration September 28, 1987 - 18 - up.c now supports ECC correction and bad sector for- warding; significant changes have been made to make configuration of various disk drives simple (by probing the holding register and using the resultant value indicating the number of tracks on the disk); the race condition described under rk.c has been fixed; references to UNIBUS map registers are now done with longword instructions so the device driver does not cause the system to crash when an ECC or bad sector error occurs on a disk attached to a 730 UNIBUS; the upSDIST/upRDIST parameters which control the use of search and seek operations on controllers with multiple drives have been made drive dependent; a bug whereby the probe routine would belive certain non-existant drives were present has been fixed; changes for _u_i_o processing and swap space confi- guration va.c has been rewritten to honor the software support for exclusive access to the UNIBUS so that the device may coexist on the same UNIBUS with RK07 disk drives; the driver now works with controllers which have a GO bit _3._3._2. /_s_y_s/_v_a_x The following files are new in 4.2BSD: crt0.ex edit script for creating a profiled kernel frame.h copied from /usr/include in_cksum.c checksum routine for the DARPA Internet pro- tocols param.h machine-dependent portion of /sys/h/param.h pup_cksum.c checksum routine for PUP-I protocols rsp.h protocol definitions for communicating with a TU58 sys_machdep.c machine-dependent portion of the ``sys_*'' files of /sys/sys ufs_machdep.c machine-dependent portion of the ``ufs_*'' files of /sys/sys vm_machdep.c machine-dependent portion of the ``vm_*'' files of /sys/sys vmparam.h machine-dependent portion of /sys/h/vmparam.h September 28, 1987 - 19 - The following files have been modified for 4.2BSD: Locore.c includes new definitions for linting the net- work and ipc code asm.sed now massages _i_n_s_q_u_e, _r_e_m_q_u_e, and various rou- tines which do byte swapping into assembly language autoconf.c handles MASSBUS drives which come on-line after the initial autoconfiguration process; sizes and configures swap space at boot time in addition to calculating the swap area allocation parameters _d_m_t_e_x_t, _d_m_m_a_x, and _d_m_m_i_n (which were manifest constants in 4.1BSD); calculates the disk partition offset for system dumps at boot time to take into account variable sized swap areas; now uses the per-driver array of standard control status register addresses when probing for devices on the UNIBUS; now allows MASSBUS tapes and disks to be wildcarded across con- trollers conf.c uses many ``local'' spaces for new and uncom- mon device drivers genassym.c generates several new definitions for use in locore.s locore.s includes code to vector software interrupts to protocol processing modules; assembly language assist routines for the console and UNIBUS TU58 cassette drives; a new routine, _F_a_s_t_r_e_c_l_a_i_m is a fast coding of a major path through the _p_a_g_e_i_n routine; copyin and copy- out now handle greater than 64Kbyte data copies and return EFAULT on failure; under- stands the new signal trampoline code; now contains code for draining terminal multi- plexor silos at clock time; a bug where a the translation buffer was sometimes being improperly flushed during a _r_e_s_u_m_e operation has been fixed machdep.c a bug which caused memory errors to not be reported on 11/750's has been fixed; has new code for handling the new signals; recovers from translation buffer parity fault machine checks apparently caused by substandard memory chips used in many 11/750's; includes optional code to pinpoint bad memory chips on Trendata memory boards; the machine check routine now calls the _m_e_m_e_r_r routine to print September 28, 1987 - 20 - out the memory controller status registers in case the fault occurred because of a memory error mem.c now has correct definitions to enable correctable memory error reporting on 11/750's: DEC documentation incorrectly specifies use of the ICRD bit pcb.h has changes related to the new signal trampo- line code swapgeneric.c supports more devices which can be used as a generic root device; interacts with the new swap configuration code to size the swap area properly when running a generic system; understands the special ``swap on root'' dev- ice syntax used when installing the system trap.c can be compiled with a SYSCALLTRACE define to allow system calls to be traced when the variable _s_y_s_c_a_l_l_t_r_a_c_e is non-zero; tu.c includes (limited) support for the TU58 con- sole cassette on the 11/750, sufficient for use in single-user mode; supports the use of the MRSP ROM on the 11/750. _3._3._3. /_s_y_s/_v_a_x_m_b_a The following bug fixes and modifications have been applied to the MASSBUS device drivers: hp.c a large number of disk drives attached to second vendor disk controllers are now automatically recognized at boot time by probing the holding register and using disk geometry information to decide what kind of drive is present; the hpSDIST/hpRDIST parameters that control seek and search operations on controllers with multiple drives have been made a per-drive parameter; a bug where the sector number reported on a hard error was off by one has been fixed; the error recovery code now searches the bad sector table when a header CRC error occurs; the error recovery code now handles bad sectors on tracks which also have skip sectors; a bug in the handling of ECC errors has been fixed; many separate driver data struc- tures have been consolidated into the software carrier structure; the driver handles the ML-11 solid-state disk mba.c now autoconfigures MASSBUS tapes and disks which ``come on-line'' after the initial boot September 28, 1987 - 21 - _4. _S_t_a_n_d_a_l_o_n_e _s_u_p_p_o_r_t This section describes changes made to the standalone i/o facilities and the new methods used in system bootstrap- ping. _4._1. _D_i_s_k _f_o_r_m_a_t_t_i_n_g A new disk formatting program has been developed for use with non-DEC UNIBUS and MASSBUS disk controllers. The _f_o_r_m_a_t(8V) program has been tested mainly with disk drives attached to Emulex MASSBUS and UNIBUS disk controllers, but should operate with any controller which handles bad sector forwarding in an identical fashion to DEC RM03/RM05 or RM80 (but not RP06) disk controllers. The program runs stan- dalone formatting disk headers and creating a bad sector table in the DEC standard 144 format. _4._2. _S_t_a_n_d_a_l_o_n_e _i/_o _l_i_b_r_a_r_y Changes to support more complex standalone i/o applications as well as changes for the new file system organization, have resulted in significant revisions to the standalone i/o library. Device drivers now support a new entry point for _i_o_c_t_l requests and library routines now return error codes a la the UNIX system calls. In addition, standalone i/o library routines now make many more internal consistency checks to verify data structures have not been corrupted by faulty device drivers and that i/o errors have not occurred when reading critical file system information. In conjunc- tion with the new disk formatter, the _u_p and _h_p standalone drivers have been rewritten to support ECC correction and bad sector handling. These drivers are used in bootstrap- ping from the console media on 11/780's and 11/730's thereby eliminating the requirement for error free root partitions on disks attached to _h_p and _u_p controllers. Many bugs in the standalone tape drivers have been fixed. _4._3. _S_y_s_t_e_m _b_o_o_t_s_t_r_a_p_p_i_n_g On 11/780's and 11/730's, the console device is still used to load the ``boot'' program. This in turn loads the system image from the root file system. The method by which the system bootstraps on 11/750's is different in 4.2BSD. The system is still bootstrapped from disk using a boot block in sector 0 of the root file system partition, but now this boot block simply reads in the next 7.5 kilobytes. The 7.5 kilobyte program is a ver- sion of the ``/boot'' program loaded only with the device driver required to read the ``/boot'' program from the root file system. The ``/boot'' program then reads in the system image, as done on 11/780's and 11/730's. September 28, 1987 - 22 - The additional level of bootstrap code was done to sim- plify the sector 0 boot programs and minimize the total amount of assembly language code which had to be maintained. It was also expected that 7.5 kilobytes would be sufficient to allow the new _h_p and _u_p standalone drivers which support ECC correction and bad sector handling to be used. Unfor- tunately, the standalone system has not yet been trimmed down to allow the second level boot programs, loaded with the new drivers, to fit in the space provided. Sites which have Winchester disk drives with bad sectors in the root file system partition and which require this support should be able to trim the size of the second level boot program to make it fit. September 28, 1987