Which KPI Library Is IODeviceMemory Declared In?

旧街凉风 提交于 2019-12-11 07:34:44

问题


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:


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.



来源:https://stackoverflow.com/questions/46229431/which-kpi-library-is-iodevicememory-declared-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!