| 92 | } |
| 93 | |
| 94 | void CIntelBTPatcher::processKext(KernelPatcher &patcher, size_t index, mach_vm_address_t address, size_t size) |
| 95 | { |
| 96 | DBGLOG(DRV_NAME, "%s", __PRETTY_FUNCTION__); |
| 97 | if (getKernelVersion() < KernelVersion::Monterey) { |
| 98 | if (IntelBTPatcher_IOBluetoothInfo.loadIndex == index) { |
| 99 | DBGLOG(DRV_NAME, "%s", IntelBTPatcher_IOBluetoothInfo.id); |
| 100 | |
| 101 | KernelPatcher::RouteRequest findQueueRequestRequest { |
| 102 | "__ZN25IOBluetoothHostController17FindQueuedRequestEtP22BluetoothDeviceAddresstbPP21IOBluetoothHCIRequest", |
| 103 | newFindQueueRequest, |
| 104 | oldFindQueueRequest |
| 105 | }; |
| 106 | patcher.routeMultiple(index, &findQueueRequestRequest, 1, address, size); |
| 107 | if (patcher.getError() == KernelPatcher::Error::NoError) { |
| 108 | DBGLOG(DRV_NAME, "routed %s", findQueueRequestRequest.symbol); |
| 109 | } else { |
| 110 | SYSLOG(DRV_NAME, "failed to resolve %s, error = %d", findQueueRequestRequest.symbol, patcher.getError()); |
| 111 | patcher.clearError(); |
| 112 | } |
| 113 | |
| 114 | } |
| 115 | } else { |
| 116 | if (IntelBTPatcher_IOUsbHostInfo.loadIndex == index) { |
| 117 | SYSLOG(DRV_NAME, "%s", IntelBTPatcher_IOUsbHostInfo.id); |
| 118 | |
| 119 | KernelPatcher::RouteRequest hostDeviceRequest { |
| 120 | "__ZN15IOUSBHostDevice13deviceRequestEP9IOServiceRN11StandardUSB13DeviceRequestEPvP18IOMemoryDescriptorRjP19IOUSBHostCompletionj", |
| 121 | newHostDeviceRequest, |
| 122 | oldHostDeviceRequest |
| 123 | }; |
| 124 | patcher.routeMultiple(index, &hostDeviceRequest, 1, address, size); |
| 125 | if (patcher.getError() == KernelPatcher::Error::NoError) { |
| 126 | SYSLOG(DRV_NAME, "routed %s", hostDeviceRequest.symbol); |
| 127 | } else { |
| 128 | SYSLOG(DRV_NAME, "failed to resolve %s, error = %d", hostDeviceRequest.symbol, patcher.getError()); |
| 129 | patcher.clearError(); |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | #pragma mark - For Bigsur-, patch unhandled 0x2019 opcode |
| 136 | |