views:

130

answers:

2

Hi there,

I'm developing an OS X kernel extension (kext) that will be used as an I/O Kit driver. This driver, however, will be strictly "virtual"; it will not interface with any hardware.

OS X keeps a catalog (I/O Catalog) of all the drivers that are loaded into the kernel. It also keeps a registry (I/O Registry) containing the I/O Catalog drivers that have matched with a hardware device and that are currently controlling the hardware.

Since my driver is not dependent on hardware and does not "match", it is only loaded into the I/O Catalog and not registered with the I/O Registry. This causes a problem, because the API to obtain I/O driver objects is limited to the drivers that are registered in the I/O Registry and does not access the objects in the I/O Catalog. I've tried matching to my driver using the recommended APIs, however, as I mentioned before, these APIs do not expose the I/O Catalog entries.

My ultimate goal is to obtain a reference to my driver in order to transfer in data with the "setProperties" method. If all else fails, I can use a combination of syscall, copyin and copyout to transfer the data in and out of the driver, but I'm not interested in that solution at the moment.

In short: Is there any way to obtain a reference to a driver that is in the I/O Catalog but not in the I/O Registry?

Update: To observe what I mean, look at the following two screen shots of IORegistryExplorer:

The registered driver is easily accessed through the API, but the unregistered driver will not match using IOServiceGetMatchingServices(...). How do I get a reference to a loaded driver that is not registered?

For more information, check out:

A: 

You can get your driver to load without having a piece of hardware. You probably want to look into doing something like "IOResourceMatching" against "IOKit" or "IOBSD". That will cause passive matching to trigger on your driver when those resource become available.

Louis Gerbarg
I updated the question to respond to your answer. The driver is loading fine, but it will not register with the I/O Registry. The plist already contains an entry for "IOResourceMatch" to match with "IOKit" exactly like the Dont_Steal_Mac_OS_X driver.
mpiche
A: 

I have come to the conclusion that this is impossible. I will be taking a different approach. Thanks.

mpiche