Chameleon

Chameleon Commit Details

Date:2010-09-03 14:41:06 (8 years 10 months ago)
Author:Azimutz
Commit:486
Parents: 485
Message:Added a key to enable Kernel Patcher module, temporarily defaulting to "true". Killed some compiler warnings from last updates; also dead is the getc(); on HelloWorld.dylib. Doc edit.
Changes:
M/branches/azimutz/Chazi/doc-azi/CHANGES.txt
M/branches/azimutz/Chazi/doc-azi/Modules.txt
M/branches/azimutz/Chazi/i386/modules/KernelPatcher/kernel_patcher.c
M/branches/azimutz/Chazi/i386/libsaio/saio_types.h
M/branches/azimutz/Chazi/i386/boot2/boot.c
M/branches/azimutz/Chazi/i386/boot2/boot.h
M/branches/azimutz/Chazi/i386/modules/HelloWorld/HelloWorld.c

File differences

branches/azimutz/Chazi/doc-azi/CHANGES.txt
299299
300300
301301
302
302
303303
304304
305305
306306
307307
308308
309
309
310
311
310312
311313
312314
---------------//---------------//---------------
- (rev 480)
- (starting at rev 480)
Change: Added Meklort's Modules support, plus Kernel Patcher (Kptchr) module.
Check Modules.txt for more info.
Some talk here: http://forum.voodooprojects.org/index.php/topic,1556.0.html
here: http://forum.voodooprojects.org/index.php/topic,1153.0.html
and here: http://forum.voodooprojects.org/index.php/topic,1565.0.html
Note: Only i386 arch is supported at the moment; x86_64 support to be added.
PatchKernel=n disables Kernel Patcher. "Temporarily" enabled by default!!
Note: Only i386 arch is supported at the moment; x86_64 support being added...
Motif: ... as if, booting vanilla kernel, is not reason enough!?
branches/azimutz/Chazi/doc-azi/Modules.txt
99
1010
1111
12
13
14
15
16
12
13
14
1715
16
17
1818
1919
2020
......
2222
2323
2424
25
26
27
28
29
2530
26
27
31
32
33
34
35
2836
29
30
31
32
33
34
37
38
39
40
41
42
43
44
3545
36
3746
47
48
49
50
3851
3952
4053
......
4558
4659
4760
61
4862
63
4964
5065
5166
......
5873
5974
6075
76
6177
78
6279
80
81
6382
6483
6584
"old" in RC5 world means before rev 168 (atm).
How to use?
- nothing to do! Modules are loaded at startup, before the Gui loads, providing you place
them in the correct place (check Issues below).
- Symbols.dylib is always and the first module loaded. The booter will still perform as
usual if this module fails to load.
- Check if a key is needed to activate the module you pretend to use.
Modules are loaded at startup, before the Gui loads, providing they are located in
the right place (check Issues below).
---------------//---------------//---------------
What are modules?
- good question! Well, can't add much on the "geek" side... need to study the stuff so
i don't start dumping bs. The easy answer is they are like plugins, adding/replacing
integrated on boot file like any other Chameleon function; with Modules support Kptchr
can now live as a module, freeing the space it occupied on boot file
(one of module's advantages).
The booter will still perform as usual if a module fails to load.
Featured modules:
- Symbols.dylib: first and always loaded. No key is foreseen for this module.
No other module will work if this one fails to load.
Kernel Patcher module:
- features cpuid_set, commpage_stuff and lapic_init patches (atm).
- KernelPatcher.dylib:
- "will" need PatchKernel=y to be enabled.
Note:*** this is still under consideration/testing so, for now the patcher is enabled by default***
- features cpuid_set, commpage_stuff and lapic_init patches (atm).
-as it is, Kptchr allows my Pentium D 925 to boot vanilla kernel, with the help of
-legacy flag; to enter x86_64 world i still need to patch the kernel, as the 925 has no
Supplemental SSE3 instructions. I assume that, the great majority of the legacy/unsupported
processors with at least SSE3 instructions, will benefit of the same treatment!
For now let's just say that the only patch needed by the 925 on Legacy Mode(*) is
cpuid_set!
- as it is, Kptchr allows my Pentium D 925 to boot vanilla kernel, with the help of
-legacy flag; to enter x86_64 world i still need to patch the kernel, as the 925 has
no Supplemental SSE3 instructions. I assume that, the great majority of the
legacy/unsupported processors with at least 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!
- HelloWorld.dylib: just a notifier, i guess :P
(*) For those who "missed" the lesson, Legacy Mode is the mode, 32 bit only cpu's run on OS X.
(*) For those who "missed" the lesson, Legacy Mode is the mode 32 bit only cpu's run on OS X.
---------------//---------------//---------------
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.
- this is work in progress; i will add updates as Meklort commits and only if they are in
functional state.
---------------//---------------//---------------
Smith@@'s news :D
« Sent to: Azimutz on: Fri 03/09/2010 at 05:55:08 »
---------------//---------------//---------------
Huge thanks fly out to Meklort for this precious work!
---------------//---------------//---------------
Azimutz
branches/azimutz/Chazi/i386/libsaio/saio_types.h
242242
243243
244244
245
245
246246
247247
248248
enum {
kNetworkDeviceType = kBIOSDevTypeNetwork,
kBlockDeviceType = kBIOSDevTypeHardDrive
} gBootFileType_t; //Azi: kernel patcher module, rev 307
};// gBootFileType_t; //Kptchr module, rev 307
enum {
kCursorTypeHidden = 0x0100,
branches/azimutz/Chazi/i386/boot2/boot.c
396396
397397
398398
399
399400
400401
401402
......
666667
667668
668669
669
670
671
672
673
674
675
670676
671677
672678
bool tryresume;
bool tryresumedefault;
bool forceresume;
bool patchKernel = true; //Kptchr - temporarely set to true, ude to testing!
// additional variable for testing alternate kernel image locations on boot helper partitions.
char bootFileSpec[512];
} else {
/* Won't return if successful. */
// Notify modules that ExecKernel is about to be called
execute_hook("ExecKernel", binary, NULL, NULL, NULL);
getBoolForKey(kKPatcherKey, &patchKernel, &bootInfo->bootConfig);
if (patchKernel == true)
{
execute_hook("ExecKernel", binary, NULL, NULL, NULL);
}
ret = ExecKernel(binary);
}
}
branches/azimutz/Chazi/i386/boot2/boot.h
9797
9898
9999
100
100101
101102
102103
#define kTestConfigKey"config"// stringTable.c
#define kCanOverrideKey"CanOverride"// stringTable.c
#define kAutoResolutionKey"AutoResolution"// boot.c
#define kKPatcherKey"PatchKernel"// boot.c
/*
* Flags to the booter and/or kernel - these end with "Flag".
branches/azimutz/Chazi/i386/modules/KernelPatcher/kernel_patcher.c
215215
216216
217217
218
218
219219
220220
221221
......
286286
287287
288288
289
289
290
290291
291292
292293
{
struct load_command *loadCommand;
struct symtab_command *symtableData;
struct symtab_command *symtableData = 0; //Azi:warning
//struct nlist *symbolEntry;
char* symbolString;
}
}
handle_symtable((UInt32)kernelData, symtableData, &symbol_handler, determineKernelArchitecture(kernelData) == KERNEL_64);
return handle_symtable((UInt32)kernelData, symtableData, &symbol_handler,
determineKernelArchitecture(kernelData) == KERNEL_64);
}
long long symbol_handler(char* symbolName, long long addr, char is64)
branches/azimutz/Chazi/i386/modules/HelloWorld/HelloWorld.c
44
55
66
7
78
89
910
1011
1112
12
13
1314
1415
1516
*/
#include "libsaio.h"
#include "modules.h" //Azi:warning
void helloWorld(void* binary, void* arg2, void* arg3, void* arg4)
{
printf("Hello world from ExecKernel hook. Binary located at 0x%X\n", binary);
getc();
//getc();
}

Archive Download the corresponding diff file

Revision: 486