FreeBSD Architecture Handbook

The FreeBSD Documentation Project

Welcome to the FreeBSD Architecture Handbook. This manual is a work in progress and is the work of many individuals. Many sections do not yet exist and some of those that do exist need to be updated. If you are interested in helping with this project, send email to the FreeBSD documentation project mailing list.

The latest version of this document is always available from the FreeBSD World Wide Web server. It may also be downloaded in a variety of formats and compression options from the FreeBSD FTP server or one of the numerous mirror sites.


Table of Contents
I. Kernel
1 Bootstrapping and kernel initialization
1.1 Synopsis
1.2 Overview
1.3 BIOS POST
1.4 boot0 stage
1.5 boot2 stage
1.6 loader stage
1.7 Kernel initialization
2 Locking Notes
2.1 Mutexes
2.2 Shared Exclusive Locks
2.3 Atomically Protected Variables
3 Kernel Objects
3.1 Terminology
3.2 Kobj Operation
3.3 Using Kobj
4 The Jail Subsystem
4.1 Architecture
4.2 Restrictions
5 The SYSINIT Framework
5.1 Terminology
5.2 SYSINIT Operation
5.3 Using SYSINIT
6 The TrustedBSD MAC Framework
6.1 MAC Documentation Copyright
6.2 Synopsis
6.3 Introduction
6.4 Policy Background
6.5 MAC Framework Kernel Architecture
6.6 MAC Policy Architecture
6.7 MAC Policy Entry Point Reference
6.8 Userland Architecture
6.9 Conclusion
7 Virtual Memory System
7.1 Management of physical memory--vm_page_t
7.2 The unified buffer cache--vm_object_t
7.3 Filesystem I/O--struct buf
7.4 Mapping Page Tables--vm_map_t, vm_entry_t
7.5 KVM Memory Mapping
7.6 Tuning the FreeBSD VM system
8 SMPng Design Document
8.1 Introduction
8.2 Basic Tools and Locking Fundamentals
8.3 General Architecture and Design
8.4 Specific Locking Strategies
8.5 Implementation Notes
8.6 Miscellaneous Topics
Glossary
II. Device Drivers
9 Writing FreeBSD Device Drivers
9.1 Introduction
9.2 Dynamic Kernel Linker Facility - KLD
9.3 Accessing a device driver
9.4 Character Devices
9.5 Block Devices (Are Gone)
9.6 Network Drivers
10 ISA device drivers
10.1 Synopsis
10.2 Basic information
10.3 Device_t pointer
10.4 Configuration file and the order of identifying and probing during auto-configuration
10.5 Resources
10.6 Bus memory mapping
10.7 DMA
10.8 xxx_isa_probe
10.9 xxx_isa_attach
10.10 xxx_isa_detach
10.11 xxx_isa_shutdown
10.12 xxx_intr
11 PCI Devices
11.1 Probe and Attach
11.2 Bus Resources
12 Common Access Method SCSI Controllers
12.1 Synopsis
12.2 General architecture
12.3 Polling
12.4 Asynchronous Events
12.5 Interrupts
12.6 Errors Summary
12.7 Timeout Handling
13 USB Devices
13.1 Introduction
13.2 Host Controllers
13.3 USB Device Information
13.4 Device probe and attach
13.5 USB Drivers Protocol Information
14 Newbus
14.1 Device Drivers
14.2 Overview of Newbus
14.3 Newbus API
15 Sound subsystem
15.1 Introduction
15.2 Files
15.3 Probing, attaching, etc.
15.4 Interfaces
16 PC Card
16.1 Adding a device
III. Appendices
Bibliography
Index
List of Tables
2-1. Mutex List
2-2. Shared Exclusive Lock List
List of Figures
14-1. driver_t implementation
14-2. Device statesdevice_state_t
List of Examples
5-1. Example of a SYSINIT()
5-2. Example of Adjusting SYSINIT() Order
5-3. Example of a SYSUNINIT()
9-1. Example of a Sample Echo Pseudo-Device Driver for FreeBSD 4.X
9-2. Example of a Sample Echo Pseudo-Device Driver for FreeBSD 5.X
14-1. Newbus Methods

This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <[email protected]>.
For questions about this documentation, e-mail <[email protected]>.