Skip to content

Commit

Permalink
Improve LegacyIOService compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed Jan 7, 2020
1 parent 2183e2a commit d43a05f
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
1 change: 1 addition & 0 deletions KnownPlugins.md
Expand Up @@ -16,6 +16,7 @@ Please note that improperly written immature plugins will not be listed there.
[HibernationFixup](https://github.com/acidanthera/HibernationFixup) | Enable 3 & 25 mode hibernation on certain hardware
[NightShiftUnlocker](https://github.com/Austere-J/NightShiftUnlocker) | Enables Night Shift on all the models
[NoTouchID](https://github.com/al3xtjames/NoTouchID) | Disables Touch ID checks causing hangs
[NVMeFix](https://github.com/acidanthera/NVMeFix) | Improved power management for generic NVMe SSDs
[OpcodeEmulator](https://www.insanelymac.com/forum/topic/329704-opcode-emulator-opemu-plug-in-project/) | Intel Haswell Pentium / Celeron Series Or older processor expansion instruction set Emulation
[RTCMemoryFixup](https://github.com/acidanthera/RTCMemoryFixup) | Offsets in CMOS (RTC) memory emulation
[SystemProfilerMemoryFixup](https://github.com/Goldfish64/SystemProfilerMemoryFixup) | Show memory tab on MacBook models with soldered RAM
Expand Down
54 changes: 53 additions & 1 deletion Lilu/Library/LegacyIOService.h
Expand Up @@ -52,11 +52,13 @@

#include <IOKit/pwr_mgt/IOPMpowerState.h>
#include <IOKit/IOServicePM.h>
#include <IOKit/IOReportTypes.h>

extern "C" {
#include <kern/thread_call.h>
}

#include <Availability.h>
#include "LegacyLibkernMacros.h"

#ifndef UINT64_MAX
Expand Down Expand Up @@ -378,25 +380,75 @@ class IOService : public IORegistryEntry

virtual IOService * copyClientWithCategory( const OSSymbol * category );

public:

#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090

/*! @function configureReport
@abstract configure IOReporting channels
@availability SPI on OS X v10.9 / iOS 7 and later
@param channels - channels to configure
@param action - enable/disable/size, etc
@param result - action-specific returned value
@param destination - action-specific default destination
*/
virtual IOReturn configureReport(IOReportChannelList *channels,
IOReportConfigureAction action,
void *result,
void *destination);

/*! @function updateReport
@abstract request current data for the specified channels
@availability SPI on OS X 10.9 / iOS 7 and later
@param channels - channels to be updated
@param action - type/style of update
@param result - returned details about what was updated
@param destination - destination for this update (action-specific)
*/
virtual IOReturn updateReport(IOReportChannelList *channels,
IOReportUpdateAction action,
void *result,
void *destination);

#endif

private:
#if __LP64__

#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
OSMetaClassDeclareReservedUsed(IOService, 0);
OSMetaClassDeclareReservedUsed(IOService, 1);
#else
OSMetaClassDeclareReservedUnused(IOService, 0);
OSMetaClassDeclareReservedUnused(IOService, 1);
#endif

OSMetaClassDeclareReservedUnused(IOService, 2);
OSMetaClassDeclareReservedUnused(IOService, 3);
OSMetaClassDeclareReservedUnused(IOService, 4);
OSMetaClassDeclareReservedUnused(IOService, 5);
OSMetaClassDeclareReservedUnused(IOService, 6);
OSMetaClassDeclareReservedUnused(IOService, 7);
#else
OSMetaClassDeclareReservedUsed(IOService, 0);
OSMetaClassDeclareReservedUsed(IOService, 1);
OSMetaClassDeclareReservedUsed(IOService, 2);
OSMetaClassDeclareReservedUsed(IOService, 3);
OSMetaClassDeclareReservedUsed(IOService, 4);
OSMetaClassDeclareReservedUsed(IOService, 5);
#endif

#ifdef defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
OSMetaClassDeclareReservedUsed(IOService, 6);
OSMetaClassDeclareReservedUsed(IOService, 7);
#else
OSMetaClassDeclareReservedUnused(IOService, 6);
OSMetaClassDeclareReservedUnused(IOService, 7);
#endif

#endif

OSMetaClassDeclareReservedUnused(IOService, 8);
OSMetaClassDeclareReservedUnused(IOService, 9);
OSMetaClassDeclareReservedUnused(IOService, 10);
Expand Down

0 comments on commit d43a05f

Please sign in to comment.