Glossary
IOKit
XNU's C++ driver framework. Drivers are objects in a runtime-traversable tree, matched to hardware by dictionary.
IOKit is the kernel framework macOS uses to load and manage drivers. Unlike traditional Unix drivers (a static list of function pointers), IOKit drivers are C++ objects in a live tree — the IORegistry — that you can inspect with ioreg or IORegistryExplorer.
Each driver subclasses IOService, declares a matching dictionary in its Info.plist, and is instantiated by the kernel when hardware matching that dictionary appears.
apple-oss-distributions/xnuiokit/Kernel/IOService.cppIOService — the base class every IOKit driver inherits from.View on GitHub(line —) apple-oss-distributions/xnuiokit/Kernel/IORegistryEntry.cppThe IORegistry — the in-kernel tree of every device node.View on GitHub(line —)
Because the C++ ABI used in kernel kexts isn't compiler-stable, IOKit ships its own object model: OSObject for reference counting, OSMetaClass for runtime type info. The macros (OSDeclareDefaultStructors, etc.) wire your class into that model.
Apple has been migrating drivers from kernel kexts to DriverKit since macOS 10.15 — same IOKit object model, but the driver process runs in userspace where crashes can't take the kernel down.