aflawrence / macUSPCIO

Mac IOPCIDevice driver that exposes PCI devices for User Space IO

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

macUSPCIO

This driver (kext) is built using IOKit to allow communication between a user space application and the IO Space of a PCI Device. The driver is intended as an aid in writing other drivers in user space first where it is easier to debug and test before converting to kernel space. Apple's new DriverKit provides similar benefits but does not yet expose all functionalities available in IOKit.

The driver can be configured to match with any pci device specified in the info.plist -> IOKitPersonalities -> macUSPCIO -> IOPCIClassMatch (or any other matching property)

see: https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/IOKitFundamentals/Matching/Matching.html for more info on driver matching.

Current code and release build are set to match with IOPCIClass = 0c050000&0xffffff00 for matching with the Intel I801 controller

Installation

Method 1 - OpenCore

  • Add driver to OC/Kexts
  • Add the following driver entry to your config.plist under Kernal->Add or use the snapshot function (Cmd+R) in ProperTree
	<dict>
		<key>BundlePath</key>
		<string>macUSPCIO.kext</string>
		<key>Comment</key>
		<string>macUSPCIO.kext</string>
		<key>Enabled</key>
		<true/>
		<key>ExecutablePath</key>
		<string>Contents/MacOS/macUSPCIO</string>
		<key>Arch</key>
		<string>Any</string>
		<key>MaxKernel</key>
		<string></string>
		<key>MinKernel</key>
		<string></string>
		<key>PlistPath</key>
		<string>Contents/Info.plist</string>
	</dict>

Method 2 - Manual (not Recommended)

  • SIP must be disabled (or at least the driver signing feature)
  • set .kext ownership to 0:0 (sudo chown -R 0:0 ./macUSPCIO.kext)
  • run sudo kextload ./macUSPCIO.kext

Supports macOS 10.15+

Security Concern

This driver exposes internal pci devices to free user space access. This may pose a security risk so use with caution. I am not responsible if you brick your device.

References

With the release of Apple's new DriverKit, information on writing IOKit drivers is extremely sparse and outdated. The following resources were very helpful

About

Mac IOPCIDevice driver that exposes PCI devices for User Space IO

License:GNU General Public License v3.0


Languages

Language:C++ 79.1%Language:C 20.9%