问题描述
Google没有洞察力.我无法通过搜索找出答案在内核源代码中.
Google yields no insight. I wasn't able to figure it out by searchingaround in the kernel source.
我正在使用开源IOProxyVideoFamily来实现虚拟帧缓冲区.
I'm using the open source IOProxyVideoFamily to implement a virtual framebuffer.
我刚刚用OSDynamicCast替换了对IODeviceMemory的C样式强制转换,因为我怀疑演员会失败.如果是这样,我会知道如何解决它.
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 fixit.
但是我找不到包含它的KPI库. IODeviceMemory具有从10.0开始就在操作系统中使用,并且对于PCI卡驱动程序是必需的.
But I can't find the KPI library that contains it. IODeviceMemory hasbeen 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是IOMemoryDescriptor的子类.这是宣言包括OSDeclareDefaultStructors.
IODeviceMemory is a subclass of IOMemoryDescriptor. It's declarationincludes OSDeclareDefaultStructors.
(当视频卡满足对IOProxyVideoCard的依赖性驱动程序已安装.)
(The dependence on IOProxyVideoCard is satisfied when the video carddriver is installed.)
推荐答案
IODeviceMemory
是一个奇怪的IOMemoryDescriptor
子类,因为它不覆盖任何虚函数并且不添加任何字段.因此,实际上,它只是IOMemoryDescriptor
的一些静态帮助器函数.如果查看这些帮助程序功能的源代码,则会发现没有一个实际上创建了IODeviceMemory
的实例-而是调用了IOSubMemoryDescriptor::withSubRange()
(显然会创建一个IOSubMemoryDescriptor
对象)和IOMemoryDescriptor::withAddressRange()
(我相信后者会创建一个IOGeneralMemoryDescriptor
).
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
).
所以您的动态强制转换无论如何都不起作用,IODeviceMemory
并不真正存在-通常没有实例.我怀疑这就是为什么自动生成的OSMetaClass东西没有通过KPI导出的原因.
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.
这篇关于IODeviceMemory声明在哪个KPI库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!