This hack is a workaround for Apple's attempt to kill of the Atom cpu Hackintosh (Netbook Hackintosh aka Macbook Nano)
/*
* Copyright (c) 2009 Evan Lojewski. All rights reserved.
*
*/
#include "libsaio.h"
#include "patch.h"
extern void* binaryOffset;
struct patch_entry
{
char *addr;
char byte;
char oldByte;
};
// Kernel path by tea
struct patch_entry patch_table[] =
{
{ (char*) 0x005E6A8A, 0x31, 0x83 },
{ (char*) 0x005E6A8B, 0xC0, 0xE8 },
{ (char*) 0x005E6A8C, 0x40, 0x0D },
{ (char*) 0x00000000, 0x00, 0x00 }
};
void patch_kernel(void* kernel_addr)
{
int i;
for(i = 0; patch_table[i].addr != 0; i++)
{
char* addr = (unsigned long)kernel_addr + patch_table[i].addr - (unsigned long)binaryOffset;
if(((*addr) & 0xFF) != (patch_table[i].oldByte & 0xFF))
{
verbose("Failed to match 0x%X with 0x%X\n", *addr & 0xFF, patch_table[i].oldByte & 0xFF);
return;
}
}
for(i = 0; patch_table[i].addr != 0; i++)
{
char* addr = (unsigned long)kernel_addr + patch_table[i].addr - (unsigned long)binaryOffset;
verbose("Replacing 0x%X with 0x%X at 0x%X\n", *addr & 0xFF, patch_table[i].byte & 0xFF, addr, patch_table[i].byte & 0xFF);
*(addr) = (patch_table[i].byte & 0xFF);
}
}
No comments:
Post a Comment