/joh'liks/ n.,adj. 386BSD

Porting Unix to the 386: A Practical Approach



William & Lynne Jolitz


Started open source UNIX.

Appeared in part as a 17 article magazine series in 1991-1992.

Documented the "how, what, why, who, when" of porting BSD to the 386.

Done while BSD was becoming "open source".





Porting Unix to the 386: A Practical Approach - DESIGNING THE SOFTWARE SPECIFICATION

DESIGNING THE SOFTWARE SPECIFICATION:

Porting Unix to the 386: Designing the Software Specification

This, the first article, is the first published mention of 386BSD. By this time, the project had been operational for 18 months, and William Jolitz was at Berkeley working on the Net/2 release.
In this installment, we discussed the beginning of our project and the initial framework that guided our efforts, in particular, the development of the 386BSD specification.

Getting Started: References, Equipment, and Software

We'd gathered books and equipment to begin the port in 1989. Most critical was the Crawford and Gelsinger book.
We went through many PCs, most of them portables. Compaq sent a DeskPro 386, and SystemPro 386 & 486.

Development of the 386BSD Specification

The 386BSD specification was in two parts - one that detailed getting to a operational system that could build itself and basic console applications, and a more extensive community involvement part, called "A Modest Proposal".

The Definition of the 386BSD Specification

Choosing how far to go in supporting X86 architecture in order to get a basic BSD UNIX system to be able to bootstrap the futre efforts.

Conflicts in Priorities

We resolve conflicts between UNIX worlds by choosing a middle way - one that isn't a pure standard, but one that doesn't fight standards commonality.

386BSD Port Goals: A Practical Approach

We decided to shoot for a system that emphasized novel 386 support code to create a basic BSD environment on the 386. We assumed that by making it freely available, others will extend the work to remaining areas.

386 Memory Management Vitals

Most popular microprocessors use either segmentation or paging to manage memory address space access. The 386 is rare in that it possesses both. In fact, since segmentation, (see Figure 3(a)), is placed on top of paging (see Figure 3(b)), you are expected to use segmentation in some form any time memory is paged. And, most important, BSD relies on paging.

Segmentation and 386BSD

Reconciling segmentation to UNIX has never been easy, and with 386BSD its an even greater chore. The issues of supporting X86 segments in a Berkeley UNIX world.

Kernel Linear Address Space Overhead

386BSD ignored as much as possible the segmentation hardware of the x86, preferring to use a "flat" address space.

Virtual Address Space Layout

386BSD executed programs with a virtual address similar to a VAX running UNIX. In February 1991, this changed so that the format of the process virtual address space memory usage could be arranged differently.

Per-Process Data Structures

A UNIX legacy, the "u." or per-process data structure, which held the kernel-related data of a process, was present on 386BSD prior to February 1991.

386 Virtual Memory Address Translation Mechanism

The 386 Paging Memory Management allocates memory in 4KB and 4MB allocation units. This impacts the way programs execute and share file data.

User to Kernel Communication Primitives

One surprise with 386BSD was that the 80386 doesn't honor write protection on the user page addresses, requiring a work-around. This was fixed in 80486 and all subsequent X86 processors.

Berkeley UNIX Virtual Memory System Strategy

386BSD started out in 1989 with a derivative virtual memory system from the VAX by way of a 68030. In February/March 1991, it was cutover to a totally different one cut out of CMU's MACH system, and released with Net/2.

Structure of Per-Process Data (u.)

The "u." in more detail, handling kernel stack overflows in 386BSD.

Process Context Description

Hardware context switch state description and the part where 386BSD context switching intrudes into the machine independent code semantics.

Other Processor Faults

Catching terminal processor faults.

Microprocessor Idiosyncrasies

Sometimes you're forced to use processor features - like hardware context switching. Origionally, the earliest versions of 386BSD didn't use the hardware context switch TSS feature - but you still had to have one anyways.

System Call Interface

How to call the system's kernel from a process, using existing industry standards accross the X86 platform.

System Specific (ISA) Issues

The AT platform itself requires support in order to have an operational system. And with growth of elovling industry standards, this morphs over time into newer ones as well.

Physical Memory Map

The actual memory referenced on processor, system, and I/O device busses, or physical memory addresses have standard assignments for the kernel to manage for the operating system to function.

ISA Device Controllers

ISA devices that attach to the AT standard through controllers field a broad number of devices various categories.

ISA Device Auto Configuration

To find controllers and devices, we use tables to instruct device drivers where to probe and attach found peripherals and connect them with low-level drivers and high-level kernel subsystems.

Interrupt Priority Level Management

Part of the specification also details the interrupt control mechanism that allows device interrupts to be blocked/unblocked and caught by device drivers interrupt handling code.

Bootstrap Operation

How to bootstrap the system from hardware, loading the kernel program, itself a protected mode executable from secondary / nonvolatile / disk storage.

Summary: Where is 386BSD Now?

The state of the 386BSD world back in mid-1990 is synopsized here. By the time this appeared, EISA and other "beyond AT" support had been added. CSRG only let other UC institutions have code, although a complete binary and source release was present and tested for 6 months.

Suggested Readings

Microprocessor and System Specification Issues

Support the processor, and support the ISA bus peripherals are the objectives for the first parts of 386BSD.

Page Fault and Segmentation Fault Mechanism

Catching potentially restartable 386 processor faults with 386BSD.

Porting Unix to the 386: Research and the Commercial Sector

Understanding the boundary between research and development with BSD, and where a balance between commercial efforts can be struck.





Copyright 2006 TeleMuse Partners, William Jolitz and Lynne Jolitz