Root/
Source at commit 1166 created 13 years 10 days ago. By meklort, Fixed recent Makefile changes. Please do not use /Users/evan/SourceCode/tmp/chameleon/trunk or VPATH. the *only* time you should use /Users/evan/SourceCode/tmp/chameleon/trunk is when setting the SRCROOT variable. Also note that very soon make pkg is going to be removed. The pkg build script in trunk is very out of date. Instead please use the package maker at http://forge.voodooprojects.org/p/chameleonApplications/. Once this is ready for trunk it will be merged. | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 2009 Evan Lojewski. All rights reserved.␊ |
3 | *␊ |
4 | */␊ |
5 | ␊ |
6 | #include <mach-o/loader.h>␊ |
7 | #include <mach-o/nlist.h>␊ |
8 | ␊ |
9 | #ifndef __BOOT2_KERNEL_PATCHER_H␊ |
10 | #define __BOOT2_KERNEL_PATCHER_H␊ |
11 | ␊ |
12 | #define CPUID_MODEL_ANY␉␉0x00␊ |
13 | #define CPUID_MODEL_UNKNOWN␉0x01␊ |
14 | ␊ |
15 | #define CPUID_MODEL_YONAH␉14␊ |
16 | #define CPUID_MODEL_MEROM␉15␊ |
17 | #define CPUID_MODEL_PENRYN␉23␊ |
18 | #define CPUID_MODEL_NEHALEM␉26␊ |
19 | #define CPUID_MODEL_ATOM␉28␊ |
20 | #define CPUID_MODEL_FIELDS␉30␉/* Lynnfield, Clarksfield, Jasper */␊ |
21 | #define CPUID_MODEL_DALES␉31␉/* Havendale, Auburndale */␊ |
22 | #define CPUID_MODEL_NEHALEM_EX␉46␊ |
23 | ␊ |
24 | #define KERNEL_ANY␉0x00␊ |
25 | #define KERNEL_64␉0x01␊ |
26 | #define KERNEL_32␉0x02␊ |
27 | #define KERNEL_ERR␉0xFF␊ |
28 | ␊ |
29 | typedef struct patchRoutine_t␊ |
30 | {␊ |
31 | ␉void(*patchRoutine)(void*);␊ |
32 | ␉int validArchs;␊ |
33 | ␉int validCpu;␊ |
34 | ␉struct patchRoutine_t* next;␊ |
35 | } patchRoutine_t;␊ |
36 | ␊ |
37 | ␊ |
38 | typedef struct kernSymbols_t␊ |
39 | {␊ |
40 | ␉char* symbol;␊ |
41 | ␉UInt64 addr;␊ |
42 | ␉struct kernSymbols_t* next;␊ |
43 | } kernSymbols_t;␊ |
44 | ␊ |
45 | kernSymbols_t* lookup_kernel_symbol(const char* name);␊ |
46 | void register_kernel_symbol(int kernelType, const char* name);␊ |
47 | ␊ |
48 | long long symbol_handler(char* symbolName, long long addr, char is64);␊ |
49 | void patch_kernel(void* kernelData, void* arg2, void* arg3, void *arg4);␊ |
50 | void register_kernel_patch(void* patch, int arch, int cpus);␊ |
51 | ␊ |
52 | int locate_symbols(void* kernelData);␊ |
53 | ␊ |
54 | int determineKernelArchitecture(void* kernelData);␊ |
55 | ␊ |
56 | /*␊ |
57 | * Internal patches provided by this module.␊ |
58 | */␊ |
59 | void patch_cpuid_set_info_all(void* kernelData);␊ |
60 | void patch_cpuid_set_info_32(void* kernelData, UInt32 impersonateFamily, UInt8 impersonateModel);␊ |
61 | void patch_cpuid_set_info_64(void* kernelData, UInt32 impersonateFamily, UInt8 impersonateModel);␊ |
62 | ␊ |
63 | void patch_pmCPUExitHaltToOff(void* kernelData);␊ |
64 | void patch_lapic_init(void* kernelData);␊ |
65 | void patch_commpage_stuff_routine(void* kernelData);␊ |
66 | void patch_lapic_configure(void* kernelData);␊ |
67 | void patch_lapic_interrupt(void* kernelData);␊ |
68 | ␊ |
69 | #endif /* !__BOOT2_KERNEL_PATCHER_H */␊ |
70 |