Chameleon

Chameleon Svn Source Tree

Root/branches/meklort/i386/modules/KernelPatcher/kernel_patcher.h

Source at commit 502 created 10 years 1 month ago.
By meklort, Typo fix, current status of kernel patcher. NOTE: 64bit doesn't work fully yet. This is just a placeholder untill I sync with trunk.
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_ANY0x00
13#define CPUID_MODEL_UNKNOWN0x01
14
15#define CPUID_MODEL_YONAH14
16#define CPUID_MODEL_MEROM15
17#define CPUID_MODEL_PENRYN23
18#define CPUID_MODEL_NEHALEM26
19#define CPUID_MODEL_ATOM28
20#define CPUID_MODEL_FIELDS30/* Lynnfield, Clarksfield, Jasper */
21#define CPUID_MODEL_DALES31/* Havendale, Auburndale */
22#define CPUID_MODEL_NEHALEM_EX46
23
24#define KERNEL_ANY0x00
25#define KERNEL_640x01
26#define KERNEL_320x02
27#define KERNEL_ERR0xFF
28
29typedef struct patchRoutine_t
30{
31void(*patchRoutine)(void*);
32int validArchs;
33int validCpu;
34struct patchRoutine_t* next;
35} patchRoutine_t;
36
37
38typedef struct kernSymbols_t
39{
40char* symbol;
41UInt64 addr;
42struct kernSymbols_t* next;
43} kernSymbols_t;
44
45kernSymbols_t* lookup_kernel_symbol(const char* name);
46void register_kernel_symbol(int kernelType, const char* name);
47
48long long symbol_handler(char* symbolName, long long addr, char is64);
49void patch_kernel(void* kernelData, void* arg2, void* arg3, void *arg4);
50void register_kernel_patch(void* patch, int arch, int cpus);
51
52int locate_symbols(void* kernelData);
53
54int determineKernelArchitecture(void* kernelData);
55
56/*
57 * Internal patches provided by this module.
58 */
59void patch_cpuid_set_info_all(void* kernelData);
60void patch_cpuid_set_info_32(void* kernelData, UInt32 impersonateFamily, UInt8 impersonateModel);
61void patch_cpuid_set_info_64(void* kernelData, UInt32 impersonateFamily, UInt8 impersonateModel);
62
63void patch_pmCPUExitHaltToOff(void* kernelData);
64void patch_lapic_init(void* kernelData);
65void patch_commpage_stuff_routine(void* kernelData);
66void patch_lapic_configure(void* kernelData);
67void patch_lapic_interrupt(void* kernelData);
68
69#endif /* !__BOOT2_KERNEL_PATCHER_H */
70

Archive Download this file

Revision: 502