Which KPI Library Is IODeviceMemory Declared In?

222 views Asked by At

Google yields no insight. I wasn't able to figure it out by searching around in the kernel source.

I'm using the open source IOProxyVideoFamily to implement a virtual framebuffer.

I just replaced a C-style cast to IODeviceMemory with OSDynamicCast, because I suspect that cast will fail. If so I will know how to fix it.

But I can't find the KPI library that contains it. IODeviceMemory has been in the OS since 10.0, and is required for PCI card drivers.

$ kextlibs -undef-symbols /System/Library/Extensions/IOProxyFramebuffer.kext/

For all architectures:
   com.apple.iokit.IOGraphicsFamily = 2.4.1
   com.apple.kpi.iokit = 15.6
   com.apple.kpi.libkern = 15.6
   com.doequalsglory.driver.IOProxyVideoCard = 1.0d1

For x86_64:
   1 symbol not found in any library kext:
   ZN14IODeviceMemory9metaClassE

IODeviceMemory is a subclass of IOMemoryDescriptor. It's declaration includes OSDeclareDefaultStructors.

(The dependence on IOProxyVideoCard is satisfied when the video card driver is installed.)

1

There are 1 answers

0
pmdj On

IODeviceMemory is a weird IOMemoryDescriptor subclass in that it doesn't override any virtual functions and doesn't add any fields. So it's really just a few static helper functions for IOMemoryDescriptor. If you look at the source code for those helper functions, you'll find that none of them actually create an instance of IODeviceMemory - instead they call down to IOSubMemoryDescriptor::withSubRange() (which obviously creates an IOSubMemoryDescriptor object) and IOMemoryDescriptor::withAddressRange() (I believe this latter one creates an IOGeneralMemoryDescriptor).

So your dynamic cast wouldn't work anyway, IODeviceMemory doesn't really exist - there are normally no instances of it around. I suspect this is why the auto-generated OSMetaClass stuff for it isn't exported via a KPI.