Chameleon

Chameleon Commit Details

Date:2010-09-07 01:37:03 (9 years 1 month ago)
Author:Azimutz
Commit:499
Parents: 498
Message:Changed modules loading path to bt(0,0)/Extra/modules, according to booter concept; there's an issue with this, check Modules.txt-->Issues. Minor cosmetic, doc, comment and typo (is_module_laoded) edits.
Changes:
M/branches/azimutz/Chazi/doc-azi/Modules.txt
M/branches/azimutz/Chazi/i386/boot2/modules.h
M/branches/azimutz/Chazi/i386/modules/KernelPatcher/kernel_patcher.c
M/branches/azimutz/Chazi/i386/boot2/boot.c
M/branches/azimutz/Chazi/i386/boot2/boot.h
M/branches/azimutz/Chazi/i386/boot2/modules.c

File differences

branches/azimutz/Chazi/doc-azi/Modules.txt
5454
5555
5656
57
58
5759
5860
5961
......
6668
6769
6870
69
70
71
72
73
74
75
7176
72
73
74
75
76
7777
7878
7979
SSE3 instructions, will benefit of the same treatment!
Let's just say that the only patch needed by the 925 on Legacy Mode(**) is cpuid_set!
Note: Kernel Patcher can stop working due to changes on the kernel code.
- HelloWorld.dylib: just a notifier (not mandatory).
Issues:
- modules may fail to load, if you have the booter on a separate device/partition and try
to load modules from selected volume. Confirmed on MBR/boot0hfs install only.
- the default path for loading modules (/Extra/modules/) is not being respected, the booter
always checks bt(0,0)/Extra/modules/ instead.
Anyway, i already intended to change the path due to the concept of this booter
and so i did it. Of course the problem is still there and needs to be fixed, at least if
one wants to be able to load modules from selected volume.
- the Kernel Patcher can stop working due to changes on the kernel code, though that can be
"previewed" to some extent. Just so you know what to expect.
- this is work in progress; i will add updates as Meklort commits.
---------------//---------------//---------------
branches/azimutz/Chazi/i386/boot2/boot.c
290290
291291
292292
293
293
294294
295295
296296
}
// Intialize module system
if(init_module_system())
if (init_module_system())
{
load_all_modules();
}
branches/azimutz/Chazi/i386/boot2/modules.c
5454
5555
5656
57
57
5858
5959
6060
61
61
6262
6363
6464
......
7878
7979
8080
81
81
8282
8383
8484
8585
86
86
87
8788
8889
8990
......
109110
110111
111112
112
113
113114
114115
115116
......
119120
120121
121122
122
123
124
123125
124126
125127
......
10481050
10491051
10501052
1051
1053
10521054
10531055
10541056
int init_module_system()
{
// Intialize module system
if(load_module(SYMBOLS_MODULE))
if (load_module(SYMBOLS_MODULE))
{
lookup_symbol = (void*)lookup_all_symbols(SYMBOL_LOOKUP_SYMBOL);
if((UInt32)lookup_symbol != 0xFFFFFFFF)
if ((UInt32)lookup_symbol != 0xFFFFFFFF)
{
return 1;
}
* link one module with the other. For dyld to allow this, you must
* reference at least one symbol within the module.
*/
void load_all_modules()
void load_all_modules() // called on boot.c
{
char* name;
long flags;
long time;
struct dirstuff* moduleDir = opendir("/Extra/modules/");
//Azi: Modules.txt-->Issues
struct dirstuff* moduleDir = opendir("bt(0,0)/Extra/modules/");
while(readdir(moduleDir, (const char**)&name, &flags, &time) >= 0)
{
if(strcmp(&name[strlen(name) - sizeof("dylib")], ".dylib") == 0)
int load_module(char* module)
{
// Check to see if the module has already been loaded
if(is_module_laoded(module))
if(is_module_loaded(module))
{
// NOTE: Symbols.dylib tries to load twice, this catches it as well
// as when a module links with an already loaded module
char modString[128];
int fh = -1;
sprintf(modString, "/Extra/modules/%s", module);
//Azi: Modules.txt-->Issues
sprintf(modString, "bt(0,0)/Extra/modules/%s", module);
fh = open(modString, 0);
if(fh < 0)
{
}
int is_module_laoded(const char* name)
int is_module_loaded(const char* name)
{
moduleList_t* entry = loadedModules;
while(entry)
branches/azimutz/Chazi/i386/boot2/boot.h
101101
102102
103103
104
104
105105
106106
107107
#define kTestConfigKey"config"// stringTable.c
#define kCanOverrideKey"CanOverride"// stringTable.c
#define kAutoResolutionKey"AutoResolution"// boot.c
#define kKPatcherKey"PatchKernel"// boot.c
#define kKPatcherKey"PatchKernel"// kernel_patcher.c
/*
* Flags to the booter and/or kernel - these end with "Flag".
branches/azimutz/Chazi/i386/boot2/modules.h
7474
7575
7676
77
77
7878
7979
8080
void bind_macho(void* base, char* bind_stream, UInt32 size);
int load_module(char* module);
int is_module_laoded(const char* name);
int is_module_loaded(const char* name);
void module_loaded(const char* name/*, UInt32 version, UInt32 compat*/);
long long add_symbol(char* symbol, long long addr, char is64);
branches/azimutz/Chazi/i386/modules/KernelPatcher/kernel_patcher.c
315315
316316
317317
318
318
319319
320320
321321
bytes[patchLocation + 4] = 0x90;
printf("0x%X 0x%X 0x%X 0x%X 0x%X\n", bytes[patchLocation ], bytes[patchLocation +1], bytes[patchLocation +2], bytes[patchLocation +3], bytes[patchLocation +4]);
getc();
//getc();
// Locate the jump call, so that 10 bytes can be reclamed.
// NOTE: This will *NOT* be located on pre 10.6.2 kernels

Archive Download the corresponding diff file

Revision: 499