bool FakePCIID::init(OSDictionary *propTable) { DebugLog("FakePCIID::init() %p\n", this); // announce version IOLog("FakePCIID: Version %s starting on OS X Darwin %d.%d.\n", kmod_info.version, version_major, version_minor); bool ret = super::init(propTable); if (!ret) { AlwaysLog("super::init returned false\n"); return false; } // place version/build info in ioreg properties RM,Build and RM,Version char buf[128]; snprintf(buf, sizeof(buf), "%s %s", kmod_info.name, kmod_info.version); setProperty("RM,Version", buf); #ifdef DEBUG setProperty("RM,Build", "Debug-" LOGNAME); #else setProperty("RM,Build", "Release-" LOGNAME); #endif // capture vtable pointer for PCIDeviceStub PCIDeviceStub *stub = OSTypeAlloc(PCIDeviceStub); mStubVtable = getVTable(stub); stub->release(); mDeviceVtable = NULL; mProvider = NULL; return true; }
bool FakePCIID::hookProvider(IOService *provider) { if (mDeviceVtable) return true; // already hooked IOPCIDevice *device = OSDynamicCast(IOPCIDevice, provider); if (!device) { AlwaysLog("provider is not a IOPCIDevice: %s\n", provider->getMetaClass()->getClassName()); return false; } // merge FakeProperties into the provider (only properties that do not exist) mergeFakeProperties(provider, "FakeProperties", false); mergeFakeProperties(provider, "FakeProperties-Forced", true); // hook provider IOPCIDevice vtable on attach/start mProvider = device; device->retain(); mDeviceVtable = getVTable(device); setVTable(device, mStubVtable); return true; }
bool FakePCIID_XHCIMux::init(OSDictionary *propTable) { DebugLog("FakePCIID_XHCIMux::init\n"); if (!super::init(propTable)) return false; // capture vtable pointer for PCIDeviceStub_XHCIMux PCIDeviceStub *stub = OSTypeAlloc(PCIDeviceStub_XHCIMux); mStubVtable = getVTable(stub); stub->release(); return true; }
bool FakePCIID::init(OSDictionary *propTable) { DebugLog("FakePCIID::init() %p\n", this); bool ret = super::init(propTable); if (!ret) { AlwaysLog("super::init returned false\n"); return false; } IOLog("FakePCIID version 1.2.0 starting.\n"); // capture vtable pointer for PCIDeviceStub PCIDeviceStub *stub = OSTypeAlloc(PCIDeviceStub); mStubVtable = getVTable(stub); stub->release(); mDeviceVtable = NULL; mProvider = NULL; return true; }