Skip to content

Commit

Permalink
Block the connection of any other drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed May 4, 2021
1 parent 1a652b8 commit ff16c84
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 2 deletions.
11 changes: 11 additions & 0 deletions UEFIGraphicsFB.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
416882EE263E3DD5005A10E2 /* UEFIGraphicsFB.h in Headers */ = {isa = PBXBuildFile; fileRef = 416882ED263E3DD5005A10E2 /* UEFIGraphicsFB.h */; };
416882F0263E3DD5005A10E2 /* UEFIGraphicsFB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 416882EF263E3DD5005A10E2 /* UEFIGraphicsFB.cpp */; };
CEAE89A026404DF40073A6D6 /* libkmod.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CEAE899F26404DF40073A6D6 /* libkmod.a */; };
CEFF7E9526412BB600D6B242 /* DummyGraphics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CEFF7E9326412BB600D6B242 /* DummyGraphics.cpp */; };
CEFF7E9626412BB600D6B242 /* DummyGraphics.h in Headers */ = {isa = PBXBuildFile; fileRef = CEFF7E9426412BB600D6B242 /* DummyGraphics.h */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -18,6 +20,8 @@
416882EF263E3DD5005A10E2 /* UEFIGraphicsFB.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UEFIGraphicsFB.cpp; sourceTree = "<group>"; };
416882F1263E3DD5005A10E2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
CEAE899F26404DF40073A6D6 /* libkmod.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libkmod.a; path = ../Lilu/MacKernelSDK/Library/x86_64/libkmod.a; sourceTree = "<group>"; };
CEFF7E9326412BB600D6B242 /* DummyGraphics.cpp */ = {isa = PBXFileReference; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; path = DummyGraphics.cpp; sourceTree = "<group>"; tabWidth = 2; usesTabs = 0; };
CEFF7E9426412BB600D6B242 /* DummyGraphics.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DummyGraphics.h; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -39,7 +43,10 @@
416882EB263E3DD5005A10E2 /* Products */,
CEAE899E26404DF30073A6D6 /* Frameworks */,
);
indentWidth = 2;
sourceTree = "<group>";
tabWidth = 2;
usesTabs = 0;
};
416882EB263E3DD5005A10E2 /* Products */ = {
isa = PBXGroup;
Expand All @@ -52,6 +59,8 @@
416882EC263E3DD5005A10E2 /* UEFIGraphicsFB */ = {
isa = PBXGroup;
children = (
CEFF7E9426412BB600D6B242 /* DummyGraphics.h */,
CEFF7E9326412BB600D6B242 /* DummyGraphics.cpp */,
416882ED263E3DD5005A10E2 /* UEFIGraphicsFB.h */,
416882EF263E3DD5005A10E2 /* UEFIGraphicsFB.cpp */,
416882F1263E3DD5005A10E2 /* Info.plist */,
Expand All @@ -74,6 +83,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
CEFF7E9626412BB600D6B242 /* DummyGraphics.h in Headers */,
416882EE263E3DD5005A10E2 /* UEFIGraphicsFB.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -168,6 +178,7 @@
buildActionMask = 2147483647;
files = (
416882F0263E3DD5005A10E2 /* UEFIGraphicsFB.cpp in Sources */,
CEFF7E9526412BB600D6B242 /* DummyGraphics.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
29 changes: 29 additions & 0 deletions UEFIGraphicsFB/DummyGraphics.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// DummyGraphics.cpp
// UEFIGraphicsFB
//
// Copyright © 2021 Goldfish64. All rights reserved.
//

#include "DummyGraphics.h"

OSDefineMetaClassAndStructors(DummyGraphics, IOService);

IOService *DummyGraphics::probe(IOService *provider, SInt32 *score) {
if (!IOService::probe(provider, score)) {
return nullptr;
}
return this;
}

bool DummyGraphics::start(IOService *provider) {
// Discard all other drivers as no coexistence is allowed.
if (!IOService::start(provider)) {
return false;
}
return true;
}

void DummyGraphics::stop(IOService *provider) {
IOService::stop(provider);
}
26 changes: 26 additions & 0 deletions UEFIGraphicsFB/DummyGraphics.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// DummyGraphics.h
// UEFIGraphicsFB
//
// Copyright © 2021 Goldfish64. All rights reserved.
//

#ifndef _DUMMY_GRAPHICS_H_
#define _DUMMY_GRAPHICS_H_

#include "UEFIGraphicsFB.h"

class DummyGraphics : public IOService {
OSDeclareDefaultStructors(DummyGraphics);

public:
//
// IOService functions.
//
virtual IOService *probe(IOService *provider, SInt32 *score) APPLE_KEXT_OVERRIDE;
virtual bool start(IOService *provider) APPLE_KEXT_OVERRIDE;
virtual void stop(IOService *provider) APPLE_KEXT_OVERRIDE;

};

#endif /* _DUMMY_GRAPHICS_H_ */
21 changes: 19 additions & 2 deletions UEFIGraphicsFB/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,23 @@
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>IOKitPersonalities</key>
<dict>
<key>DummyGraphics</key>
<dict>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>IOClass</key>
<string>DummyGraphics</string>
<key>IOMatchCategory</key>
<string>IOFramebuffer</string>
<key>IOPCIClassMatch</key>
<string>0x03000000&amp;0xFF000000</string>
<key>IOPCITunnelCompatible</key>
<true/>
<key>IOProbeScore</key>
<integer>100000</integer>
<key>IOProviderClass</key>
<string>IOPCIDevice</string>
</dict>
<key>UEFIGraphicsFB</key>
<dict>
<key>CFBundleIdentifier</key>
Expand All @@ -34,8 +51,8 @@
<string>IOKit</string>
</dict>
</dict>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2021 Goldfish64. All rights reserved.</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2021 Goldfish64. All rights reserved.</string>
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.iokit.IOGraphicsFamily</key>
Expand Down

0 comments on commit ff16c84

Please sign in to comment.