␉␉␉}␊ |
␉␉␉entry = entry->next;␊ |
␉␉}␊ |
␉␉␊ |
␉}␊ |
}␊ |
␊ |
|
␊ |
␊ |
void patch_cpuid_set_info_32(void* kernelData, UInt32 impersonateFamily, UInt8 impersonateModel)␊ |
{␉␊ |
{␊ |
␉UInt8* bytes = (UInt8*)kernelData;␊ |
␉␊ |
␉kernSymbols_t *symbol = lookup_kernel_symbol("_cpuid_set_info");␊ |
|
␉// NOTE: This will *NOT* be located on pre 10.6.2 kernels␊ |
␉jumpLocation = patchLocation - 15;␊ |
␉while((bytes[jumpLocation - 1] != 0x77 ||␊ |
␉␉ bytes[jumpLocation] != (patchLocation - jumpLocation - -8)) &&␊ |
␉␉ bytes[jumpLocation] != (patchLocation - jumpLocation - 18)) &&␊ |
␉␉ (patchLocation - jumpLocation) < 0xF0)␊ |
␉{␊ |
␉␉jumpLocation--;␊ |
␉}␊ |
␉␊ |
␉// If found... AND we want to impersonate a specific cpumodel / family...␊ |
␉if(impersonateFamily &&␊ |
␉ impersonateModel &&␊ |
␉if(impersonateFamily && impersonateModel &&␊ |
␉ ((patchLocation - jumpLocation) < 0xF0))␊ |
␉{␊ |
␉␉␊ |
␉␉bytes[jumpLocation] -= 10;␉␉// sizeof(movl␉$0x6b5a4cd2,0x00872eb4) = 10bytes␊ |
␉␉␊ |
␉␉/* ␊ |
|
␉}␊ |
␉else if(impersonateFamily && impersonateModel)␊ |
␉{␊ |
␊ |
␉␉// pre 10.6.2 kernel␊ |
␉␉// Locate the jump to directly *after* the panic call,␊ |
␉␉jumpLocation = patchLocation - 4;␊ |
|
␊ |
void patch_lapic_init(void* kernelData)␊ |
{␊ |
␊ |
␉UInt8 panicIndex = 0;␊ |
␉UInt8* bytes = (UInt8*)kernelData;␊ |
␉␊ |