├── English.lproj
└── InfoPlist.strings
├── Info.plist
├── NullCPUPowerManagement.cpp
├── NullCPUPowerManagement.h
├── NullCPUPowerManagement.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── corp.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
└── xcuserdata
│ └── corp.xcuserdatad
│ └── xcschemes
│ └── xcschememanagement.plist
└── README.md
/English.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/corpnewt/NullCPUPowerManagement/525f7da6aeb7cd3716378663cecec21f5e4cc273/English.lproj/InfoPlist.strings
--------------------------------------------------------------------------------
/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleName
10 | ${PRODUCT_NAME}
11 | CFBundleIconFile
12 |
13 | CFBundleIdentifier
14 | ${MODULE_NAME}
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundlePackageType
18 | KEXT
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${MODULE_VERSION}
23 | IOKitPersonalities
24 |
25 | IntelCPUPowerManagement
26 |
27 | CFBundleIdentifier
28 | ${MODULE_NAME}
29 | IOClass
30 | NullCPUPowerManagement
31 | IOMatchCategory
32 | AppleIntelCPUPowerManagement
33 | IOProviderClass
34 | IOResources
35 | IOResourceMatch
36 | IOKit
37 |
38 | IOProbeScore
39 | 100
40 |
41 |
42 | OSBundleLibraries
43 |
44 | com.apple.kpi.iokit
45 | 8.0.0
46 | com.apple.kpi.libkern
47 | 8.0.0
48 | com.apple.kpi.unsupported
49 | 8.0.0
50 |
51 |
55 | OSBundleRequired
56 | Root
57 |
58 |
59 |
--------------------------------------------------------------------------------
/NullCPUPowerManagement.cpp:
--------------------------------------------------------------------------------
1 | /*! @file NullCPUPowerManagement.h
2 | @copyright David Elliott
3 | @created 2007-11-26
4 | @rcsid $Id: NullCPUPowerManagement.cpp 10 2008-06-29 19:34:05Z dfe $
5 | */
6 |
7 | #include "NullCPUPowerManagement.h"
8 |
9 | #include
10 | OSDefineMetaClassAndStructors(NullCPUPowerManagement, IOService);
11 |
12 | #if 0
13 |
14 | #define bit(n) (1ULL << (n))
15 | #define bitmask(h,l) ((bit(h)|(bit(h)-1)) & ~(bit(l)-1))
16 | #define bitfield(x,h,l) (((x) & bitmask(h,l)) >> l)
17 |
18 | /*
19 | * Memory mapped registers for the HPET
20 | */
21 | typedef struct hpetReg {
22 | uint64_t GCAP_ID; /* General capabilities */
23 | uint64_t rsv1;
24 | uint64_t GEN_CONF; /* General configuration */
25 | uint64_t rsv2;
26 | uint64_t GINTR_STA; /* General Interrupt status */
27 | uint64_t rsv3[25];
28 | uint64_t MAIN_CNT; /* Main counter */
29 | uint64_t rsv4;
30 | uint64_t TIM0_CONF; /* Timer 0 config and cap */
31 | #define TIM_CONF 0
32 | #define Tn_INT_ENB_CNF 4
33 | uint64_t TIM0_COMP; /* Timer 0 comparator */
34 | #define TIM_COMP 8
35 | uint64_t rsv5[2];
36 | uint64_t TIM1_CONF; /* Timer 1 config and cap */
37 | uint64_t TIM1_COMP; /* Timer 1 comparator */
38 | uint64_t rsv6[2];
39 | uint64_t TIM2_CONF; /* Timer 2 config and cap */
40 | uint64_t TIM2_COMP; /* Timer 2 comparator */
41 | uint64_t rsv7[2];
42 | } hpetReg;
43 | typedef struct hpetReg hpetReg_t;
44 |
45 | struct hpetInfo
46 | {
47 | uint64_t hpetCvtt2n;
48 | uint64_t hpetCvtn2t;
49 | uint64_t tsc2hpet;
50 | uint64_t hpet2tsc;
51 | uint64_t bus2hpet;
52 | uint64_t hpet2bus;
53 | uint32_t rcbaArea;
54 | uint32_t rcbaAreap;
55 | };
56 | typedef struct hpetInfo hpetInfo_t;
57 |
58 | #define hpetAddr 0xFED00000
59 | #define hptcAE 0x80
60 |
61 | extern "C" void hpet_get_info(hpetInfo_t *info);
62 |
63 | static inline bool hpetIsInvalid()
64 | {
65 | hpetInfo_t hpetInfo;
66 | hpet_get_info(&hpetInfo);
67 | // The AppleIntelCPUPowerManagement will crash if rcbaArea and/or HPET is NULL
68 | // Ordinarily this can never happen but modified xnu can allow for this.
69 | if(hpetInfo.rcbaArea == 0)
70 | {
71 | IOLog("Forcing takeover of AppleIntelCPUPowerManagement resource due to lack of RCBA (no LPC?)\n");
72 | return true;
73 | }
74 | // Another case is that the LPC exists but the HPET isn't really valid.
75 | // That is to say that virtual hardware provides enough to get past xnu startup
76 | // but not enough to really make the HPET work.
77 |
78 | uint32_t hptc = *(uint32_t*)(hpetInfo.rcbaArea + 0x3404);
79 | if(!(hptc & hptcAE))
80 | {
81 | IOLog("Forcing takeover of AppleIntelCPUPowerManagement resource because HPET is not enabled\n");
82 | return true;
83 | }
84 | // Use the RCBA's HPTC to determine which of the four possible HPET physical addresses is used
85 | uint32_t hpetAreap = hpetAddr | ((hptc & 3) << 12);
86 | IOMemoryDescriptor *hpetMemDesc = IOMemoryDescriptor::withPhysicalAddress(hpetAreap, sizeof(hpetReg_t), kIODirectionIn);
87 |
88 | // grab the GCAP_ID (note offset is actually 0)
89 | uint64_t GCAP_ID;
90 | hpetMemDesc->readBytes(offsetof(hpetReg_t, GCAP_ID), &GCAP_ID, sizeof(GCAP_ID));
91 |
92 | // We're done with the memory descriptor now, so release it
93 | hpetMemDesc->release();
94 | hpetMemDesc = NULL;
95 |
96 | // Extract the VENDOR_ID_CAP field from the GCAP_ID and test it
97 | uint16_t vendorId = bitfield(GCAP_ID, 31, 16);
98 | if( (vendorId == 0x0000) || (vendorId == 0xffff))
99 | {
100 | IOLog("Forcing takeover of AppleIntelCPUPowerManagement resource due to bad HPET VENDOR_ID_CAP\n");
101 | return true;
102 | }
103 | else if(vendorId != 0x8086)
104 | {
105 | IOLog("WARNING: HPET is not Intel. Going ahead and allowing AppleIntelCPUPowerManagement to start but beware it may behave strangely\n");
106 | }
107 | return false;
108 | }
109 | #endif
110 |
111 | bool NullCPUPowerManagement::init(OSDictionary *properties)
112 | {
113 | IOLog("NullCPUPowerManagement::init: properties=%p\n", properties);
114 | OSObject *matchCategoryValue;
115 | if(properties != NULL)
116 | {
117 | matchCategoryValue = properties->getObject(gIOMatchCategoryKey);
118 | }
119 | else
120 | matchCategoryValue = NULL;
121 |
122 | // Do the normal superclass init
123 | if(!IOService::init(properties))
124 | return false;
125 |
126 | if(matchCategoryValue != NULL)
127 | {
128 | // This is the secret sauce that causes this kext to become a valid potential
129 | // The trick is to set the name to the value of gIOMatchCategoryKey
130 |
131 | OSSymbol const *classNameToDisable = OSDynamicCast(OSSymbol, matchCategoryValue);
132 | if(classNameToDisable != NULL)
133 | {
134 | classNameToDisable->retain(); // retain
135 | }
136 | else
137 | {
138 | OSString *stringClassName = OSDynamicCast(OSString, matchCategoryValue);
139 | if(stringClassName != NULL)
140 | classNameToDisable = OSSymbol::withString(stringClassName); // retain (other path)
141 | }
142 |
143 | if(classNameToDisable != NULL)
144 | {
145 | setName(classNameToDisable, NULL /* All planes */);
146 | classNameToDisable->release(); // release either the retain or the withString call.
147 | }
148 | else
149 | IOLog("NullCPUPowerManagement::init: Failed to cast the IOMatchCategory value to something string-like\n");
150 | }
151 | else
152 | IOLog("NullCPUPowerManagement::init: Failed to retrieve IOMatchCategory from properties\n");
153 |
154 | // Succeed init in all cases
155 | return true;
156 | }
157 |
158 | IOService *NullCPUPowerManagement::probe(IOService *provider, SInt32 *score)
159 | {
160 | if(IOService::probe(provider, score) == NULL)
161 | return NULL;
162 | #if 0
163 | // If the hpet's invalid then succeed probe
164 | if(hpetIsInvalid())
165 | {
166 | IOLog("NullCPUPowerManagement::probe: Claiming match category with probe score %ld.\n", score!=NULL?*score:-1);
167 | return this;
168 | }
169 | #endif
170 | char crap[20];
171 | if(PE_parse_boot_argn("-allowAppleCPUPM", crap, sizeof(crap)))
172 | {
173 | IOLog("NullCPUPowerManagement is respecting the -allowAppleCPUPM flag.\n");
174 | return NULL;
175 | }
176 | // Always succeed until we can figure out a better way of detecting a valid HPET.
177 | return this;
178 | }
179 |
180 | bool NullCPUPowerManagement::start(IOService *provider)
181 | {
182 | IOLog("NullCPUPowerManagement::start\n");
183 | return IOService::start(provider);
184 | }
185 |
186 | void NullCPUPowerManagement::stop(IOService *provider)
187 | {
188 | IOLog("NullCPUPowerManagement::stop\n");
189 | return IOService::stop(provider);
190 | }
191 |
--------------------------------------------------------------------------------
/NullCPUPowerManagement.h:
--------------------------------------------------------------------------------
1 | /*! @file NullCPUPowerManagement.h
2 | @copyright David Elliott
3 | @created 2007-11-26
4 | @rcsid $Id: NullCPUPowerManagement.h 5 2008-06-29 06:08:01Z dfe $
5 | */
6 |
7 | #include
8 |
9 | class NullCPUPowerManagement: public IOService
10 | {
11 | OSDeclareDefaultStructors(NullCPUPowerManagement);
12 | public:
13 | /*!
14 | Overridden to change the nub name in all planes from the class name to
15 | the value of the IOMatchCategory key in the personality dictionary.
16 |
17 | This works around a check in the kernel which refuses to consider
18 | an IOResources match where the nub name does not match the category.
19 | */
20 | virtual bool init(OSDictionary *properties = 0);
21 |
22 | /*!
23 | Overriden to determine whether or not this service should start and thus
24 | push out the real AppleIntelCPUPowerManagement service.
25 | */
26 | virtual IOService *probe(IOService *provider, SInt32 *score);
27 |
28 | virtual bool start(IOService *provider);
29 | virtual void stop(IOService *provider);
30 | protected:
31 | };
32 |
--------------------------------------------------------------------------------
/NullCPUPowerManagement.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 44;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 32D94FC60562CBF700B6AF17 /* NullCPUPowerManagement.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A224C3EFF42367911CA2CB7 /* NullCPUPowerManagement.h */; };
11 | 32D94FC80562CBF700B6AF17 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; };
12 | 32D94FCA0562CBF700B6AF17 /* NullCPUPowerManagement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A224C3FFF42367911CA2CB7 /* NullCPUPowerManagement.cpp */; settings = {ATTRIBUTES = (); }; };
13 | /* End PBXBuildFile section */
14 |
15 | /* Begin PBXFileReference section */
16 | 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; };
17 | 1A224C3EFF42367911CA2CB7 /* NullCPUPowerManagement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NullCPUPowerManagement.h; sourceTree = ""; };
18 | 1A224C3FFF42367911CA2CB7 /* NullCPUPowerManagement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NullCPUPowerManagement.cpp; sourceTree = ""; };
19 | 32D94FCF0562CBF700B6AF17 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
20 | 32D94FD00562CBF700B6AF17 /* NullCPUPowerManagement.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NullCPUPowerManagement.kext; sourceTree = BUILT_PRODUCTS_DIR; };
21 | 8DA8362C06AD9B9200E5AC22 /* Kernel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kernel.framework; path = /System/Library/Frameworks/Kernel.framework; sourceTree = ""; };
22 | /* End PBXFileReference section */
23 |
24 | /* Begin PBXFrameworksBuildPhase section */
25 | 32D94FCB0562CBF700B6AF17 /* Frameworks */ = {
26 | isa = PBXFrameworksBuildPhase;
27 | buildActionMask = 2147483647;
28 | files = (
29 | );
30 | runOnlyForDeploymentPostprocessing = 0;
31 | };
32 | /* End PBXFrameworksBuildPhase section */
33 |
34 | /* Begin PBXGroup section */
35 | 089C166AFE841209C02AAC07 /* NullCPUPowerManagement */ = {
36 | isa = PBXGroup;
37 | children = (
38 | 247142CAFF3F8F9811CA285C /* Source */,
39 | 8DA8362C06AD9B9200E5AC22 /* Kernel.framework */,
40 | 089C167CFE841241C02AAC07 /* Resources */,
41 | 19C28FB6FE9D52B211CA2CBB /* Products */,
42 | );
43 | name = NullCPUPowerManagement;
44 | sourceTree = "";
45 | };
46 | 089C167CFE841241C02AAC07 /* Resources */ = {
47 | isa = PBXGroup;
48 | children = (
49 | 32D94FCF0562CBF700B6AF17 /* Info.plist */,
50 | 089C167DFE841241C02AAC07 /* InfoPlist.strings */,
51 | );
52 | name = Resources;
53 | sourceTree = "";
54 | };
55 | 19C28FB6FE9D52B211CA2CBB /* Products */ = {
56 | isa = PBXGroup;
57 | children = (
58 | 32D94FD00562CBF700B6AF17 /* NullCPUPowerManagement.kext */,
59 | );
60 | name = Products;
61 | sourceTree = "";
62 | };
63 | 247142CAFF3F8F9811CA285C /* Source */ = {
64 | isa = PBXGroup;
65 | children = (
66 | 1A224C3EFF42367911CA2CB7 /* NullCPUPowerManagement.h */,
67 | 1A224C3FFF42367911CA2CB7 /* NullCPUPowerManagement.cpp */,
68 | );
69 | name = Source;
70 | sourceTree = "";
71 | };
72 | /* End PBXGroup section */
73 |
74 | /* Begin PBXHeadersBuildPhase section */
75 | 32D94FC50562CBF700B6AF17 /* Headers */ = {
76 | isa = PBXHeadersBuildPhase;
77 | buildActionMask = 2147483647;
78 | files = (
79 | 32D94FC60562CBF700B6AF17 /* NullCPUPowerManagement.h in Headers */,
80 | );
81 | runOnlyForDeploymentPostprocessing = 0;
82 | };
83 | /* End PBXHeadersBuildPhase section */
84 |
85 | /* Begin PBXNativeTarget section */
86 | 32D94FC30562CBF700B6AF17 /* NullCPUPowerManagement */ = {
87 | isa = PBXNativeTarget;
88 | buildConfigurationList = 1DEB91D908733DB10010E9CD /* Build configuration list for PBXNativeTarget "NullCPUPowerManagement" */;
89 | buildPhases = (
90 | 32D94FC50562CBF700B6AF17 /* Headers */,
91 | 32D94FC70562CBF700B6AF17 /* Resources */,
92 | 32D94FC90562CBF700B6AF17 /* Sources */,
93 | 32D94FCB0562CBF700B6AF17 /* Frameworks */,
94 | 32D94FCC0562CBF700B6AF17 /* Rez */,
95 | );
96 | buildRules = (
97 | );
98 | dependencies = (
99 | );
100 | name = NullCPUPowerManagement;
101 | productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Extensions";
102 | productName = NullCPUPowerManagement;
103 | productReference = 32D94FD00562CBF700B6AF17 /* NullCPUPowerManagement.kext */;
104 | productType = "com.apple.product-type.kernel-extension.iokit";
105 | };
106 | /* End PBXNativeTarget section */
107 |
108 | /* Begin PBXProject section */
109 | 089C1669FE841209C02AAC07 /* Project object */ = {
110 | isa = PBXProject;
111 | buildConfigurationList = 1DEB91DD08733DB10010E9CD /* Build configuration list for PBXProject "NullCPUPowerManagement" */;
112 | compatibilityVersion = "Xcode 3.0";
113 | hasScannedForEncodings = 1;
114 | mainGroup = 089C166AFE841209C02AAC07 /* NullCPUPowerManagement */;
115 | projectDirPath = "";
116 | projectRoot = "";
117 | targets = (
118 | 32D94FC30562CBF700B6AF17 /* NullCPUPowerManagement */,
119 | );
120 | };
121 | /* End PBXProject section */
122 |
123 | /* Begin PBXResourcesBuildPhase section */
124 | 32D94FC70562CBF700B6AF17 /* Resources */ = {
125 | isa = PBXResourcesBuildPhase;
126 | buildActionMask = 2147483647;
127 | files = (
128 | 32D94FC80562CBF700B6AF17 /* InfoPlist.strings in Resources */,
129 | );
130 | runOnlyForDeploymentPostprocessing = 0;
131 | };
132 | /* End PBXResourcesBuildPhase section */
133 |
134 | /* Begin PBXRezBuildPhase section */
135 | 32D94FCC0562CBF700B6AF17 /* Rez */ = {
136 | isa = PBXRezBuildPhase;
137 | buildActionMask = 2147483647;
138 | files = (
139 | );
140 | runOnlyForDeploymentPostprocessing = 0;
141 | };
142 | /* End PBXRezBuildPhase section */
143 |
144 | /* Begin PBXSourcesBuildPhase section */
145 | 32D94FC90562CBF700B6AF17 /* Sources */ = {
146 | isa = PBXSourcesBuildPhase;
147 | buildActionMask = 2147483647;
148 | files = (
149 | 32D94FCA0562CBF700B6AF17 /* NullCPUPowerManagement.cpp in Sources */,
150 | );
151 | runOnlyForDeploymentPostprocessing = 0;
152 | };
153 | /* End PBXSourcesBuildPhase section */
154 |
155 | /* Begin PBXVariantGroup section */
156 | 089C167DFE841241C02AAC07 /* InfoPlist.strings */ = {
157 | isa = PBXVariantGroup;
158 | children = (
159 | 089C167EFE841241C02AAC07 /* English */,
160 | );
161 | name = InfoPlist.strings;
162 | sourceTree = "";
163 | };
164 | /* End PBXVariantGroup section */
165 |
166 | /* Begin XCBuildConfiguration section */
167 | 1DEB91DA08733DB10010E9CD /* Debug */ = {
168 | isa = XCBuildConfiguration;
169 | buildSettings = {
170 | COPY_PHASE_STRIP = NO;
171 | CURRENT_PROJECT_VERSION = 1.0.0d1;
172 | GCC_DYNAMIC_NO_PIC = NO;
173 | GCC_MODEL_TUNING = G5;
174 | GCC_OPTIMIZATION_LEVEL = 0;
175 | INFOPLIST_FILE = Info.plist;
176 | INFOPLIST_PREPROCESS = YES;
177 | INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions";
178 | MODULE_NAME = org.tgwbd.driver.NullCPUPowerManagement;
179 | MODULE_VERSION = 1.0.0d2;
180 | PRODUCT_NAME = NullCPUPowerManagement;
181 | WRAPPER_EXTENSION = kext;
182 | };
183 | name = Debug;
184 | };
185 | 1DEB91DB08733DB10010E9CD /* Release */ = {
186 | isa = XCBuildConfiguration;
187 | buildSettings = {
188 | CURRENT_PROJECT_VERSION = 1.0.0d1;
189 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
190 | GCC_MODEL_TUNING = G5;
191 | INFOPLIST_FILE = Info.plist;
192 | INFOPLIST_PREPROCESS = YES;
193 | INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions";
194 | MODULE_NAME = org.tgwbd.driver.NullCPUPowerManagement;
195 | MODULE_VERSION = 1.0.0d2;
196 | PRODUCT_NAME = NullCPUPowerManagement;
197 | WRAPPER_EXTENSION = kext;
198 | };
199 | name = Release;
200 | };
201 | 1DEB91DE08733DB10010E9CD /* Debug */ = {
202 | isa = XCBuildConfiguration;
203 | buildSettings = {
204 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
205 | GCC_WARN_UNUSED_VARIABLE = YES;
206 | PREBINDING = NO;
207 | SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
208 | };
209 | name = Debug;
210 | };
211 | 1DEB91DF08733DB10010E9CD /* Release */ = {
212 | isa = XCBuildConfiguration;
213 | buildSettings = {
214 | ARCHS = (
215 | ppc,
216 | i386,
217 | );
218 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
219 | GCC_WARN_UNUSED_VARIABLE = YES;
220 | PREBINDING = NO;
221 | SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
222 | };
223 | name = Release;
224 | };
225 | /* End XCBuildConfiguration section */
226 |
227 | /* Begin XCConfigurationList section */
228 | 1DEB91D908733DB10010E9CD /* Build configuration list for PBXNativeTarget "NullCPUPowerManagement" */ = {
229 | isa = XCConfigurationList;
230 | buildConfigurations = (
231 | 1DEB91DA08733DB10010E9CD /* Debug */,
232 | 1DEB91DB08733DB10010E9CD /* Release */,
233 | );
234 | defaultConfigurationIsVisible = 0;
235 | defaultConfigurationName = Release;
236 | };
237 | 1DEB91DD08733DB10010E9CD /* Build configuration list for PBXProject "NullCPUPowerManagement" */ = {
238 | isa = XCConfigurationList;
239 | buildConfigurations = (
240 | 1DEB91DE08733DB10010E9CD /* Debug */,
241 | 1DEB91DF08733DB10010E9CD /* Release */,
242 | );
243 | defaultConfigurationIsVisible = 0;
244 | defaultConfigurationName = Release;
245 | };
246 | /* End XCConfigurationList section */
247 | };
248 | rootObject = 089C1669FE841209C02AAC07 /* Project object */;
249 | }
250 |
--------------------------------------------------------------------------------
/NullCPUPowerManagement.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/NullCPUPowerManagement.xcodeproj/project.xcworkspace/xcuserdata/corp.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/corpnewt/NullCPUPowerManagement/525f7da6aeb7cd3716378663cecec21f5e4cc273/NullCPUPowerManagement.xcodeproj/project.xcworkspace/xcuserdata/corp.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/NullCPUPowerManagement.xcodeproj/xcuserdata/corp.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | NullCPUPowerManagement.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # NullCPUPowerManagement
2 | NullCPUPowerManagement.kext tweaked to build on newer setups
3 |
4 | ***
5 |
6 | # Original Sources
7 |
8 | [AppleLife Repo](https://github.com/AppleLife/NullCPUPowerManagement)
9 |
10 | [Original Source](https://tgwbd.org/darwin/extensions.html)
11 |
12 | ***
13 |
14 | # Credits
15 |
16 | * David Elliott for creating it
17 | * [al3xtjames](https://github.com/al3xtjames) for code updates
18 |
19 | ***
20 |
21 | NullCPUPowerManagement
22 | ======================
23 |
24 | Another problem for OS X running on non-Apple hardware (virtual or otherwise) is the AppleIntelCPUPowerManagement kernel extension which tends to either panic the machine or spew endless debug messages to the console regarding the HPET and its relationship to the CPU.
25 |
26 | In a virtual environment there is really no need for the guest OS to change processor C states. The built-in code which simply issues a halt instruction is sufficient. Furthermore, the virtualizer may wish to implement only enough of the HPET to get past the xnu startup routines without actually making the HPET work.
27 |
28 | Therefore I have written the NullCPUPowerManagement extension. What it does is play a couple of tricks with the IOKit service registration process to ensure it takes over the AppleIntelCPUPowerManagement match category on its IOResources provider nub. The trick is that any nub matching on the IOResources nub must have a nub name identical to the value of its IOMatchCategory property. The nub name is by default the value of its IOClass property which must be its C++ class name and ought not to be AppleIntelCPUPowerManagement. Why not? Because the kernel cannot load two C++ classes with the same name. When this occurs, one or the other will win. In the best case, our copy would win. But in the worst case the real AppleIntelCPUPowerManagement wins and thus loads and wreaks havoc which is exactly what we are trying to avoid.
29 |
30 | Therefore we use our own C++ class name but then from the init method we retrieve the value of the IOMatchCategory key and call setName to set the nub name to match. Combined with a probe score of 100 we guarantee that our provider (IOResources) will choose us over Apple's kext. Ideally we would implement an active probe method that did some checking to see if the system is capable of using AppleIntelCPUPowerManagement. Unfortunately it's hard to know exactly what conditions must be met. Therefore, this version (r11) always succeeds its probe unless you pass -allowAppleCPUPM on the command-line in which case it will fail its probe which allows AppleIntelCPUPowerManagement to attach.
31 |
32 | The option isn't guaranteed to stay around, it's more for debugging purposes so you can keep the NullCPUPowerManagement kext in your Extensions folder while you play around trying to make Apple's CPU PM work. In case you don't get it right you can simply remove the -allowAppleCPUPM from your boot flags and you'll still be able to boot your system.
33 |
--------------------------------------------------------------------------------