Chameleon

Chameleon Commit Details

Date:2016-06-18 21:12:23 (7 years 10 months ago)
Author:ErmaC
Commit:2834
Parents: 2833
Message:Refactoring (boot.c)
Changes:
M/trunk/i386/boot2/boot.c
M/trunk/i386/boot2/boot.h

File differences

trunk/i386/boot2/boot.c
140140
141141
142142
143
144
145
146
143147
144148
145149
......
149153
150154
151155
152
153156
154
155
156
157
158
159
160
161
162
163
164
157
165158
166
167
159
160
161
168162
169
170
171
172
173
163
174164
175
176
177
178
179
180
181
182
183
184
185
186
165
187166
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227167
228168
229169
......
962902
963903
964904
905
906
907
908
909
910
911
965912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
966992
967993
994
995
968996
969997
970998
malloc_init(0, 0, 0, malloc_error);
}
// =========================================================================
//==========================================================================
// ExecKernel - Load the kernel image (mach-o) and jump to its entry point.
entry_tkernelEntry;
bootArgs->kaddr = bootArgs->ksize = 0;
// ===============================================================================
// OS X Mountain Lion 10.8
if ( MacOSVerCurrent >= MacOSVer2Int("10.8") ) // Mountain Lion and Up!
{
// cparm
bool KPRebootOption= false;
bool HiDPIOption= false;
getBoolForKey(kRebootOnPanic, &KPRebootOption, &bootInfo->chameleonConfig);
if ( KPRebootOption )
{
bootArgs->flags |= kBootArgsFlagRebootOnPanic;
}
// ===============================================================================
// cparm
getBoolForKey(kEnableHiDPI, &HiDPIOption, &bootInfo->chameleonConfig);
gMacOSVersion[0] = 0;
// TODO identify sierra as macOS
verbose("Booting on %s %s (%s)\n", (MacOSVerCurrent < MacOSVer2Int("10.8")) ? "Mac OS X" : "OS X", gBootVolume->OSFullVer, gBootVolume->OSBuildVer );
if ( HiDPIOption )
{
bootArgs->flags |= kBootArgsFlagHiDPI;
}
}
setupBooterArgs();
// OS X Yosemite 10.10
if ( MacOSVerCurrent >= MacOSVer2Int("10.10") ) // Yosemite and Up!
{
// Pike R. Alpha
bool FlagBlackOption= false;
getBoolForKey(kBlackMode, &FlagBlackOption, &bootInfo->chameleonConfig);
if ( FlagBlackOption )
{
//bootArgs->flags |= kBootArgsFlagBlack;
bootArgs->flags |= kBootArgsFlagBlackBg; // Micky1979
}
}
// ===============================================================================
// OS X El Capitan 10.11
if ( MacOSVerCurrent >= MacOSVer2Int("10.11") ) // El Capitan and Up!
{
// ErmaC
intcsrValue;
#if 0
/*
* A special BootArgs flag "kBootArgsFlagCSRBoot"
* is set in the Recovery or Installation environment.
* This flag is kind of overkill by turning off all the protections
*/
if (isRecoveryHD)
{
// SIP can be controlled with or without FileNVRAM.kext (Pike R. Alpha)
bootArgs->flags|=(kBootArgsFlagCSRActiveConfig + kBootArgsFlagCSRConfigMode + kBootArgsFlagCSRBoot);
}
#endif
bootArgs->flags|= kBootArgsFlagCSRActiveConfig;
// Set limit to 7bit
if ( getIntForKey(kCsrActiveConfig, &csrValue, &bootInfo->chameleonConfig) && (csrValue >= 0 && csrValue <= 127) )
{
bootArgs->csrActiveConfig= csrValue;
}
else
{
// zenith432
bootArgs->csrActiveConfig= 0x67;
}
verbose("CsrActiveConfig set to 0x%x\n", bootArgs->csrActiveConfig);
bootArgs->csrCapabilities= CSR_VALID_FLAGS;
bootArgs->boot_SMC_plimit= 0;
}
// ===============================================================================
execute_hook("ExecKernel", (void *)binary, NULL, NULL, NULL);
ret = DecodeKernel(binary,
}
// =========================================================================
//
void setupBooterArgs()
{
bool KPRebootOption= false;
bool HiDPIOption= false;
bool FlagBlackOption= false;
// OS X Mountain Lion 10.8
if ( MacOSVerCurrent >= MacOSVer2Int("10.8") ) // Mountain Lion and Up!
{
// cparm
getBoolForKey(kRebootOnPanic, &KPRebootOption, &bootInfo->chameleonConfig);
if ( KPRebootOption )
{
bootArgs->flags |= kBootArgsFlagRebootOnPanic;
}
// cparm
getBoolForKey(kEnableHiDPI, &HiDPIOption, &bootInfo->chameleonConfig);
if ( HiDPIOption )
{
bootArgs->flags |= kBootArgsFlagHiDPI;
}
}
// OS X Yosemite 10.10
if ( MacOSVerCurrent >= MacOSVer2Int("10.10") ) // Yosemite and Up!
{
// Pike R. Alpha
getBoolForKey(kBlackMode, &FlagBlackOption, &bootInfo->chameleonConfig);
if ( FlagBlackOption )
{
// bootArgs->flags |= kBootArgsFlagBlack;
bootArgs->flags |= kBootArgsFlagBlackBg; // Micky1979
}
}
// OS X El Capitan 10.11
if ( MacOSVerCurrent >= MacOSVer2Int("10.11") ) // El Capitan and Up!
{
// ErmaC
verbose("\n");
intcsrValue;
#if 0
/*
* A special BootArgs flag "kBootArgsFlagCSRBoot"
* is set in the Recovery or Installation environment.
* This flag is kind of overkill by turning off all the protections
*/
if (isRecoveryHD)
{
// SIP can be controlled with or without FileNVRAM.kext (Pike R. Alpha)
bootArgs->flags|=(kBootArgsFlagCSRActiveConfig + kBootArgsFlagCSRConfigMode + kBootArgsFlagCSRBoot);
}
#endif
bootArgs->flags|= kBootArgsFlagCSRActiveConfig;
// Set limit to 7bit
if ( getIntForKey(kCsrActiveConfig, &csrValue, &bootInfo->chameleonConfig) && (csrValue >= 0 && csrValue <= 127) )
{
bootArgs->csrActiveConfig= csrValue;
}
else
{
// zenith432
bootArgs->csrActiveConfig= 0x67;
}
// ===============================================================================
verbose("CsrActiveConfig set to 0x%x\n", bootArgs->csrActiveConfig);
// ===============================================================================
bootArgs->csrCapabilities= CSR_VALID_FLAGS;
bootArgs->boot_SMC_plimit= 0;
}
}
// =========================================================================
// =========================================================================
/*!
Selects a new BIOS device, taking care to update the global state appropriately.
*/
trunk/i386/boot2/boot.h
341341
342342
343343
344
345
346
347
348
349
350
351
352
344353
345354
346355
void*work);
*/
/*
* boot.c
*/
bool FlagBlackOption; // <-- This is first set in boot.c into setupBooterArgs function
bool HiDPIOption;
void setupBooterArgs(void);
void csrInfo(int csrValue, bool custom);
struct compressed_kernel_header {
u_int32_t signature;
u_int32_t compress_type;

Archive Download the corresponding diff file

Revision: 2834