FreeBSD Architecture Handbook

The FreeBSD Documentation Project

Revision: 53377
Legal Notice
Copyright
Last modified on 2019-09-05 23:22:58 by bcr.
Abstract

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. The BIOS
1.4. The Master Boot Record (boot0)
1.5. boot1 Stage
1.6. The BTX Server
1.7. boot2 Stage
1.8. loader Stage
1.9. 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. Character Devices
9.4. Block Devices (Are Gone)
9.5. 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 Figures
1.1. sys/boot/i386/boot0/Makefile
1.2. sys/boot/i386/boot0/boot0.S
1.3. sys/boot/i386/boot0/boot0.S
1.4. sys/boot/i386/boot0/boot0.S
1.5. sys/boot/i386/boot0/boot0.S
1.6. sys/boot/i386/boot0/boot0.S
1.7. sys/boot/i386/boot0/boot0.S
1.8. sys/boot/i386/boot0/boot0.S
1.9. sys/boot/i386/boot0/boot0.S
1.10. sys/boot/i386/boot0/boot0.S
1.11. sys/boot/i386/boot2/boot1.S
1.12. sys/boot/i386/boot2/boot1.S
1.13. sys/boot/i386/boot2/boot1.S
1.14. sys/boot/i386/boot2/Makefile
1.15. sys/boot/i386/boot2/boot1.S
1.16. sys/boot/i386/boot2/boot1.S
1.17. sys/boot/i386/boot2/boot1.S
1.18. sys/boot/i386/boot2/boot1.S
1.19. sys/boot/i386/boot2/boot1.S
1.20. sys/boot/i386/boot2/Makefile
1.21. sys/boot/i386/boot2/Makefile
1.22. sys/boot/i386/boot2/Makefile
1.23. sys/boot/i386/boot2/Makefile
1.24. sys/boot/i386/boot2/boot2.h
1.25. sys/boot/i386/btx/btx/btx.S
1.26. sys/boot/i386/btx/btx/btx.S
1.27. sys/boot/i386/btx/btx/btx.S
1.28. sys/boot/i386/btx/btx/btx.S
1.29. sys/boot/i386/btx/btx/btx.S
1.30. sys/boot/i386/btx/btx/btx.S
1.31. sys/boot/i386/btx/btx/btx.S
1.32. sys/boot/i386/btx/btx/btx.S
14.1. driver_t Implementation
14.2. Device States device_state_t
List of Tables
2.1. Mutex List
2.2. Shared Exclusive Lock List
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 10.X - 12.X
14.1. Newbus Methods

All FreeBSD documents are available for download at https://download.freebsd.org/ftp/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.