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
9 * UFS
10 * AFS
11 * Syscons
12 * Compatibility Layers
12.1 * Linux
II. Device Drivers
13 Writing FreeBSD Device Drivers
13.1 Introduction
13.2 Dynamic Kernel Linker Facility - KLD
13.3 Accessing a device driver
13.4 Character Devices
13.5 Block Devices (Are Gone)
13.6 Network Drivers
14 ISA device drivers
14.1 Synopsis
14.2 Basic information
14.3 Device_t pointer
14.4 Configuration file and the order of identifying and probing during auto-configuration
14.5 Resources
14.6 Bus memory mapping
14.7 DMA
14.8 xxx_isa_probe
14.9 xxx_isa_attach
14.10 xxx_isa_detach
14.11 xxx_isa_shutdown
14.12 xxx_intr
15 PCI Devices
15.1 Probe and Attach
15.2 Bus Resources
16 Common Access Method SCSI Controllers
16.1 Synopsis
16.2 General architecture
16.3 Polling
16.4 Asynchronous Events
16.5 Interrupts
16.6 Errors Summary
16.7 Timeout Handling
17 USB Devices
17.1 Introduction
17.2 Host Controllers
17.3 USB Device Information
17.4 Device probe and attach
17.5 USB Drivers Protocol Information
18 Newbus
18.1 Device Drivers
18.2 Overview of Newbus
18.3 Newbus API
19 Sound subsystem
19.1 Introduction
19.2 Files
19.3 Probing, attaching, etc.
19.4 Interfaces
20 PC Card
20.1 Adding a device
III. Appendices
Bibliography
List of Tables
2-1. Mutex List
2-2. Shared Exclusive Lock List
List of Figures
18-1. driver_t implementation
18-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()
13-1. Example of a Sample Echo Pseudo-Device Driver for FreeBSD 4.X
13-2. Example of a Sample Echo Pseudo-Device Driver for FreeBSD 5.X
18-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 <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.