Hi guys!
OK, reaching out for some help here.
I am having all kinds of trouble with OSDeclareDefaultStructors.
I have seriously been at this for nearly a week now and have come to the conclusion that I need to reach out for help from people that are more experience using Xcode.
I believe entirely that my issue is just that I can't for whatever reason see how to set up includes and libraries and things like that.
I have this line:
OSDeclareDefaultStructors(NukeVirtualGamepad)
No matter what I do, Xcode will not recognize OSDeclareDefaultStructors.
The project builds a DriverKit > Driver extension.
I have literally tried absolutely everything with this. I am at a loss for words. I even set up a new blank project and it still will not recognize OSDeclareDefaultStructors.
I did a lot of research and it looks like expo needs OSDeclareDefaultStructors in order for the extension to build with a binary in it instead of being just a codeless extension.
Here is the code with the issue:
#pragma once
#include <DriverKit/OSMetaClass.h>
#include <HIDDriverKit/IOUserHIDDevice.h>
#include <DriverKit/OSData.h>
class NukeVirtualGamepad : public IOUserHIDDevice {
OSDeclareDefaultStructors(NukeVirtualGamepad) // The problem is right here! This line!
public:
// Keep it minimal; no 'override' keywords since the .h types may not mark them virtual
bool init();
void free();
kern_return_t Start(IOService* provider);
void Stop (IOService* provider);
OSData* newReportDescriptor();
// (Optional) helper you’ll use later to inject input matching your report
kern_return_t PostInput(uint16_t buttons, int8_t x, int8_t y);
};
I do have to mention to everyone that I am still very new with Xcode. So there is a ton that I don't know yet or might be misunderstanding.
Has anyone seen this before?
Thank you in advance.
DriverKit
RSS for tagDevelop device drivers that run in user space using DriverKit.
Posts under DriverKit tag
66 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I’m creating my first DriverKit extension and I ran into an entitlement issue when trying to load my driver.
Error 0x0 8397 7 taskgated-helper: (ConfigurationProfiles) [com.apple.ManagedClient:ProvisioningProfiles] App.Dext: Unsatisfied entitlements: com.apple.developer.driverkit.transport.usb
I have already registered the entitlement com.apple.developer.driverkit.transport.usb with my vendor ID in the Apple Developer portal.
However, when I download the provisioning profile, it doesn’t include the idVendor value.
Screenshot from the developer portal (provisioning profile without idVendor) ?
<key>com.apple.developer.driverkit.transport.usb</key>
<array>
<dict>
<key>idVendor</key>
<integer>1356</integer> <!-- Sony -->
<!-- Có thể bổ sung:
<key>idProduct</key>
<integer>XXXXX</integer>
-->
</dict>
</array>
I’m creating my first DriverKit extension and I ran into an entitlement issue when trying to load my driver.
Error 0x0 8397 7 taskgated-helper: (ConfigurationProfiles) [com.apple.ManagedClient:ProvisioningProfiles] App.Dext: Unsatisfied entitlements: com.apple.developer.driverkit.transport.usb
I have already registered the entitlement com.apple.developer.driverkit.transport.usb with my vendor ID in the Apple Developer portal.
However, when I download the provisioning profile, it doesn’t include the idVendor value.
Screenshot from the developer portal (provisioning profile without idVendor) ?
<key>com.apple.developer.driverkit.transport.usb</key>
<array>
<dict>
<key>idVendor</key>
<integer>1356</integer>
</dict>
</array>
-Is this error caused by me registering the vendor ID incorrectly?
-Or is there an issue with how the entitlement is reflected in the provisioning profile?
Any guidance would be appreciated.
Hi guys!
I have gone through an absolute nightmare, trying to solve the issue that I am about to tell you about.
As the title says, I am getting the error:
Library '/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/17/lib/darwin/libclang_rt.profile_driverkit.a' not found
I trimmed off part of that directory as I did not want to reveal that information about my computer.
From what I can tell, the file in question is no longer even a part of Xcode. I have searched, it is not on my computer anywhere.
I have also downloaded older versions of Xcode to search with it. None of them have it.
I have literally tried everything under the Son to solve this issue.
I have been stuck on it for two days.
I have even resorted to doing something I hate, which is asking for ChatGPT to assist me with solving the issue. No help there.
I am at my wits end. So I am coming to you guys, have you seen this error?
Any ideas at all? The odds are pretty good whatever you recommend I have probably already tried 200 times over. But I am still open to hearing anything.
Have any of you had this error? Any ideas?
I am on the latest version of macOS.
The project is for a macOS app.
M4 Mac mini.
Any additional information I can provide, that will be helpful?
At this point, I am leaning more towards this being a bug with Xcode than anything.
I am having similar problems to this guy on Stack Overflow over a year ago:
https://stackoverflow.com/questions/77627852/functions-of-iouserscsiperipheraldevicetype00-class-in-scsiperipheralsdriverkit
There are also a few questions on this forum about this object, none of which have answers.
I can get my driver to match and instantiate, but
nobody calls my UserDetermineDeviceCharacteristics (which does nothing, just returns kIOReturnSuccess)
I can attempt to call UserSuspendServices(), UserResumeServices() or UserReportMediumBlockSize() and all of them return kIOReturnUnsupported. It doesn't matter if I've unmounted the disk or not.
Is the custom driver supposed to be instantiated beside the kernel's IOSCSIPeripheralDeviceType00, or should it replace it?
What should its IOProviderClass be?
What should its IOClass be - IOUserService, or something else?
see FB19678139 and FB19677920
I am trying to localize the CFBundleDisplayName and OSBundleUsageDescription of a driver that is part of an app.
I am able to use InfoPlist.strings files to localize the Bundle display name for the app, but when I try to use the same file as part of the driver, the name displayed in settings for the app does not change correctly.
In fact, it seems to follow the default language set in the xcode project. If the default language is not included in the suite of InfoPlist.strings files, it seems to take the string from the info.plist file. sometimes it just seems to take the English version regardless of the default language or tablet language.
Has anyone had success with this?
After some experimentation with copying multiple DriverKit SDKs into /Applications/Xcode.app/Contents/Developer/Platforms/DriverKit.platform/Developer/SDKs/DriverKit, it's become clear that Xcode only supports the DriverKit version that ships with it. There is no way to configure an alternative SDK within a project and changing to a different one results in strange build warnings and errors.
This begs the question - how are developers supposed to develop and support dexts? Here's one example scenario: SCSIDriverKit introduced a breaking change in DriverKit 24.4 (macOS 15.4 and Xcode 16.3) due to a new feature. Once a dext is built against that kit, it will not function on macOS 15.0-15.3 whether that feature is implemented or not. We found a similar thing with NetworkingDriverKit as well. So, over the course of maintaining a Sequoia product while working in Sequoia itself, simply updating Xcode breaks the product. Not to mention trying to maintain a Sequoia product in Tahoe when it is released.
How is this a good developer experience?
Are developers resigned to having a myriad of Xcode versions which may require booting into multiple macOS versions to use? That would in turn produce a myriad of product versions that would need to be deciphered by the user or an installer?
Shouldn't developers be able to use the latest tooling while still being able to produce products for OSes that are just a year or two old?
Or should DriverKit files be conditionalized so configuring a deployment version in Xcode actually builds the right thing even with the latest SDK?
I just don't get it. Help me understand. Replacing kexts with dexts seems like a development nightmare.
Is it possible to expose a custom VirtIO device to a Linux guest running inside a VM — likely using QEMU backed by Hypervisor.framework. The guest would see this device as something like /dev/npu0, and it would use a kernel driver + userspace library to submit inference requests.
On the macOS host, these requests would be executed using CoreML, MPSGraph, or BNNS. The results would be passed back to the guest via IPC.
Does the macOS allow this kind of "fake" NPU / GPU
Hi everyone, I'm working with a third party to integrate their USB driver into our app and I'm wondering if iPadOS supports bundling a prebuilt .systemextension file with the entitlement com.apple.developer.system-extension.redistributable into our app that has the com.apple.developer.driverkit.communicates-with-drivers entitlement?
If not, is there a way to bundle a third party USB driver into our iPad app?
Hi,
We’re developing a DriverKit extension for iPadOS. In local Debug and Release builds, everything works as expected, but the same build uploaded to TestFlight fails at IOServiceOpen with the following errors:
-536870212 (0xE00002EC) kIOReturnUnsupported
-536870201 (0xE00002F7) kIOReturnNotPermitted
What we’ve verified so far
App entitlements
We checked our main app entitlements file, and it has the correct capabilities for the driverkit communication
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.driverkit.communicates-with-drivers</key>
<true/>
<key>com.apple.developer.driverkit.userclient-access</key>
<array>
<string>abc.def.ABCDriver</string>
</array>
<key>com.apple.developer.system-extension.install</key>
<true/>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.device.usb</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
</dict>
</plist>
we also checked the Provisioning profile (as shown on the portal) and the “Enabled Capabilities” seems to have the correct DriverKit Capabilities enabled.
Enabled Capabilities
Access Wi-Fi Information, DriverKit, DriverKit (development), DriverKit Communicates with Drivers, DriverKit USB Transport (development), DriverKit USB Transport - VendorID, DriverKit UserClient Access, iCloud, In-App Purchase, Sign In with Apple, System Extension
When we download and inspect the provisioning profile as plain text, we notice that some expected DriverKit entitlements appear to be missing from the section.
<key>Entitlements</key>
<dict>
<key>beta-reports-active</key>
<true/>
<key>com.apple.developer.networking.wifi-info</key>
<true/>
<key>com.apple.developer.driverkit</key>
<true/>
<key>com.apple.developer.driverkit.communicates-with-drivers</key>
<true/>
<key>application-identifier</key>
<string>ABC123456.abc.def</string>
<key>keychain-access-groups</key>
<array>
<string>ABC123456.*</string>
<string>com.apple.token</string>
</array>
<key>get-task-allow</key>
<false/>
<key>com.apple.developer.team-identifier</key>
<string>ABC123456</string>
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>ABC123456.*</string>
<key>com.apple.developer.icloud-services</key>
<string>*</string>
<key>com.apple.developer.icloud-container-identifiers</key>
<array></array>
<key>com.apple.developer.icloud-container-development-container-identifiers</key>
<array></array>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array></array>
<key>com.apple.developer.driverkit.transport.usb</key>
<array>
<dict>
<key>idVendor</key>
<integer>1234</integer>
</dict>
</array>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
</dict>
We have a couple of questions:
Could the missing com.apple.developer.driverkit.userclient-access entitlement in the provisioning profile alone explain the kIOReturnUnsupported / kIOReturnNotPermitted failures from IOServiceOpen?
Why do some DriverKit capabilities appear in the Apple Developer portal UI but vanish from the actual profile we download? Is there an extra step we’re overlooking when regenerating profiles after toggling those capabilities?
Thanks
When we ship an iOS app with a DriverKit driver bundled, we'd like to be able to check if the device the app is running on is actually capable of installing & running DriverKit drivers. However I have yet to find a reliable way to achieve this. We want to know before the driver has even been enabled, as we want to direct the user to enable it in the app's settings.
I have tried a few things to no avail, and lots of it has just been unmaintainable guesses at which device the app is running on, rather than checking directly if DriverKit is actually available.
Is there any suggested way of achieving this? Thanks!
The driver does not show up in the app settings after switching to “DriverKit USB Transport - VendorID”.
Previously, the app used “DriverKit USB Transport (development)” and everything worked as expected.
The entitlements looked like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.driverkit</key>
<true/>
<key>com.apple.developer.driverkit.transport.usb</key>
<array>
<dict>
<key>idVendor</key>
<string>*</string>
</dict>
</array>
</dict>
</plist>
I received approval to use “DriverKit USB Transport - VendorID”.
I updated the App ID configuration in the portal, removed all development entitlements, updated the provisioning profile, and edited the driver’s .entitlements as follows:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.driverkit</key>
<true/>
<key>com.apple.developer.driverkit.transport.usb</key>
<array>
<dict>
<key>idVendor</key>
<integer>1111</integer>
</dict>
</array>
</dict>
</plist>
The app installs on an iPad with an M processor, but the driver does not appear in the settings.
In the logs I see the following:
272 debug 19:50:42.005193+0300 installd 7935 signing bytes in 5 blob(s) from /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.bugkAE/extracted/Payload/****.app/SystemExtensions/****Driver.dext/****.Driver(arm64)
272 debug 19:50:42.012068+0300 installd open(/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.bugkAE/extracted/Payload/****.app/SystemExtensions/net.svedm.****.SDRDriver.dext/Info.plist,0x0,0x1b6) = 4
272 debug 19:50:42.012712+0300 installd 0xc2e14c618 done serializing <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>application-identifier</key><string>****.Driver</string><key>com.apple.application-identifier</key><string>****</string><key>com.apple.developer.driverkit</key><true/><key>com.apple.developer.driverkit.transport.usb</key><array><dict><key>idVendor</key><integer>3034</integer></dict></array><key>com.apple.developer.team-identifier</key><string>****</string><key>com.apple.security.get-task-allow</key><true/><key>get-task-allow</key><true/></dict></plist>
0 error 19:53:08.930054+0300 kernel Sandbox: MyApp(844) deny(1) sysctl-read kern.bootargs
0 error 19:53:08.931571+0300 kernel Sandbox: driverkitd(77) deny(1) syscall-unix 284
syscall-unix-denied-SIGKILL
0 error 19:53:09.985946+0300 kernel 1 duplicate report for Sandbox: driverkitd(77) deny(1) syscall-unix 284
syscall-unix-denied-SIGKILL
0 error 19:53:09.985985+0300 kernel Sandbox: MyApp(844) deny(2) file-test-existence /usr/bin/swift-backtrace
0 error 19:53:09.986011+0300 kernel Sandbox: MyApp(844) deny(2) file-test-existence /usr/bin/arm64e
But I don’t quite understand what is going wrong. Any ideas?
I am currently developing a kiosk system that incorporates an iPad along with a custom peripheral device. The two components are intended to communicate via USB serial.
I have encountered a critical issue while working with the official DriverKit sample code provided at the following link:
https://developer.apple.com/documentation/driverkit/communicating-between-a-driverkit-extension-and-a-client-app
Model info :
iPad Pro 12.9-inch (5th generation / M1 chipset)
iPadOS 18.4.1
App Stops Functioning After Repeated Builds
When I first build and run the sample code without any modifications, it works as expected. However, after making changes and running the app repeatedly on the iPad, it eventually reaches a state where the app stops functioning completely — no logs are printed, and device communication fails.
Reinstalling the app or rebooting the iPad does not resolve the issue. Even when I revert to the original, unmodified sample code, the problem persists. Surprisingly, if I generate a new Bundle Identifier, the app functions normally again.
I would like to ask:
What could be causing this behavior?
Have similar cases been reported before?
For your reference, I’ve attached a video demonstrating the issue and the source code used during the recording:
Source Code:
https://drive.google.com/file/d/14whvWwuhrmS5VoR3sSKyNT-GpTPC_c_8/view?usp=sharing
Video:
https://drive.google.com/file/d/1SfqIkEphSDrvg-CKS6KBcJ1VBP3cPqCC/view?usp=sharing
Request for USB Serial Communication Reference
Currently, due to the issue above, I am unable to obtain a device instance at all.
Even assuming this is resolved, I noticed that the sample code does not include any implementation or reference material for USB serial communication itself.
Is there any official sample code or documentation available that demonstrates USB serial communication between an iPad and an external device using DriverKit?
Difficulty Debugging Due to Missing os_log Output
Another challenge I'm facing is the inability to view os_log output while connecting the USB device to the iPad.
This significantly hinders the debugging process during DriverKit development.
Are there any recommended or supported methods for accessing logs and debugging effectively in this environment?
To learn how to develop/distribute a DriverKit driver (DEXT) and a UserClient app correctly, I am trying to run the following sample dext and app.
https://developer.apple.com/documentation/driverkit/communicating-between-a-driverkit-extension-and-a-client-app?language=objc
I walked throught steps in README.md included in the project and faced issues.
First, I referred the "Configure the Sample Code Project" section in the README.md and configured the sample code project to build with automatic signing.
I could run the app and activate the dext successfully and made sure the app could communicate with the dext.
Next, I tried the manual signing.
I followed steps described in the "Configure the Sample Code Project" section carefully.
The following entitlements has already been assigned to my team account.
DriverKit Allow Any UserClient Access
DriverKit USB Transport - VendorID
DriverKit
I could build both app and dext and could run the app.
However, when I clicked the "Install Dext" button to activate the dext, I got the following error:
sysex didFailWithError: extension category returned error
Am I missing something?
I would also like to know detailed steps to publicly distribute my dext and app using our Developer ID Application Certificate, as README.md only shows how to configure the project for development.
Xcode version: 16.3 (16E140)
Development OS: macOS 15.5 (24F74)
Target OS: macOS 15.5 (24F74)
Topic:
Code Signing
SubTopic:
Certificates, Identifiers & Profiles
Tags:
Entitlements
Provisioning Profiles
DriverKit
I have a dext that creates a periodic timer on its own dispatch queue. The callback is declared as follows:
virtual void HandleTimer( OSAction *action, uint64_t time ) TYPE(IOTimerDispatchSource::TimerOccurred);
The timer is allocated as follows:
CreateActionHandleTimer( size, &ivars->TimerHandler );
IODispatchQueue::Create( "TimerQueue", 0, 0, &ivars->TimerDispatchQueue );
IOTimerDispatchSource::Create( ivars->TimerDispatchQueue, &ivars->TimerDispatchSrc );
I can start up the timer and it works just fine. However, in my Stop() method, when trying to shut the timer down, I get an assertion in OSAction::Cancel() for TimerHandler:
Assertion failed: (queue), function Cancel, file uioserver.cpp, line 4401.
What does this assertion indicate or is the source code available? If so, where? I'm using macOS 15.5.
Note I am attempting to cancel the handler after the dispatch source and queue are canceled and the cleanup methods have been called (which is working). But, cancelling TimerHandler first also asserts.
I have reference some related post for this issue:
https://developer.apple.com/documentation/xcode-release-notes/xcode-16-release-notes#Foundation
https://developer.apple.com/forums/thread/762711
Unfortunately, I'm facing the similar issues even though using Xcode Version 16.2 (16C5032a).
we have the following build environment:
Xcode version: Xcode 16.2 (16C5032a)
macOS Version: macOS 14.7.4 (23H420)
Everything builds and install fine. But when attempting to plug on Device on macOS 14.7.4 it crashes immediately with what appears to be a missing Foundation symbol.
Crashed Thread: 0
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: Namespace DYLD, Code 4 Symbol missing
Symbol not found: __ZThn48_N21IOUserNetworkEthernet25registerEthernetInterfaceE10ether_addrPP24IOUserNetworkPacketQueuejP29IOUserNetworkPacketBufferPoolS5_
Referenced from: <ECE57ABF-0633-3C3B-8427-FB25CC706343> /Library/SystemExtensions/*/com.asix.dext.pciedevice
Expected in: <CDEB3490-B1E0-3D60-80CE-59C0682A4B03> /System/DriverKit/System/Library/Frameworks/NetworkingDriverKit.framework/NetworkingDriverKit
(terminated at launch; ignore backtrace)
Thread 0 Crashed:
0 dyld 0x1041da4c8 __abort_with_payload + 8
1 dyld 0x1041e50cc abort_with_payload_wrapper_internal + 104
2 dyld 0x1041e5100 abort_with_payload + 16
3 dyld 0x1041767f0 dyld4::halt(char const*, dyld4::StructuredError const*) + 304
4 dyld 0x1041732ec dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3888
5 dyld 0x104171ef4 start + 1868
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000006 x1: 0x0000000000000004 x2: 0x000000016bdd2810 x3: 0x0000000000000172
x4: 0x000000016bdd2410 x5: 0x0000000000000000 x6: 0x000000016bdd1400 x7: 0x000000016bdd1460
x8: 0x0000000000000020 x9: 0x000000016bdd237c x10: 0x000000000000000a x11: 0x0000000000000000
x12: 0x0000000000000038 x13: 0x0000000000000000 x14: 0x0000000188e77f9d x15: 0x0000000000008000
x16: 0x0000000000000209 x17: 0x000000010416f37c x18: 0x0000000000000000 x19: 0x0000000000000000
x20: 0x000000016bdd2410 x21: 0x0000000000000172 x22: 0x000000016bdd2810 x23: 0x0000000000000004
x24: 0x0000000000000006 x25: 0x00000000000000a8 x26: 0x000000016bdd32d8 x27: 0x000000010405e090
x28: 0x0000000000000001 fp: 0x000000016bdd23e0 lr: 0x00000001041e50cc
sp: 0x000000016bdd23a0 pc: 0x00000001041da4c8 cpsr: 0x80001000
far: 0x0000000000000000 esr: 0x56000080 Address size fault
Binary Images:
0x10416c000 - 0x1041f7fff dyld (*) <4fe051cf-29dc-3f02-890b-33144fa09253> /usr/lib/dyld
0x10402c000 - 0x10403ffff com.asix.dext.pciedevice (0.1.6) <ece57abf-0633-3c3b-8427-fb25cc706343> /Library/SystemExtensions/*/com.asix.dext.pciedevice
0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=8612K resident=0K(0%) swapped_out_or_unallocated=8612K(100%)
Writable regions: Total=12.2M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=12.2M(100%)
Is it expected that this should work? Is this a known issue? Is there any workaround for it?
Should I file feedback or a DTS?
Hi everyone,
I was following the Video Modernize PCI and SCSI drivers with DriverKit and the Document to implement UserMapHBAData(), and here’s my current implementation:
// kern_return_t DRV_MAIN_CLASS_NAME::UserMapHBAData_Impl(uint32_t *uniqueTaskID)
kern_return_t IMPL(DRV_MAIN_CLASS_NAME, UserMapHBAData)
{
Log("UserMapHBAData() - Start");
// Define the vm_page_size explicitly
const uint32_t vm_page_size = 4096;
kern_return_t ret;
IOBufferMemoryDescriptor *buffer = nullptr;
IOMemoryMap *memMap = nullptr;
void *taskData = nullptr;
// Create a buffer for HBA-specific task data
ret = IOBufferMemoryDescriptor::Create(kIOMemoryDirectionOutIn, ivars->fTaskDataSize, vm_page_size, &buffer);
__Require((kIOReturnSuccess == ret), Exit);
// Map memory to the driver extension's memory space
ret = buffer->CreateMapping(0, 0, 0, 0, 0, &memMap);
__Require((kIOReturnSuccess == ret), Exit);
// Retrieve mapped memory address
taskData = reinterpret_cast<void *>(memMap->GetAddress());
__Require(taskData, Exit);
// WARNING: Potential leak of an object stored into 'buffer'
// WARNING: Potential leak of an object stored into 'memMap'
// Assign a unique task ID
ivars->fTaskID++; // ERROR: No member named 'fTaskID' in 'DriverKitAcxxx_IVars'
ivars->fTaskArray[ivars->fTaskID] = taskData;
*uniqueTaskID = ivars->fTaskID;
Log("UserMapHBAData() - End");
return kIOReturnSuccess;
Exit:
// Cleanup in case of failure
if (memMap) {
memMap->free(); // Correct method for releasing memory maps
}
if (buffer) {
buffer->free(); // Correct method for releasing buffer memory
}
LogErr("ret = 0x%0x", ret);
Log("UserMapHBAData() - End");
return ret;
}
For reference, in KEXT, memory allocation is typically done using:
IOBufferMemoryDescriptor *buffer = IOBufferMemoryDescriptor::inTaskWithOptions(
kernel_task, // Task in which memory is allocated
kIODirectionOutIn, // Direction (read/write)
1024, // Size of the buffer in bytes
4); // Alignment requirements
However, after installing the dext, macOS hangs, and I have to do a hardware reset. After rebooting, the sysctl list output shows:
% sectl list
1 extension(s)
--- com.apple.system_extension.driver_extension
enabled active teamID bundleID (version) name [state]
* - com.accusys.DriverKitAcxxx (5.0/11) com.accusys.DriverKitAcxxx [activated waiting for user]
Questions:
What could be causing macOS to halt?
How should I approach debugging and resolving this issue?
Looking forward to your insights, any suggestions would be greatly appreciated!
Best regards, Charles
Hello everyone.
I have been developing PCIe device driver through Thunderbolt.
However, it was confirmed that up to three devices connected to the daisy chain worked normally,
but the fourth device failed to operate the _CopyDeviceMemoryWithIndex() function for connection with the BAR0 App and did not work properly.
The standard specification of Thunderbolt 3/4 is said to be supported by daisy chain connection up to 6-device,
but in reality, it is only 3 units,
so I ask the forum for technical confirmation.
Of course total 4 device by 2-port x 2-device daisy chain connecting has working well.
The PCI entry in System information indicates that all devices have normal load of the PCIe device driver.
Thank you.
Hello everyone
I have been developing PCIe device driver through Thunderbolt. However, it was confirmed that up to three devices connected to the daisy chain worked normally, but the fourth device failed to operate the _CopyDeviceMemoryWithIndex() function for connection with the BAR0 App and did not work properly.
The standard specification of Thunderbolt 3/4 is said to be supported by daisy chain connection up to 6 units, but in reality, it is only 3 units, so I ask the forum for technical confirmation.
Of course total 4 device by 2-port x 2-device daisy chain connecting has working well.
And the PCI entry in System information app indicates that all devices have normal load of the PCIe device driver.
I am trying to build a release for an application that installs a DriverKit driver. I created a Developer ID Application Profile with a valid certificate but I'm coming across this error in Xcode 16.3 that is preventing me from archiving:
Xcode 14 and later requires a DriverKit development profile enabled for iOS and macOS. Visit the developer website to create or download a DriverKit profile.
I thought I needed a Dev ID Application profile to distribute the application and that a Development profile is for testing. Is there something I'm missing?