In last month's installment, we discussed the elements of the 386BSD port, which required planning prior to the actual coding. In brief, the specification we outlined emphasized BSD compatibility, efficient use of the 80386 architecture, interoperability with extant commercial standards, and rapid implementation to leverage BSD UNIX to port the rest of itself. We also discussed the conflicts inherent between a segmented architecture and a virtual memory system which prefers paging, other microprocessor idiosyncrasies and requirements, and the basic planning for the surrounding hardware. By taking a "practical approach" to this port and focusing on "hard adherence" to BSD operability and high-performance, we identified the key milestones required for this (or any) advanced operating system port and set the stage for our next effort: Writing the PC utilities that allow us to initially load the first programs and data onto our 386 target host.
With this in mind, we'll now examine code from three PC-based utilities -- boot.exe, cpfs.exe, and cpsw.exe -- that facilitate the basic access to the hardware from MS-DOS needed to begin a UNIX port. boot.exe executes a GCC-compiled program (using the Free Software Foundation's GNU C Compiler) in protected mode from MS-DOS. (Note that GCC generates only 32-bit protected-mode code.) cpfs.exe installs a root filesystem onto the hard disk. cpsw.exe copies files to a shared portion of disk so that MS-DOS and UNIX can exchange information.
In examining these areas, we will illustrate how the UNIX bootstrap process functions, because these programs mimic that process to a great degree. This will be important in later articles when we discuss the code and strategies used to build the bootstraps that allow the newly ported system to become independent of MS-DOS.