Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Cover
Title
Copyright
Dedication
Contents at a Glance
Contents
About the Authors
About the Technical Reviewers
Acknowledgments
Introduction
Chapter 1: Operating System Fundamentals
The Role of the Operating System
Process Management
Process Address Spaces
Operating System Services
Virtual Memory
Scheduling
Hardware and Drivers
Summary
Chapter 2: Mac OS X and iOS
Programming APIs
Supported Platforms
164-bit Operating System
iOS
The XNU Kernel
Kernel Extensions (KEXTs)
Mach
The BSD Layer
The I/O Kit
Summary
Chapter 3: Xcode and the Kernel Development Environment
Summary
Chapter 4: The I/O Kit Framework
The I/O Kit Model
Object Relationship
The Info.plist File
The Driver Class
IORegistryExplorer
The Kernel Library: libkern
OSObject
Container Classes
Summary
Chapter 5: Interacting with Drivers from Applications
The I/O Kit Framework
Finding a Driver
Observing Device Removal
Modifying Driver Properties
State-Based Interaction
Notifications from the Driver
Summary
Chapter 6: Memory Management
Types of Memory
CPU Physical Address
Bus Physical Addresses
User and Kernel Virtual Addresses
Memory Ordering: Big vs. Little Endian
32-bit vs. 64-bit Memory Addressing
Memory Allocation
Low-Level Allocation Mechanisms
The Mach Zone Allocator
The kalloc Family
Memory Allocation in BSD
I/O Kit Memory Allocation
Allocating Memory with the C++ New Operator
Memory Descriptors
The IOBufferMemoryDescriptor
Other Memory Descriptors
Mapping Memory
Mapping Memory from a User Space Task into Kernel Space
The IOMemoryMap Class
Mapping Memory from the Kernel to a User Space Task
Mapping Memory to a Specific User Space Task
Physical Address Mapping
Summary
Chapter 7: Synchronization and Threading
Synchronization Primitives
Atomic Operations
Locking
Spin locks
Mutexes
Condition Variables
Read/Write Mutexes
Synchronizing Asynchronous Events: Work Loops
IOCommandGate
Timers
Releasing Work Loops
Kernel Threads
Summary
Chapter 8: Universal Serial Bus
USB Architecture
USB Transfer Speeds
Host Controllers
The USB Protocol
Endpoints
USB Descriptors
USB Device Classes
I/O Kit USB Support
USB Device and Driver Handling
Loading USB Drivers
USB Prober
Driver Example: USB Mass Storage Device Driver
Driver Startup
Handling Device Removals
Enumerating Interfaces
Enumerating Endpoints
Performing Device Requests
Performing I/O to Bulk and Interrupt Endpoints
Summary
Chapter 9: PCI Express and Thunderbolt
Configuration Space Registers
PCI in I/O Kit
Matching and Loading Drivers
Driver Example: A Simple PCI Driver
Accessing Configuration Space Registers
PCI I/O Memory Regions
Handling Device Removal
Interrupts
Direct Memory Access
Summary
Chapter 10: Power Management
The I/O Registry Power Plane
Power Management in the I/O Kit
Responding to Power State Changes
Requesting Power State Changes
Handling Device Idle
Observing Device Power State Changes
Putting It All Together
Summary
Chapter 11: Serial Port Drivers
Mac OS X Serial Port Architecture Overview
Serial Port Drivers
Implementing the IOSerialDriverSync Class
Serial Port State
Serial Port Events
Serial Data Transfer
Accessing a Serial Port from User Space
Summary
Chapter 12: Audio Drivers
An Introduction to Digital Audio and Audio Devices
Core Audio
I/O Kit Audio Support
Implementing an Audio Driver
Driver and Hardware Initialization
Registering Audio Controls
Implementing an Audio Engine
I/O Engine Initialization
Additional Audio Engine Functionality
Summary
Chapter 13: Networking
Network Memory Buffers
Working with Memory Buffers
Network Kernel Extensions
Kernel Control KPI
Socket Filters
Internet Protocol Filters
Interface Filters
Debugging and Testing Network Extensions
Networking in the I/O Kit
Building a Simple Ethernet Controller Driver
The Design of MyEthernetDriver
Driver Initialization and Startup
Medium and Status Selection
Configuring the Device Hardware Address
Enabling and Disabling the Device
Transmitting Network Packets
Receiving Packets
Taking MyEthernetDriver for a Test-Drive
Summary
Chapter 14: Storage Systems
Transport Layer Drivers
The IOBlockStorageDevice Interface
Building a RAM Disk Device
Partition Schemes
Implementing a Sample Partition Scheme
The Media Content Hint Property
Media Filter Drivers
A Sample Filter Scheme for Encryption
Creating a Custom GUID Partition Table
Summary
Chapter 15: User-Space USB Drivers
Behind the Scenes
The IOUSBLib Framework
Handling Asynchronous Operations
The IOUSBDeviceInterface Class
The IOUSBInterfaceInterface Class
Property Methods
Endpoint Data Transfer Methods
Low-Latency Isochronous Transfers
Summary
Chapter 16: Debugging
Common Types of Problems
Kernel Panics
Debugging Mechanisms
Recovering from Crashes During Boot
Tracing with IOLog()
Printing Stack Traces
Remote Tracing over FireWire
Remote Kernel Core Dumps
KDB
Remote Debugging with GDB over Ethernet or FireWire
Live Debugging of a Running Kernel
Debugging Using a Virtual Machine
Debugging in the Kernel Using GDB
Diagnosing Hung Processes with Activity Monitor
Finding Memory and Resource Leaks
Summary
Chapter 17: Advanced Kernel Programming
SSE and Floating Point in the Kernel
Multi-Function Drivers
Writing I/O Kit Families
Kernel Control KPI
Kernel Control Registration
Client Connections
Getting and Setting Options
Accessing Kernel Controls from User Space
Working with Processes in the Kernel
Loading Resources
Beyond KEXT Resources
Notifications from Kernel Drivers
Summary
Chapter 18: Deployment
Installing and Loading Kernel Extensions
Loading Preferences and Settings
Versioning Kernel Extensions
Testing and Quality Assurance
Packaging KEXTs and Software
Building a Package for the Hello World Kernel Extension
Adding Contents to the Package
Configuring the Package
Building the Package
Uninstalling Packages
Summary
Index
← Prev
Back
Next →
← Prev
Back
Next →