Chameleon

Chameleon Commit Details

Date:2016-06-18 21:05:35 (7 years 10 months ago)
Author:ErmaC
Commit:2833
Parents: 2832
Message:Refactoring (boot.c)
Changes:
M/branches/ErmaC/Enoch/i386/boot2/boot.c
M/branches/ErmaC/Enoch/i386/boot2/boot.h

File differences

branches/ErmaC/Enoch/i386/boot2/boot.c
153153
154154
155155
156
157156
158
159
160
161
162
163
164
165
166
167
168
157
169158
170
171
159
160
161
172162
173
174
175
176
177
163
178164
179
180
181
182
183
184
185
186
187
188
189
190
165
191166
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
227
228
229
230
231167
232168
233169
......
962898
963899
964900
901
902
903
904
905
906
907
965908
909
910
911
912
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
966988
967989
990
991
968992
969993
970994
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.
*/
branches/ErmaC/Enoch/i386/boot2/boot.h
354354
355355
356356
357
357
358
359
360
358361
359362
363
364
365
360366
361367
362368
void*work);
*/
bool FlagBlackOption;
/*
* 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: 2833