_MALLOC() function, 107
_MALLOC_ZONE() function, 107
<libkern/OSKextLib.h> header file, 424
AbortPipe, 375
acknowledgePowerChange() method, 219
Active List, 104
activityTickle() method, 217
activityTickle(type, powerState) method, 216
addAudioStream() method, 267
addAvailableFormat(), 268
addEventSource(), 195
addressOfMappedBuffer argument, 119
Advanced Graphics Port (AGP), 177
Advanced kernel programming, 411
drivers notifications
arbitrary file system, 425
custom user client method, 430–31
daemon process, 426
IOConnectSetNotificationPort() function, 430
IOUSBFamily, 425
IOUserClient class, 426
IOUserClient subclass, 430
Kernel-User Notification Center, 425
mach_msg_header_t structure, 427
MyNotificationMessage structure, 428
registerNotificationPort() method, 430
user space daemon process, 426
kernel control KPI
C language, 414
getsockopt() system call function, 414
getting and setting options, 418–19
HelloKernControl header file, 417
kern_ctl_reg structure, 414–15
KEXT, 414
send() and recv() system call functions, 414
setsockopt() system call function, 414
vs. ioctl() system call, 414
KEXT resources, 425
multi-function drivers, 412–13
SSE and floating point, 411–12
app_descriptor structure, 286
Apple AHCI storage driver stack, 321
Apple USB serial driver, 226
AppleACPIPCI, 177
AppleRTL8139Ethernet, 305
AppleUSBCDC driver, 226
AppleUSBCDCEthernet, 305
atAddress argument, 116
attachMediaObjectToDeviceTree(), 350
Audio drivers, 249
additional audio engine functionality, 275–76
audio engine implementation
header file, MyAudioEngine class, 263–64
IOAudioEngine subclass, 262
buffering, 249
digital audio and audio devices
analog audio wave, 250
sample buffer, 251
sample rate, 250
sound waves, analog, 249
hardware initialization
activateAudioEngine() method, 259, 260
addTimerEvent() function, 257
createAudioEngine() method, 259
event argument, 257
header file, MyAudioDevice class, 257–59
I/O Kit lifecycle methods, 259
initHardware() method, 259
IOAudioDevice subclass, 257
IOAudioEngine, 256
IOWorkLoop and IOCommandGate, 256
target argument, 257
I/O engine initialization
audio streams creation and initialization, 267–68
handling format changes, 268–69
handling interrupts and timestamps, 273–75
IOAudioStream, 267
IODMACommand class, 267
IOMalloc(), 267
IOTimerEventSource, 266
sample rate, 266
samples clipping and conversion, 269–71
setDescription() method, 266
setInputSampleLatency function(), 266
setOutputSampleLatency() function, 266
starting and stopping audio engine, 272–73
IOAudioControl, 256
IOAudioDevice, 255
IOAudioEngine, 256
IOAudioFamily, 255
IOAudioStream, 256
MyAudioDevice architecture, 256
MyAudioDevice source code, 254
MyAudioEngine class, 256
programming drivers, 249
registering audio controls
addDefaultAudioControl(), 262
attributes, 260
callback function, 261
channel ID, 261
createMuteControl() factory method, 262
createVolumeControl() method, 260
dB value, 261
IOAudioLevelControl, 260
IOAudioStream, 262
System Preferences, 255
System Prefernces, 255
Audio HAL, 269
Audio Toolbox, 252
Audio Units, 252
audioStream parameter, 271
bAlternateSetting, 374
Base Address 0-5, 176
Base Address Register (BAR), 176
bDescriptorType, 374
bDeviceClass, 365
bDeviceProtocol, 365
bDeviceSubClass, 365
Berkeley Packet Filter (BPF), 276, 301
bInterfaceClass, 374
bInterfaceNumber, 374
bInterfaceProtocol, 374
bInterfaceSubClass, 374
bInterval, 374
Bit depth, 250
BSD data-link layer (BDIL), 304
BSD sockets, 105
bzero functions, 107
capabilities argument, 218
capabilityFlags, 209
capabilityFlags bitmask, 218
CFMachPortCreate() function, 426
changePowerStateTo() method, 215, 216, 217
changePowerStateTo(powerStateOrdinal) method, 215
changePowerStateToPriv() method, 215, 216, 217
changePowerStateToPriv(powerStateOrdinal) method, 215
Class Code, 176
ClearPipeStall, 375
ClearPipeStallBothEnds, 375
clientMemoryForType method, 118
clipOutputSamples() method, 270
Cocoa framework, 6
Cocoa Touch API, 20
com.apple.iokit.IOAudioFamily, 413
com.apple.iokit.IOStorageFamily kernel module, 335
com.apple.kpi.private, 422
com_osxkernel_MyEthernetHwAbstraction class, 311
commandSleep() method, 141
Condition variables
definition, 133
m_readEvent parameter, 134
read() method, 133
sample code, 133
SIGHUP or SIGKILL signals, 135
user space application, 133
Configuration space registers
device ID and vendor ID, 183
extended configuration space, 185
IOPCIDevice.h file, 184
offset parameter, 183
offsets constants, 184
PCI controller firmware, 184
PowerPC-based systems, 185
setConfigBits() method, 184
setMemoryEnable() method, 185
Connect and disconnect callbacks, 417–18
connect() system, 289
constants callback function, 101
constants IOAsyncCallback0 function, 101
constants IOConnectCallAsyncScalarMethod() function, 101
contentHint parameter, 349, 351
Control get function, 418
ControlRequest, 377
ControlRequestAsync, 377
ControlRequestAsyncTO, 377
ControlRequestTO, 377
convertInputSamples() method, 271
cookie argument, 300
Copy-on-write (COW) optimization, 112
Core Audio Kit, 252
Core MIDI / MIDI Server, 253
CreateDeviceAsyncEventSource method, 364
CreateInterfaceIterator, 369
createMappingInTask() method, 115, 116
createNewAudioStream() method, 267
Darwin distribution, 17
Darwin source code repository, 226
Data-link interface layer (DLIL), 303
Debugging
boot-args argument, 387
crashes, 387
deadlocks, 382
FireWire, remote tracing, 390, 392
GNU debugger
backtrace command, 404
cmp instruction, 407
disassemble command, 406
FireWire core dump mechanism, 403
FireWireKDP mechanism, 397, 398
fVariable1 and fVariable2, 408
kernel panic logs, 408, 410, 411
Mac OS X, 394
MyDebugDriver Header File, 403, 404
remote debugging setup, 400
running kernel, 399
symlink, 405
UNIX and Linux systems, 395
verbose flag, 395
x86-64 calling conventions, 411, 412
Xcode, 394
illegal instruction/operand, 382
invalid memory access, 382
KDB, 394
kernel panics, 383
kernel problems, 384
lock contention, 382
memory and resource leaks, 382, 413, 414
primary interrupt context, 383
race conditions, 382
remote kernel core dumps, 392, 393, 394
stack traces, 389
virtual machine, 399
volunteered panics, 383
deRegisterInterestedDriver(IOService* driver) method, 218
detach() method, 191
Device Address Resolution Table (DART), 100
Device ID, 175
DeviceRequest, 367
DeviceRequest method, 367
DeviceRequestAsync, 367
DeviceRequestTO, 367
didChange notification, 219
didTerminate() method, 191
Direct memory access (DMA), 251
Direct Memory Access (DMA)
64-bit platforms, 201
data structure, 202
definition, 199
inbound DMA, 199
IODMACommand class
32-bit addressing, 206
alignment parameter, 208
code output, 209
esoteric hardware device, 206
inTaskWithPhysicalMask() factory method, 207
IOBufferMemoryDescriptor, 207
IOMemoryCursor class, 206
IOMMU, 206
mappingOptions parameter, 207
maxSegmentSize parameter, 207
maxTransferSize, 208
memory caching, 200
NULL pointer, 202
outbound DMA, 199
outbound DMA transfer, 199–200
page-out operation, 201
physical-bus address translation, 202–3
scatter/gather list, 201, 204–6
setBusMasterEnable(), 199
user space memory, 201
zero-copy, 199
DKIOCEJECT, 326
DKIOCGETFORMATCAPACITIES, 325
DKIOCISWRITABLE, 325
DKIOCREQUESTIDLE, 326
DKIOCSYNCHRONIZECACHE, 327
DKIOCUNMAP, 326
do_block field, 286
doDiscard method, 326
doFormatMedia, 337
domain structure, 276
Driver class, Info.plist file
"IOKitTest.cpp" tutorial, 59–60
"IOKitTest.h" tutorial, 58
com.osxkernel, 58
IOKitPersonalities dictionary, 60
IOKitTest dictionary, 60
IOKitTest.cpp, 58
IOMatchCategory key, 61
IOResourceMatch, 61
IOResources nub, 61
IOResources provider class, 61
IOService class, 58
kernel.log file, 62
object initialization, 63
OSBundleLibraries dictionary, 60–61
OSDeclareDefaultStructors macro, 58
project's property list, 61
super macro, 60
Drivers, 69
chain of control requests, 13
device removal
callback function, 77
callback function installation, 78–79
DeviceAdded() function, 77
driver object, 77
IONotificationPortCreate() function, 77
IOServiceAddInterestNotification() function, 77
driver properties
connection-based approach, 79
Core Foundation, 82
Core Foundation dictionary, 80
custom string value, 83
CustomMessage, 81
debugging information, 81
IOUSBDevice class, 80
key/value pairs, 79
manufacturer string, 81
setProperties() Method, 82
table, 79
i/o control, 14
IO registry, 71
kernel/user space boundary, 69
lower-level USB driver, 13
matching dictionary
callback function, 73
CFRunLoopRun() function, 75
code structure, 71
Command Line Tool, 71
Core Foundation, 71
DeviceAdded, 75
DriverIterator, 71
event loop, 74
IOIteratorNext() function, 75
IOMasterPort() function, 73
IONotificationPortCreate() function, 75
IOServiceAddMatchingNotification() function, 75
IOServiceGetMatchingServices() function, 75
IOServiceMatching() function, 76
kernel driver's property list, 71
kIOMasterPortDefault macro, 73
NSApplicationMain() function, 75
run loop, 74
USB devices, 71
USB devices arrival, 74–75, 76
notifications
asynchronous operations, 99
asyncReference buffer, 102
blocking operations, 99
DelayForMs() method, 99
DelayForTime() function, 99
InstallTimer() function, 99, 100–101, 102–3
IOConnectCallAsyncXXX() function, 100
IOConnectCallXXX() functions, 100
IOExternalMethodArguments structure, 101–2
IONotificationPortCreate() function, 99
kIOAsyncCalloutFuncIndex and kIOAsyncCalloutRefconIndex constants, 101
sendAsyncResult64(), 103
timerCallback and context arguments, 101
operating system kernel, 12
printer, 14
state-based interaction
asynchronous operations, 83
connection-based approach, 83
driverConnection parameter, 84
IOServiceClose() function, 85
IOServiceOpen() function, 84, 85
user client. See User client methods
user space application, 69, 70
emmintrin.h header file, 412
Enhanced host controller interface (ECHI), 145
EPERM, 291
ExpressCard, 175
Extensible host controller interface (xHCI), 145
fAudioInputInteruptPending, 199
fAudioOutputInterruptPending, 199
fCurrentLoopCount, 273
File descriptors, 105
Filter scheme driver. See Media filter drivers
filterInterruptEventSource() method, 195
Firmware, 12
firstSampleFrame, 271
flush(), 317
flushInputQueue(), 319
frActCount value, 383
frame_ptr argument, 300
frameStart parameter, 380, 381
Free List, 104
frStatus value, 383
frTimeStamp field, 384
g_string_buf variable, 419
GCC compiler, 41
GetAlternateSetting, 374
getBufferMemoryDescriptor() method, 119
GetBusFrameNumber method, 380, 381
GetBusFrameNumber() method, 366
GetBusFrameNumberWithTime, 366, 372
GetBusMicroFrameNumber, 366, 372
GetConfiguration, 369
GetConfigurationDescriptionPtr, 369
GetConfigurationValue, 374
getCurrentSampleFrame() method, 274
GetDevice, 372
GetDeviceAddress, 366
GetDeviceAsyncEventSource method, 364
GetDeviceClass, 365
getDeviceMemoryWithIndex() method, 188, 189
GetDeviceProtocol, 365
GetDeviceReleaseNumber, 365, 372
GetDeviceSubClass, 365
getDirection() method, 327
GetEndpointProperties, 374, 375
GetFrameListTime, 373
getHardwareAddress() function, 314
getHardwareAddress() method, 314
GetInterfaceClass, 374
GetInterfaceNumber, 374
GetInterfaceProtocol, 374
GetInterfaceSubClass, 374
GetNumberOfConfigurations, 366
getPhysicalAddress() function, 203
getPhysicalAddress() method, 120
getPhysicalSegment() method, 120
GetPipeProperties, 375
GetPipeStatus, 375
getVirtualAddress() method, 188, 189
Hardware abstraction layer (HAL), 252
HELLO_CONTROL_GET_STRING, 419
hello_ctl_connect() function, 418
HelloWorld distribution, 437
Hot-pluggable devices, 434
I/O Kit framework, 51
“nub”, 52
boilerplate code, 52
C++ language, 51
driver's provider, 52
Info.plist file
active matching, 55
com_mycompany_driver_MyExternalDiskDriver class, 57
com_mycompany_driver_MyExternalDiskDriverUSB class, 57
driver class. See Driver class, Info.plist file
driver personalities, 57
IOPCIDevice, 55
IOProviderClass, 54
kernel extension, 54
match category, 55
matching dictionary, 54, 55, 57
MyUSBDevice, 56
property list, 54
USB device connection, 54
user client, 56
IOAudioDevice class, 52
IOSerialStreamSync class, 52
IOService class, 53
IOUSBDevice class, 52
Kernel framework, 51
libkern. See libkern
object-oriented programming abstraction, 51
role of driver, 52
user space application, 51
I/O memory management unit (IOMMU), 100, 202–3
I/O memory regions
control and status registers, 186
enumeration
frame buffer, 188
graphics card, 188
kernel.log, 188
frame buffer, 186
I/O ports, 186
I/O space access, 189
IDE controllers, 186
mapping and accessing, 188
size, 186
standardized interfaces, 186
ifconfig tool, 312
iff_input filter function, 300
iff_protocol field, 300
ifnet structure, 276
ifnet_hdrlen(ifnet_t) function, 300
ifnet_t argument, 300
iInterface field, 374
Inactive List, 104
Info.plist file, 413
inputPacket(), 319
inputPowerRequirement, 209
inputStructSize argument, 90
Installation Destination, 437
inTask argument, 111
inTaskWithOptions() method, 111
inTaskWithPhysicalMask(), 112
inTaskWithPhysicalMask() method, 111
intCount parameter, 199
Intel 64 Architecture, 103
Interface filters
AF_INET, 298
callback arguments, 300
iff_filter structure, 298
ifnet_find_by_name() KPI function, 300
ifnet_output_raw() function, 301
ioctl() messages, 297
output filter function, 300–301
physical interface, 297
Internet Protocol (IP) filters
EJUSTRETURN, 296
encrypted IP packet, 295
Ethernet, 297
ipf_addv4() function, 295
ipf_input and ipf_output callbacks, 295
ipf_output filter function, 296
IPv4 and IPv6, 292
MyIPFilter implementation, 292–95
NAT, 297
ping command line utility, 296
structure, 292
TCP and UDP checksums, 296
UDP and TCP checksums, 296
Interrupt event source filtering, 195–96
Interrupt handler code, 273–74
Interrupt Service Routine (ISR), 192
interruptFilter() function, 197
interruptOccurred() method, 195
intoTask argument, 116
ioalloccount tool, 433
IOAudioControl, 254
IOAudioControlUserClient, 254
IOAudioDevice, 253
IOAudioDevice superclass, 53
IOAudioEngineUserClient, 254
IOAudioLevelControl, 254
IOAudioPort, 254
IOAudioSelectorControl, 254
IOAudioStream, 254
IOAudioStreamFormat structure, 268
IOAudioToggleControl, 254
IOBasicOutptuQueue class, 304
IOBlockStorageDevice class, 320, 321, 339
IOBlockStorageDriver class, 339
IOBufferMemoryDescriptor, 109, 203, 205, 267, 318
IOCFPlugInInterface class, 362
IOConnectCall*() functions, 432
IOConnectSetNotificationPort() function, 427
IODeviceMemory, 188
IODeviceTree, 64
IOEthernetController class, 303, 304
IOEthernetInterface class, 303, 311
IOEventSource base class, 139
IOExternalMethodArguments structure, 92–93, 97, 101–2
IOExternalMethodDispatch structure, 94
IOFilterInterruptEventSource, 194, 196, 198, 312
IOFilterInterruptEventSource instance, 197
IOFireWireIP, 305
IOGatedOutputQueue class, 304
IOGraphicsFamily, 413
IOInterruptEventSource, 194, 196, 198, 310, 312
IOInterruptEventSource class, 139
IOInterruptEventSource::interruptEventSource(), 196
IOIteratorNext() function, 72
IOKernelDebugger class, 303
IOKitPersonalities dictionary, 60
IOLockSleep() function, 141
IOLockSleepDeadline() function, 141
IOLockWakeup() function, 141
IOLog(), 198
IOMalloc() family, 112
IOMalloc() function, 108
IOMallocAligned(), 112
IOMallocAligned() function, 108, 109
IOMallocContiguous() function, 109
IOMallocPageable() function, 109
IOMatchCategory, 342
IOMBufBigMemoryCursor subclass, 304
IOMbufDBMAMemoryCursor subclass, 304
IOMbufLittleMemoryCursor subclass, 304
IOMbufMemoryCursor, 318
IOMbufMemoryCursor class, 304
IOMbufMemoryCursor subclass, 319
IOMbufNaturalMemoryCursor subclass, 304
IOMedia class, 339
IOMediaBSDClient class, 339, 340
IOMemoryDescriptor, 115, 188, 203, 359
IOMemoryDescriptor class, 113, 203
IOMemoryDescriptor object, 327
IOMemoryDescriptor::getPhysicalSegment(), 204, 208
IOMemoryDescriptor::map() method, 115
IOMemoryDescriptor::prepare(), 100
IOMemoryMap class, 113
IOMemoryMap member function, 117
IOMemoryMap::getVirtualAddress() method, 116
IOMemoryMap::unmap() function, 117
IONetworkController class, 304
IONetworkController::selectMedium() method, 313
IONetworkData class, 304
IONetworkInterface class, 304, 311, 319
IONetworkMedium class, 312
IONetworkUserClient class, 304
IOObjectCopyClass() function, 72
IOObjectRelease() function, 72
IOOutputQueue class, 304
IOPacketQueue, 321
IOPacketQueue class, 304
IOPCI2PCIBridge class, 177
IOPCIDevice method, 188
IOPCIDevice provider class, 53, 54
IOPhysicalAddress, 100
IOPMAckImplied value, 218
IOPower, 64
IOPropertyMatch, 342
IOPropertyMatch item, 351
IOProviderClass key, 71
IORecursiveLock, 141
IORegistryEntry class, 82
IORegistryEntryCreateCFProperties() function, 79
IORegistryEntryCreateCFProperty() function, 80
IOSerialDriverSync class, 69
IOSerialStreamSync class, 53
IOService lifecycle methods, 272
IOService::registerInterrupt(), 194
IOServiceGetMatchingServices() function, 72, 73
IOServiceMatching() function, 71
IOServiceOpen() function, 426
IOSimpleLock. See Spin locks:
IOStorage stack, 342
IOStorageCompletion, 359
IOTimerEventSource, 312
IOTimerEventSource class, 139, 141–42
IOTimerEventSources, 310
IOUSB, 65
IOUSBConfigurationDescriptorPtr structure, 369
IOUSBController subclass, 414
IOUSBDevice, 72
IOUSBDevice class, 320
IOUSBDevice provider class, 53, 54
IOUSBDeviceInterface class
bmRequestType field, 367
CFStringRef, 368
control requests, 367
device request function, 368–69
IOUSBDeviceInterface300 class, 365–66
kIOReturnExclusiveAccess error code, 365
kIOReturnSuccess error code, 365
kUSBIn, 367
kUSBRqGetDescriptor request, 367
loop source, 364
QueryInterface method, 362
read dynamic properties, 366
USBDeviceClose(), 365
USBDeviceOpen(), 365
USBGetManufacturerStringIndex, 367
wValue field, 367
IOUSBFindInterfaceRequest structure, 369
IOUSBHubDevice, 72
IOUSBInterface class, 320
IOUSBInterfaceInterface class, 372–73
endpoint data transfer methods
Async, 376
bulk endpoint, 377
callback function, 376
control request, 377
endpoints determination, 374–75
isochronous data transfers. See Isochronous data transfers
endpoint types, 371
getting and setting properties, 373–74
io_service_t object, 371
IOUSBInterface class, 361, 371
IOUSBInterfaceInterface300 class, 372
kIOUSBInterfaceClassName, 371
matching dictionary, 371
QueryInterface method, 362
USBInterfaceClose(), 372
USBInterfaceOpen(), 371
IOUSBIsocFrame array, 380, 381
IOUSBIsocFrame structure, 384
IOUSBLowLatencyIsocFrame array, 384
IOUSBLowLatencyIsocFrame structure, 384
IOUserClient class, 53, 85, 118
IOWorkLoop, 195
ipf_detach function, 292
ipf_remove() function, 292
iPhone OS, 16
Isochronous data transfers
bandwidth, USB bus, 380
GetBandwidthAvailable, 381
IOUSBIsocFrame structure, 380
low-latency isochronous transfers, 383–84
read operation function, 381–83
ReadIsochPipeAsync, 380
SetPipePolicy, 381
WriteIsochPipeAsync, 381
isWhole, 349
kAudioBufferSampleFrames, 266
kAudioSampleRate, 266
Kernel address space management, 29
Kernel Control KPI, 281
Kernel development
kernel extension. See Kernel extension
Kernel extension
"Hello World" application
"System Plug-in" category, 41
<libkern/libkern.h> header file, 42, 43
com.apple.kpi.libkern, 44
HelloWorld-Info.plist file, 43
I/O Kit driver, 42
Info.plist file, 46
Kernel.framework, 44
KEXT bundle, 46
Mac OS X kernel, 44
printf() function, 43
reverse DNS convention, 42
reverse DNS prefix, 44
loading and unloading
compiled binary, 47
HelloWorld.kext, 47
HelloWorld_stop() function, 50
KEXT bundle, 48
kextload command, 48
kextunload command, 48
kextutil command, 48
path location, 47
security, 47
Kernel extension:, 43
Kernel extensions (KEXT), 429
loading and installation
AuthorizationExecuteWithPrivileges(), 431
I/O Registry, 429
Info.plist files, 429
IOResources, 429
iOS App Store, 431
kextd, 429
LaunchDaemon, 430
Mac App Store, 431
plist file, 431
preferences and settings, 431–32
root user, 429
VPN application, 431
packaging:. See PackageMaker, KEXT
software distribution, 429
testing and quality assurance, 433–34
Kernel library. See libkern
Kernel private, 422
KernelUserClientAPIVersion, 433
kextd daemon, 413
kextload, 433
kextunload, 433
kIOAudioStreamAlignmentHighByte, 268
kIOAudioStreamAlignmentLowByte, 268
kIODirectionIn, 203
kIODirectionIn value, 327
kIODirectionInOut, 203
kIODirectionOut, 203
kIODirectionOut value, 327
kIOMapCopybackCache, 116
kIOMapDefaultCache, 116
kIOMapInhibitCache, 116
kIOMapReadOnly, 116
kIOMapReference, 116
kIOMapUnique, 116
kIOMapWriteThruCache, 116
kIOMemoryKernelUserShared, 112
kIOMemoryMapperNone, 120
kIOMemoryPageable, 111
kIOMemoryPhysicallyContiguous, 111, 318
kIOMemoryPhysicallyContiguous flag, 205
kIOMemoryPurgeable, 112
kIONetworkLinkActive flag, 313
kIONetworkLinkValid flag, 313
kIOPCIConfigDeviceID, 184
kIOPCIConfigVendorID, 184
kIOPCIExpressCapability, 186
kIOPMDeviceUsable, 209
kIOPMInitialDeviceState, 209
kIOPMLowPower, 209
kIOPMPowerOn, 209
kIOPMPowerStateVersion1, 208
kIOPMPreventIdleSleep, 209
kIOPMSubclassPolicy parameter, 217
kIOPMSuperclassPolicy1 parameter, 217
kIOPropertyExternalKey, 189
kIOPropertyPhysicalInterconnectLocationKey, 189
kIOReturnSuccess, 144, 314, 367, 375
kIOReturnSuccess value, 364
kIOReturnUnsupported, 313, 314, 325
kIOServicesIsTerminated message, 191
kIOUSBPipeStalled, 375
kIOUSBUnknownPipeErr, 375
kmem_alloc() function, 107
kmem_alloc*() family, 105
kmem_alloc_pageable() function, 105
kUSBFullSpeedMicrosecondsInFrame, 373
kUSBHighSpeedMicrosecondsInFrame, 373
Legacy mode, 103
len argument, 419
libkern, 51
OSObject class
command ioclasscount, 68
free() method, 67
functionality, 65
init() method, 67
ioclasscount command, 68
kernel extension, 68
NSObject class, 65
OSDeclareDefaultStructors macros, 67
retain() method, 67
start() method, 68
static helper method, 67
libkern kernel library, 105
libkern library, 109
libpcap library, 301
LLVM compiler, 41
Long mode, 103
LowLatencyCreateBuffer, 384
LowLatencyCreateBuffer method, 384
LowLatencyDestroyBuffer, 384
LowLatencyReadIsochPipeAsync, 384
LowLatencyWriteIsochPipeAsync, 384
m_devicePowerState, 220
m_outstandingIO variable, 220
Mac OS 9, 5
Mac OS X and iOS
64-bit operating system, 20
Darwin distribution, 17
iLife suite, 16
Intel x86-platform, 20
NeXTSTEP OS, 16
POSIX, 17
Unix 03 Certification, 17
XNU kernel. See XNU kernel
Mac OS X and iOS audio architecture, 252
mach_msg_send_from_kernel() function, 427
mach_vm_address_t, 101
malloc() function, 105
map() method, 188
mapDeviceMemoryWithRegister() method, 188, 189
Matching and loading drivers
32-bit hexadecimal string, 179
Info.plist, 179
Info.plist file, 180
IONameMatch, 180
IOPCIClassMatch, 179
IOPCISecondaryMatch, 179
IOProvider* service method, 178
IOProviderClass, 179
keys, 178
name property, 180
maxNumSegments, 318
maxSegmentSize, 318
mbuf_pkthdr_rcvif() function, 290
mbuf_t buffer, 300
Media Access Control (MAC) address, 313–14
Media filter drivers
block-level disk encryption, 352
Content Hint property, 353
encryption
Encrypted_HFS_GUID, 353
HFS file system, 353
instantiateMediaObject() method, 356
IOPropertyMatch, 353
matching dictionary, property list, 353–54
probe() method, 354
SampleEncryptionFilter class, 356
start() method implementation, 354–56
uuidgen command line tool, 353
write() methods, 356
XOR encryption scheme, 353
GUID partition table
.dmg file, 363
"gpt add" command, 362
"hdiutil attach" command, 362
Apple_HFS, 363
Content Hint property, 361, 363
disk2, 363
disk2s1, 363
EncryptedImage.dmg file, 362
gpt command, 362
hdiutil command line utility, 362
HFS file system, 361, 363, 364
IOBlockStorageDevice superclass, 362
IOGUIDPartitionScheme driver, 363
IOMediaBSDClient object, 362
MyVolumeName, 363
setLocation() method, 363
IOFilterScheme class, 352
Media independent interface (MII) bus, 310
memcpy() function, 113
Memory management, 99
IOMemoryDescriptor
complete() method, 111
IOBufferMemoryDescriptor, 111–12
IODeviceMemory, 112
IOMultiMemoryDescriptor, 112
release() method, 111
virtual and physical memory, 110
withAddressRange() method, 110
withPhysicalAddress() method, 111
kernel memory allocation
BSD, 107
C++ new operator, 109
low-level allocation mechanisms, 104–5
Mach zone allocator, 105
malloc()/free() interface, 104
VM page cache and file system cache, 104
vm_page structure, 104
xnu kernel, 104
mapping memory
COW optimization, 112
definition, 112
IOBufferMemoryDescriptor, 119
IOMalloc() and IOMallocAligned() functions, 119
IOMemoryDescriptor::createMappingInTask(), 119, 120
Memory management, mapping memory (cont.)
IOMemoryMap::getVirtualAddress(), 120
kernel to user space task, 118–19
kIOMemoryKernelUserShared, 119
physical address mapping, 120
user space task into kernel space, 101–2
types
32-bit vs. 64-bit memory addressing, 103–4
big vs. little endian, 102
bus physical addresses, 100
CPU physical sddress, 100
user and kernel virtual addresses, 101–2
memory management unit (MMU), 202
Memory Management Unit (MMU), 100, 101
Memory mapped I/O (MMIO), 190
Memory Mapped I/O (MMIO), 186
Message signaled interrupts (MSI), 196–97
Message Signaled Interrupts (MSI), 195
message() method, 191
Message-signaled interrupts (MSI). See
Mutexes
advantages, 131
deadlock, 131
ListEnqueue() function, 131
POSIX mutex lock functions, 131
recursive mutex, 131
MyEthernetDriver, 301
BSD layer, 306
configureInterface() method, 311–12
DHCP server, 323
en5, 323
ifconfig command line tool, 323
interaction, 305
IOEthernetController, 306
IOEthernetInterface, 306
IORegisterExplorer, 321
IORegisteryExplorer, 322
IOResources, 321
IOResources nub, 305
IOUSBFamily source distribution, 305
kextload, 321
MAC address, 314
Mac's Thunderbolt port, 306
MyEthernetHwAbstraction class, 307
MyEthernetHwAbstraction.cpp, 321
network stack, 306
outputPacket() function, 316
packets and data transfer, 324
physical network switch, 306
ping utility, 324
System Preferences, network pane, 322, 323
test setup, 306
virtual Ethernet bridge/switch, 307
MyFirstPCIDriver class
implementation, 182
Info.plist, 182
IOProviderClass key, 182
IORegistryExplorer, 183
kextload utility, 183
modifications, 181
probe() method, 182
registerService() function, 182
start() method, 182
myReadDataFromDevice() method, 224
myReadDataFromDevice() operation, 219
netcat, 302
Network Address Translation (NAT), 297
Network Kernel Extension (NKE), 414
Network kernel extensions (NKE)
architecture, 276
interface filter. See Interface filter
interface KPI, 281
IP filter. See Internet Protocol filter
kernel control interface, 281
protocol plumber, 281
socket filter. See Socket filter
Network memory buffers (mbufs)
cluster, 278
KPI, 279
linked list, 278
mbuf_allocpacket() function, 280
mbuf_allocpacket_list function, 280
mbuf_copyback() function, 279
mbuf_copydata() function, 279
MBUF_DONTWAIT, 280
mbuf_tag_allocate() function, 280
MBUF_WAITOK, 280
MH_ext field, 279
the mbuf_next() macro, 280
Networking, 275
BSD layer, 275
BSD network stack, 276
data structures, 276
debugging and testing, 301
I/O Kit
AirPort drivers, 304
driver initialization and startup
attachInterface() method, 311
configureInterface() method, 311–12
createMedium() function, 311
registerService() method, 312
enableHardware() method, 315
Ethernet controller driver. See MyEthernetDriver
fRxPacketQueue, 315
IO80211Controller, 304
IO802Family.kext, 304
IONetworkController class, 303
IONetworkingFamily class hierachy, 302, 303
IONetworkInterface class, 303
IOUserClient, 304
MAC address configuration, 313–14
medium and status selection, 312–13
kernel network architecture, 275
KPI, 276
mbufs. See Network memory buffers
NKE. See Network kernel extensions
socket API, 276
numSampleFrames, 271
Objective-C, 18
Open host controller interface (OHCI), 145
OpenAL, 253
Operating system fundamentals, 1
boot sequence, 4
driver, 2
hardware configuration, 2
kernel space code, 3
sound card, 3
user space code, 3
virtual memory
buffer, 11
page fault, 10
page table, 9
physical address translation, 9, 10
opt argument, 418
options argument, 116
OSBoolean class, 69
OSBundleLibraries, 44, 180, 413
OSBundleLibraries dictionary, 43, 60–61
OSDeclareDefaultDestructors() macro, 66
OSDefineMetaClassAndStructors() macro, 66
OSDictionary object, 63
OSKextRequestResource function, 424–25
OSNumber class, 69
OSOBject, 192
OSOrderedSet, 69
OSSet, 69
OSString class, 69
OSSwapLittleToHostInt64(), 349
OSSymbol class, 69
outputPowerCharacter, 209
outputStructSize argument, 90
outputStructSize arguments, 91
PackageMaker, 429
PackageMaker, KEXT
.user interface, 434
"Volume selected by user" option, 435
binary compressed package file, 435
file command, 435
FireWire, PCI, and USB, 435
GUI-based wizard, 435
Hello World Kernel Extension, 436
Installer.app program, 435
Launch Agents/Daemons, 434
package configuration
“Actions” editor, 441
“Actions” tab, 438
“Allow custom location” option, 439
“Apply Recommendations” button, 440
“Contents” tab, 440
“Destination” field, 439
“Edit Interface” option, 437
“Install” field, 439
“Package Location” field, 440
“Patch” field, 439
“Require admin authentication”, 440
“Requirements” tab, 438
“Restart Action”, 439
“rm” command, 441
action editor, 438
bundle/individual file, 440
HelloWorld.kext, 438
Installer.app, 437
Launch Agents/Daemons, 440
meta data files, 441
meta-data and version information, 439
root user, 441
test subset, 438
wheel group, 441
software distributions, 434
uninstallation, 442
UNIX scripts, 435
user interface, 435
Xcode, 435
PCI Express (PCIe), 174
performAudioEngineStart() method, 272, 273
performAudioEngineStop() method, 272–73
performRead() and performWrite() methods, 329
Peripheral component interconnect (PCI), 173
configuration space registers, 175–76
DMA. See Direct Memory Access
ExpressCard, 175
I/O Kit
Configuration space registers. See Configuration space registers
display controller, 181
handling device removal, 189–92
IOAGPDevice, 177
IOMatchCategory, 181
IOPCIBridge, 177
IOPCIDevice object, 177
IOPCIFamily class hierarchy, 176, 177
matching and loading drivers, 178–80
memory regions. See I/O memory regions
MyFirstPCIDriver class. See MyFirstPCIDriver class
interrupts
direct interrupt, 193
handling primary interrupts, 197–98
handling secondary interrupts, 198- 99
indirect interrupts, 193
OS X and iOS, 193
primary interrupt context, 192
secondary interrupt context, 192
PCI Express, 174
PCI-X and PCI-X 2.0 standards, 173
Thunderbolt, 174
Physical Address Extensions (PAE), 100
Power management, 205
doze state, PCI card, 205
I/O registry power plane, 205–6
power state changes
acknowledgeSetPowerState(), 214
driver removal, 212
for driver, 211
gPowerStates array, 211
IOPMPowerState structure, 208
IOPMPowerState structures, 210
IOService class, 210
joinPMtree() method, 212
kIOPMAckImplied code, 214
myReadDataFromDevice() method, 224
notifications, 208
PMinit() method, 212
powerStateOrdinal parameter, 214
registerPowerDriver() method, 212, 214
setPowerState() method, 212, 214
sleep mode, 205
powerChangeDone() method, 219
powerDomainBudget, 210
PowerPC architecture, 102
powerStateDidChangeTo() notification, 218
powerStateWillChangeTo() notification, 218
powerToAttain, 210
pre-Lion operating systems, 434
prepare() method, 203
Primary interrupt filter method, 197
proc_selfname() function, 422
proc_selfpid() function, 422
protosw, 276
publishMediumDictionary() method, 313
Pulse Code Modulation (PCM), 250
RAMDiskStorageDevice nub class header file, 331–32
ReadIsochPipeAsync method, 384
ReadPipe, 377
ReadPipeAsync, 378
ReadPipeAsyncTO, 378
ReadPipeTO, 378
receivePacketFromHardware(), 321
registerInterestedDriver(IOService* driver) method, 218
registerNotificationPort() method, 427
ResetDevice, 366
ResetPipe, 375
runAction(), 140
Sample depth, 250
Sample frame, 250
Sample rate, 250
sampleBuf parameter, 271
scheduleSecondaryInterrupt variable, 198
sDelayForTime(), 98
Secondary interrupt handler function, 199
Serial port drivers
Apple USB serial driver, 226
AppleUSBCDC driver, 226
AppleUSBCDCDMM class, 227
attach() method, 228
C++ new operator, 228
Communications Device Class, 226
createSerialStream() method, 227, 229
Darwin source code repository, 226
data transmission, 223
executeEvent() and requestEvent() method, 239, 241, 242
I/O Kit, 226
init() method, 228
IOModemSerialStreamSync class, 229
IOSerialDriverSync Class, 226
AppleUSBCDCDMM driver, 232, 233
dequeueData() method, 232
IOSerialDriverSync interface, 230, 231, 232
refCon value, 231
watchState() method, 232
IOSerialFamily kernel module, 229
IOSerialStreamSync class, 227
IOSerialStreamSync Object, 228
IOUSBDevice object, 226
kernel serial driver stack, 226
kIOTTYBaseNameKey and kIOTTYSuffixKey properties, 230
PD_E_FRAMING_ERROR, 242
PD_E_HW_OVERRUN_ERROR and PD_E_SW_OVERRUN_ERROR, 242
PD_E_INTEGRITY_ERROR, 242
PD_RS232_E_RX_LINE_BREAK, 242
registerService() method, 229
serial data transfer
CheckQueues() function, 246
dequeueData() method, 243, 245, 246
driver internal transmit buffer, 246, 247
enqueueData() method, 243, 244
IOSerialBSDClient, 243
requestEvent() method, 243
StartHardwareTransmit() function, 244
transmit buffer, 243
serial port settings, 239
tcsetattr() and tcgetattr() functions, 239
user space application, 223
/dev directory, 248
I/O Registry, 248
IOSerialBSDClient objects, 248
kIOCalloutDeviceKey, 249
Serial port drivers, user space application (cont.)
kIODialinDeviceKey, 249
kIOTTYDeviceKey, 248
matching dictionary, 248
Set option function, 419
SetAlternateInterface, 374
SetConfiguration, 369
setHardwareAddress() method, 314
setIdleTimerPeriod(period) method, 216
setIOEnable() method, 189
setLinkStatus() method, 313
setNumSampleFramesPerBuffer() method, 266
setPowerState() method, 216, 217, 218, 220
setProperties() method, 82
setProperty, 189
setSelectedMedium(), 313
settleDownTime, 210
settleUpTime, 210
sf_connect_in filter function, 289–90
sf_connect_in function, 289
sf_connect_out filter function, 289
sf_handle structure, 283
sflt_register() function, 284, 285
sflt_register() function add_entry() function, 285
sft_name, 284
sGetElapsedTimerTime(), 98
SleepX tool, 433
sock_data_filt_flag_oob flag, 291
sock_data_filt_flag_record flag, 291
Socket filters
AppWall
ALF.kext, 284
IP version 4, 284
operation and data structures, 286
unabridged source, 284
attachment and detachment
attach callback, 287
cookie parameter, 287
ENOPOLICY, 288
IP address retrieval, 287
proc_selfname(), 288
sf_attach function, 286
sf_attach() function, 288
sf_detach function, 286
sflt_unregister(), 288
auxiliary protocols, 282
bind() and listen(), 282
definition, 284
filter IP-based traffic, 281
sf_attach and sf_detach, 283
sf_flags field, 283
SFLT_GLOBAL, 283
SFLT_PROG, 283
socket structure, 276
Spin locks
Boolean flag, 128
CPU cycles spinning, 128
deadlock, 128
interrupt handler, 129
IOSimpleLock functions, 129–30
multiprocessor system, 128
unsigned 32-bit integer, 128
startFrame parameter, 381
stateNumber argument, 218
staticPower, 209
stop() method, 191
Storage systems, 319
driver stack, 320
external USB flash drive vs. internal hard disk, 319
I/O Kit, 319
IOBlockStorageDevice interface
Disk Utility, 324
doAsyncReadWrite, 327
doDiscard method, 325
doEjectMedia, 326
doFormatMedia, 325
doGetFormatCapacities, 325
doLockUnlockMedia, 326
doSynchronizeCache, 327
doUnmap method, 326
getAdditionalDeviceInfoString, 324
getProductString, 324
getRevisionString, 324
getVendorString, 324
getWriteCacheState, 327
logical blocks, 321
reportBlockSize, 325
reportLockability, 324
reportMaxValidBlock, 325
reportMediaState, 324
reportPollRequirements, 324
reportRemovability and reportEjectability, 324
reportWriteProtection, 325
requestIdle, 326
setWriteCacheState, 327
subclass implementation methods, 322–23
System Information, 324
layered stack, 319
media filter drivers. See Media filter drivers
multiple drivers, 319
partition schemes
attachMediaObjectToDeviceTree() method, 345
hypothetical partition scheme, 347
instantiateMediaObject() method implementation, 348–50
IOBufferMemoryDescriptor, 347
IOGUIDPartitionTableScheme, 341
IOMemoryDescriptor, 347
IOPartitionScheme class, 340, 341
IOService method, 344
kIODirectionIn, 347
Mac OS X, 340
matching dictionary, property list, 341–42
media content hint property, 351
OSSet, 347
partition entry verification, 348
read() method, 347
stop() and free() methods, 350–51
strcmp() function, 347
RAM disk device
block and character device interface, 340
block and character device interfaces, 340
buffer cache, 340
com_osxkernel_driver_RAMDiskStorageDevice class, 330
com_osxkernel_driver_RAMDiskStorageDevice class implementation, 332–35
createBlockStorageDevice() method, 330
Disk Utility application, 336–38
diskutil list command, 340
driver stack, 337
GUID partition table, 338, 339
I/O Kit, 327
IOBlockStorageDevice class, 339
IOBlockStorageDevice nub, 330–31
IOBlockStorageDriver class, 339
IOMedia class, 339
IOMediaBSDClient class, 339
IOMediaBSDClient object, 339
IORegisterExplorer utility, 336
IOResources class, 327
IOService class, 327
IOStorageFamily, 339
IOStorageFamily framework, 335
Mac OS X implementation, 327
matching dictionary, 335
memory allocation, 327
OSBundleLibraries, 335
RAMDisk class, 329
RAMDiskStorageDevice, 330
registerService() method, 331
standard Mac OS X dialog, 336
transport driver header file, 328
transport driver implementation, 328–29
transport layer drivers, 320–21
VFS layer, 319
streamFormat parameter, 271
Streaming SIMD Extensions (SSE), 411–12
Struct task, 105
Subsytem vendor/device ID, 176
Synchronization and threading, 119
arbitration, 119
asynchronous events. See Work loops
atomic operations
ARM instruction set, 123
definition, 123
LOCK prefix, 123
object reference counting implementation, 124–25
OSBitAndAtomic() function, 125
OSBitOrAtomic() function, 125
OSCompareAndSwap() function, 125, 126
OSDecrementAtomic(), 125
race condition, 123
release() method, 125
retain() and release() implementation, 124
retainCount value, 125
interrupt service routine, 119
Synchronization and threading (cont.)
kernel threads
<IOKit/IOLib.h> header file, 143
<kern/thread.h> header file, 143
continuation argument, 144
delay operation, 143
interrupt handler, 143
kernel_thread_start() function, 144
new_thread argument, 144
parameter function, 144
pthread_create() function, 144
sleep operation, 143
thread_terminate() function, 144
time-consuming operation, 143
user space process, 143
waitResult function, 144
locks
condition variables. See Condition variables
I/O Kit, 127
mutexes. See Mutexes
race conditions, 127
shared resource, 127
spin. See Spin locks
multiple CPU cores, 119
primitives
EAX register, 122
mov instruction, 121
OSObject class, 120
OSObject implementation, 120
race condition, 122
release() function, 120
retainCount, 122
takeTimeStamp(), 273
takeTimeStamp() function, 272
takeTimeStamp() method, 273
tcplognke, 292
terminate() method, 191
Thunderbolt, 174
timeToAttain, 210
timeToLower, 210
transaction argument, 140
transmitPacketToHardware() method, 317–18
unbudgetedPower, 210
Unified buffer cache (UBC), 37, 38
unique identifier (UID), 432
unitinfo parameter, 418
Universal Buffer Cache (UBC), 104
Universal host controller interface (UHCI), 145
Universal serial bus (USB)
bulk endpoints, 149
configuration descriptor, 150
control endpoints, 149
control requests, 171
device and driver handling, 153, 154
device classes, 151
device descriptor, 150
device requests, 168, 170, 171
endpoint descriptor, 150
endpoint enumeration, 166, 167, 168
host controller, 142, 144, 145
I/O bulk and interrupt
asynchronous requests, 175, 176
completion parameter, 172
completionTimeout, 172
endpoints, 173
errors and pipe stalls, 174
IOMemoryDescriptor, 172
IOUSBPipe class, 171
Read() and Write() method, 171, 172
reqCount, 172
I/O kit, 152
implementers forum, 141
interface descriptor, 150
interface enumeration, 165, 166
interrupt endpoints, 149
interrupt transfer, 143
iSight camera, 143
isochronous endpoints, 149
key characteristics, 143
MacBook, 142
mass storage device driver
attach() method, 162
bInterfaceClass, 161
IOMatchCategory key, 161
IOUSBInterface, 163
IOUSBMassStorageClass, 161
kernel.log, 162
kextlibs tools, 162
matching dictionary, 161
MyFirstUSBDriver.cpp, 158, 159, 160
MyFirstUSBDriver.h, 158
OSBundleLibraries dictionary, 162
start() method, 161
thumb/flash drive, 158
virtual driver, 157
master-slave system, 141
message pipe, 149
On-The-Go (OTG), 145
protocol, 146
communication protocol, 146
cyclic redundancy check field, 148
data packet, 146
data packets, 148
end of packet (EOP) field, 148
endpoint field, 148
frame packet, 146
handshake packet, 146
isochronous transfer modes, 149
little-endian format (LSB), 146
packet identifier values, 147, 148
packet type layout, 147
token packet, 146
transaction, 148
stream pipe, 149
topology, 142
transfer speeds, 144
version 3.0, 141
unmap() method, 189
updateFrequency parameter, 384
USBDeviceAbortPipeZero, 367
USBDeviceReEnumerate, 366
USBGetManufacturerStringIndex, 365
USBGetProductStringIndex, 365
USBGetSerialNumberStringIndex, 365
USBInterfaceGetStringIndex, 374
User client methods
callback function, 94
clientDied() method, 86
DelayForTime(), 97
DelayForTime() function, 92
driver object and user client objects, 84
externalMethod() implementation, 92, 97
getElapsedTimerTime(), 98
GetElapsedTimerTime() and DelayForTime() methods, 98
GetElapsedTimerTime() implementation, 91
GetElapsedTimerTimer(), 97
initWithTask() method, 87
inputStruct argument, 90
IOConnectCallMethod() function, 91
IOConnectCallScalarMethod() function, 89, 91
IOConnectCallStructMethod() function, 90, 91
IOExternalMethodArguments structure, 92–93, 97
IOExternalMethodDispatch, 95
IOExternalMethodDispatch structure, 93
IOMemoryDescriptor class, 93
IOService, 84
IOService class, 85
IOServiceClose() function, 86
IOUserClient class, 84
library functions, 88
MyUserClient class, 85
newUserClient() method, 85
outputCount argument, 90
outputStruct buffer, 90
outputValues array, 90
scalarOutput array, 98
start() method, 88
StartTimer() and StopTimer() functions, 91
structureInput buffer, 98
structureInputDescriptor and structureOutputDescriptor, 93
TestDriverInterface.h, 89
TimerRequestCode enumeration, 90, 97
user space interface, 88
User-space USB drivers, 357
asynchronous operations, 363–64
extensions directory, 357
IOUSBDevice class, 358
IOUSBDeviceInterface class. See IOUSBDeviceInterface class
IOUSBInterface class, 358
IOUSBInterfaceInterface class. See IOUSBInterfaceInterface class
IOUSBLib, 358
User-space USB drivers (cont.)
IOUSBLib framework
AddRef() method, 363
IOCFPlugInInterface class, 363
IOCreatePlugInInterfaceForService, 362
IOCreatePlugInInterfaceForService() function, 362
IODestroyPlugInInterface(), 362
IOUSBLib.h header file, 362
IUnknown class, 363
notification callback, 358
plugin variable, 363
QueryInterface, 362
QueryInterface() method, 362, 363
Release() method, 363
layers, 358
PCI and Thunderbolt devices, 357
primary interrupt level, 357
Vendor ID, 175
Virtual File System layer (VFS layer), 319
Virtual memory addresses, 120
Virtual memory structure, 105
Virtual Private Network (VPN), 431
vm_page_alloc() function, 105
vm_page_grab function, 104
whatDevice argument, 218
willChange notification, 219
willTerminate() method, 191
Windows Registry, 63
withSpecification() factory method, 318
wMaxPacketSize, 374
Work loops
advantages, 138
callback function, 139
getWorkLoop() method, 138, 139
hardware interrupts/timers, 137
interrupt handler, 139
IOEventSource function, 139
IOWorkLoop object, 137, 138–39
OSObject class, 139
WriteIsochPipeAsync method, 384
WritePipe, 377
WritePipeAsync, 378
WritePipeAsyncTO, 378
WritePipeTO, 378
Xcode, 433
Xcode 4 user interface, 40, 41
XNU kernel
architecture, 22
BSD layer, 22
file systems, 36
FreeBSD 5 operating system, 34
networking, 36
services overview, 34
system calls, 35
virtual file system, 37
I/O Kit, 22
KEXT, 22
Mach layer, 21
hardware abstraction, 23
interprocess communication, 25, 26
memory allocation, 34
memory management, 28
physical map, 30
task address space, 28, 31, 32, 33
tasks and threads, 23
virtual memory objects, 30, 31
zinit() function, 105
3.138.123.106