The I/O Kit Framework

The user space API through which a process communicates with a kernel driver is provided by a framework known as “IOKit.framework,” which will hereafter be referred to as the “I/O Kit framework.” The I/O Kit framework allows a user space application to determine the hardware devices and kernel drivers that are present on the system, to watch for the arrival or removal of hardware that can be hot-plugged (such as USB devices), and to interact with I/O Kit drivers. The I/O Kit framework defines the data types that provide a user space representation of kernel objects and the functions that are needed to manipulate these kernel objects. Although the I/O Kit is a C++ based framework in the kernel, the user space I/O Kit framework is provided as a set of C-based functions, so it can be used by projects that are written in both C and C++ or by projects that are written in Objective-C, which is of particular importance for GUI applications.

The I/O Kit framework provides access to the kernel objects that are present in the I/O Registry, which can be examined with the IORegistryExplorer utility (see Chapter 4). The I/O Registry consists of kernel objects that represent hardware devices that are connected to the computer or drivers that have matched against connected hardware devices and have been loaded into the kernel. The objects in the I/O Registry can be created only within the kernel, including by kernel drivers, but the I/O Kit framework provides a way for applications in user space to examine the contents of the I/O Registry, including iterating the registry, determining the relationship between objects (for example, to determine which driver has been loaded against a particular hardware device), and to read and write the properties of an object in the I/O Registry.

The I/O Registry contains kernel objects that may represent either loaded drivers or connected hardware devices. This means that the functionality provided by the I/O Kit framework can be applied to both a driver and to a hardware device. In some cases, an application can directly manipulate a hardware device through its corresponding I/O Registry object without the need for a kernel driver; this is discussed in Chapter 15 for USB devices. The I/O Kit framework also allows an application to install a notification to watch for the arrival of a particular driver or hardware device.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.76.218