Skip to content

Commit

Permalink
Dropped broken AppleIntelMCEReporter prevention support
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed Dec 4, 2019
1 parent 083471c commit 6ca4473
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 28 deletions.
6 changes: 3 additions & 3 deletions CPUFriend.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
1C748C1E1C21952C0024EED2 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1100;
LastUpgradeCheck = 1120;
ORGANIZATIONNAME = Vanilla;
TargetAttributes = {
1C748C261C21952C0024EED2 = {
Expand Down Expand Up @@ -342,7 +342,7 @@
MODULE_NAME = org.vanilla.driver.CPUFriend;
MODULE_START = "$(PRODUCT_NAME)_kern_start";
MODULE_STOP = "$(PRODUCT_NAME)_kern_stop";
MODULE_VERSION = 1.1.9;
MODULE_VERSION = 1.2.0;
OTHER_CFLAGS = (
"-mmmx",
"-msse",
Expand Down Expand Up @@ -388,7 +388,7 @@
MODULE_NAME = org.vanilla.driver.CPUFriend;
MODULE_START = "$(PRODUCT_NAME)_kern_start";
MODULE_STOP = "$(PRODUCT_NAME)_kern_stop";
MODULE_VERSION = 1.1.9;
MODULE_VERSION = 1.2.0;
OTHER_CFLAGS = (
"-mmmx",
"-msse",
Expand Down
21 changes: 0 additions & 21 deletions CPUFriend/CPUFriend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,15 @@

static const char *kextACPISMC[] { "/System/Library/Extensions/IOPlatformPluginFamily.kext/Contents/PlugIns/ACPI_SMC_PlatformPlugin.kext/Contents/MacOS/ACPI_SMC_PlatformPlugin" };
static const char *kextX86PP[] { "/System/Library/Extensions/IOPlatformPluginFamily.kext/Contents/PlugIns/X86PlatformPlugin.kext/Contents/MacOS/X86PlatformPlugin" };
static const char *kextMCEReporter[] { "/System/Library/Extensions/AppleIntelMCEReporter.kext/Contents/MacOS/AppleIntelMCEReporter" };

enum : size_t {
KextACPISMC,
KextX86PP,
KextMCEReporter
};

static KernelPatcher::KextInfo kextList[] {
{ "com.apple.driver.ACPI_SMC_PlatformPlugin", kextACPISMC, arrsize(kextACPISMC), {}, {}, KernelPatcher::KextInfo::Unloaded },
{ "com.apple.driver.X86PlatformPlugin", kextX86PP, arrsize(kextX86PP), {}, {}, KernelPatcher::KextInfo::Unloaded },
{ "com.apple.driver.AppleIntelMCEReporter", kextMCEReporter, arrsize(kextMCEReporter), {}, {}, KernelPatcher::KextInfo::Unloaded }
};

static constexpr size_t kextListSize = arrsize(kextList);
Expand Down Expand Up @@ -116,14 +113,6 @@ void CPUFriendPlugin::myX86PPConfigResourceCallback(uint32_t requestTag, kern_re
FunctionCast(myX86PPConfigResourceCallback, callbackCpuf->orgX86PPConfigLoadCallback)(requestTag, result, resourceData, resourceDataLength, context);
}

IOService *CPUFriendPlugin::myAppleIntelMCEReporterProbe(IOService *, IOService *, SInt32 *)
{
DBGLOG("cpuf", "killing AppleIntelMCEReporter");

// always return nullptr for prevention of AppleIntelMCEReporter.
return nullptr;
}

void CPUFriendPlugin::processKext(KernelPatcher &patcher, size_t index, mach_vm_address_t address, size_t size)
{
if (kextList[KextACPISMC].loadIndex == index) {
Expand All @@ -143,14 +132,4 @@ void CPUFriendPlugin::processKext(KernelPatcher &patcher, size_t index, mach_vm_
);
patcher.routeMultiple(index, &request, 1, address, size);
}

if (kextList[KextMCEReporter].loadIndex == index) {
DBGLOG("cpuf", "patching AppleIntelMCEReporter");
KernelPatcher::RouteRequest request(
"__ZN21AppleIntelMCEReporter5probeEP9IOServicePi",
myAppleIntelMCEReporterProbe
);
patcher.routeMultiple(index, &request, 1, address, size);
}

}
1 change: 0 additions & 1 deletion CPUFriend/CPUFriend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class CPUFriendPlugin {
*/
static void myACPISMCConfigResourceCallback(uint32_t requestTag, kern_return_t result, const void *resourceData, uint32_t resourceDataLength, void *context);
static void myX86PPConfigResourceCallback(uint32_t requestTag, kern_return_t result, const void *resourceData, uint32_t resourceDataLength, void *context);
static IOService *myAppleIntelMCEReporterProbe(IOService *, IOService *, SInt32 *);

/**
* Patch kext if needed and prepare other patches
Expand Down
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
CPUFriend Changelog
===================
#### v1.2.0
- Dropped broken AppleIntelMCEReporter prevention support

#### v1.1.9
- Unified release archive names
- Added support for prevention of AppleIntelMCEReporter, details can be found [here](https://github.com/acidanthera/bugtracker/issues/424#issuecomment-512596034)
Expand Down
3 changes: 1 addition & 2 deletions Instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Add `-cpufbeta` to enable CPUFriend on unsupported OS versions.

#### Technical background
- Function `configResourceCallback()` from `ACPI_SMC_PlatformPlugin` or `X86PlatformPlugin` is hooked for CPU power management data customization, nothing will be handled without data received from user.
- Function `AppleIntelMCEReporter::probe()` is hooked for prevention of AppleIntelMCEReporter, enabled mandatorily at the moment.

#### Configuration
Use `Tools/ResourceConverter.sh` to generate a working copy of either `CPUFriendDataProvider.kext` (Convenience preferred) or `ssdt_data.dsl` (Performance preferred).
Expand All @@ -32,7 +31,7 @@ Where there is another SSDT generated by [ssdtPRGen.sh](https://github.com/Piker

NOTE:
- The created kext/ssdt is located in the current working directory that can be revealed with `pwd`.
- `file` should be a ***complete plist*** from `Recources` inside `ACPI_SMC_PlatformPlugin` or `X86PlatformPlugin` ***with certain modifications*** (Otherwise why is CPUFriend even required other than the prevention of AppleIntelMCEReporter?) instead of something like a raw `FrequencyVectors` entry.
- `file` should be a ***complete plist*** from `Recources` inside `ACPI_SMC_PlatformPlugin` or `X86PlatformPlugin` ***with certain modifications*** (Otherwise why is CPUFriend even required?) instead of something like a raw `FrequencyVectors` entry.

#### Data Combination
1. Generate a correct copy of `ssdt_data.dsl` with `./ResourceConverter.sh --acpi /path/to/file`.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CPUFriend

[![Build Status](https://travis-ci.com/acidanthera/CPUFriend.svg?branch=master)](https://travis-ci.com/acidanthera/CPUFriend) [![Scan Status](https://scan.coverity.com/projects/16841/badge.svg?flat=1)](https://scan.coverity.com/projects/16841)

A [Lilu](https://github.com/vit9696/Lilu) plug-in for dynamic power management data injection and prevention of AppleIntelMCEReporter, details can be found [here](https://github.com/acidanthera/bugtracker/issues/424#issuecomment-512596034).
A [Lilu](https://github.com/vit9696/Lilu) plug-in for dynamic power management data injection.

#### Notes
This repository should be compiled with latest [Lilu](https://github.com/vit9696/Lilu), otherwise the compilation will fail!
Expand Down

0 comments on commit 6ca4473

Please sign in to comment.