Chameleon

Chameleon Commit Details

Date:2018-10-14 20:12:48 (1 year 17 hours ago)
Author:ErmaC
Commit:2914
Parents: 2913
Message:Fix for a regression affecting all OS X releases prior to 10.12 (Credits to MinusZwei)
Changes:
M/trunk/i386/libsaio/bootargs.h
M/trunk/i386/libsaio/bootstruct.c
M/branches/ErmaC/Enoch/i386/libsaio/bootargs.h
M/branches/ErmaC/Enoch/i386/libsaio/bootstruct.c

File differences

trunk/i386/libsaio/bootstruct.c
134134
135135
136136
137
137
138138
139139
140140
141141
142142
143
143
144144
145145
146146
......
289289
290290
291291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
292315
293316
294317
295
318
296319
297320
298321
}
else
{
// for 10.7 10.8 10.9 10.10 10.11 10.12 10.13
// for 10.7 10.8 10.9 10.10 10.11 10.12 10.13 10.14
void *oldAddr = bootArgs;
bootArgs = (boot_args *)AllocateKernelMemory(sizeof(boot_args));
bcopy(oldAddr, bootArgs, sizeof(boot_args));
}
// 10.12 and 10.13 new bootArgs?
// 10.12, 10.13 and 10.14 new bootArgs?
}
//==============================================================================
bootArgs->deviceTreeP = (uint32_t)addr;
bootArgs->deviceTreeLength = size;
//
// MinusZwei:
// Dump the new video struct fields in the old one.
// This will avoid a black screen issue with OS X between 10.8 and 10.11
//
// In order to be 100% safe, the new struct fields will also be seroed
// afterwards.
//
if ( MacOSVerCurrent < MacOSVer2Int("10.12") )
{
bootArgs->VideoV1.v_baseAddr = bootArgs->Video.v_baseAddr;
bootArgs->VideoV1.v_display = bootArgs->Video.v_display;
bootArgs->VideoV1.v_rowBytes = bootArgs->Video.v_rowBytes;
bootArgs->VideoV1.v_width = bootArgs->Video.v_width;
bootArgs->VideoV1.v_height = bootArgs->Video.v_height;
bootArgs->VideoV1.v_depth = bootArgs->Video.v_depth;
bzero(&bootArgs->Video, sizeof(Boot_Video));
bootArgs->apfsDataStart = 0;
bootArgs->apfsDataSize = 0;
}
// Copy BootArgs values to older structure
memcpy(&bootArgsLegacy->CommandLine, &bootArgs->CommandLine, BOOT_LINE_LENGTH);
memcpy(&bootArgsLegacy->Video, &bootArgs->Video, sizeof(Boot_Video));
memcpy(&bootArgsLegacy->Video, &bootArgs->VideoV1, sizeof(Boot_VideoV1));
bootArgsLegacy->MemoryMap = bootArgs->MemoryMap;
bootArgsLegacy->MemoryMapSize = bootArgs->MemoryMapSize;
trunk/i386/libsaio/bootargs.h
8080
8181
8282
83
83
8484
8585
8686
......
8888
8989
9090
91
92
93
94
95
96
97
98
99
100
101
102
91103
92104
93105
......
162174
163175
164176
177
178
179
180
165181
182
183
166184
167185
168186
......
179197
180198
181199
182
200
183201
184202
185203
......
213231
214232
215233
216
217234
235
236
237
238
239
240
241
218242
219243
220244
......
229253
230254
231255
232
256
233257
234258
235259
* Video information..
*/
struct Boot_Video {
struct Boot_VideoV1 {
uint32_tv_baseAddr;/* Base address of video memory */
uint32_tv_display;/* Display Code (if Applicable */
uint32_tv_rowBytes;/* Number of bytes per pixel row */
uint32_tv_height;/* Height */
uint32_tv_depth;/* Pixel Depth */
};
typedef struct Boot_VideoV1Boot_VideoV1;
struct Boot_Video
{
uint32_tv_display;// Display Code (if Applicable).
uint32_tv_rowBytes;// Number of bytes per pixel row.
uint32_tv_width;// Width.
uint32_tv_height;// Height.
uint32_tv_depth;// Pixel Depth.
uint32_tv_resv[7];// Reserved.
uint64_tv_baseAddr;// Base address (64-bit) of video memory.
};
typedef struct Boot_VideoBoot_Video;
/* Values for v_display */
CSR_ALLOW_ANY_RECOVERY_OS | \
CSR_ALLOW_UNAPPROVED_KEXTS)
/* CSR capabilities that a booter can give to the system */
#define CSR_CAPABILITY_UNLIMITED(1 << 0)
#define CSR_CAPABILITY_CONFIG(1 << 1)
#define CSR_CAPABILITY_APPLE_INTERNAL(1 << 2)
#define CSR_VALID_CAPABILITIES (CSR_CAPABILITY_UNLIMITED | CSR_CAPABILITY_CONFIG | CSR_CAPABILITY_APPLE_INTERNAL)
typedef struct boot_args
{
uint16_t Revision;/* Revision of boot_args structure */
uint32_t MemoryMapDescriptorSize;
uint32_t MemoryMapDescriptorVersion;
Boot_VideoVideo;/* Video Information */
Boot_VideoV1VideoV1;/* Video Information */
uint32_t deviceTreeP; /* Physical address of flattened device tree */
uint32_t deviceTreeLength; /* Length of flattened tree */
uint32_t boot_SMC_plimit;
uint16_tbootProgressMeterStart;
uint16_tbootProgressMeterEnd;
uint32_t __reserved4[726];
Boot_Video Video; /* Video Information */
uint32_tapfsDataStart;// Physical address of apfs volume key structure.
uint32_tapfsDataSize;
uint32_t __reserved4[710];
} boot_args;
typedef struct boot_args_legacy
uint32_t MemoryMapDescriptorSize;
uint32_t MemoryMapDescriptorVersion;
Boot_VideoVideo;/* Video Information */
Boot_VideoV1Video;/* Video Information */
uint32_t deviceTreeP; /* Physical address of flattened device tree */
uint32_t deviceTreeLength; /* Length of flattened tree */
branches/ErmaC/Enoch/i386/libsaio/bootstruct.c
134134
135135
136136
137
137
138138
139139
140140
141141
142142
143
143
144144
145145
146146
......
289289
290290
291291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
292315
293316
294317
295
318
296319
297320
298321
}
else
{
// for 10.7 10.8 10.9 10.10 10.11 10.12 10.13
// for 10.7 10.8 10.9 10.10 10.11 10.12 10.13 10.14
void *oldAddr = bootArgs;
bootArgs = (boot_args *)AllocateKernelMemory(sizeof(boot_args));
bcopy(oldAddr, bootArgs, sizeof(boot_args));
}
// 10.12 and 10.13 new bootArgs?
// 10.12, 10.13 and 10.14 new bootArgs?
}
//==============================================================================
bootArgs->deviceTreeP = (uint32_t)addr;
bootArgs->deviceTreeLength = size;
//
// MinusZwei:
// Dump the new video struct fields in the old one.
// This will avoid a black screen issue with OS X between 10.8 and 10.11
//
// In order to be 100% safe, the new struct fields will also be seroed
// afterwards.
//
if ( MacOSVerCurrent < MacOSVer2Int("10.12") )
{
bootArgs->VideoV1.v_baseAddr = bootArgs->Video.v_baseAddr;
bootArgs->VideoV1.v_display = bootArgs->Video.v_display;
bootArgs->VideoV1.v_rowBytes = bootArgs->Video.v_rowBytes;
bootArgs->VideoV1.v_width = bootArgs->Video.v_width;
bootArgs->VideoV1.v_height = bootArgs->Video.v_height;
bootArgs->VideoV1.v_depth = bootArgs->Video.v_depth;
bzero(&bootArgs->Video, sizeof(Boot_Video));
bootArgs->apfsDataStart = 0;
bootArgs->apfsDataSize = 0;
}
// Copy BootArgs values to older structure
memcpy(&bootArgsLegacy->CommandLine, &bootArgs->CommandLine, BOOT_LINE_LENGTH);
memcpy(&bootArgsLegacy->Video, &bootArgs->Video, sizeof(Boot_Video));
memcpy(&bootArgsLegacy->Video, &bootArgs->VideoV1, sizeof(Boot_VideoV1));
bootArgsLegacy->MemoryMap = bootArgs->MemoryMap;
bootArgsLegacy->MemoryMapSize = bootArgs->MemoryMapSize;
branches/ErmaC/Enoch/i386/libsaio/bootargs.h
8080
8181
8282
83
83
8484
8585
8686
......
8888
8989
9090
91
92
93
94
95
96
97
98
99
100
101
102
91103
92104
93105
......
162174
163175
164176
177
178
179
180
165181
182
183
166184
167185
168186
......
179197
180198
181199
182
200
183201
184202
185203
......
213231
214232
215233
216
217234
235
236
237
238
239
240
241
218242
219243
220244
......
229253
230254
231255
232
256
233257
234258
235259
* Video information..
*/
struct Boot_Video {
struct Boot_VideoV1 {
uint32_tv_baseAddr;/* Base address of video memory */
uint32_tv_display;/* Display Code (if Applicable */
uint32_tv_rowBytes;/* Number of bytes per pixel row */
uint32_tv_height;/* Height */
uint32_tv_depth;/* Pixel Depth */
};
typedef struct Boot_VideoV1Boot_VideoV1;
struct Boot_Video
{
uint32_tv_display;// Display Code (if Applicable).
uint32_tv_rowBytes;// Number of bytes per pixel row.
uint32_tv_width;// Width.
uint32_tv_height;// Height.
uint32_tv_depth;// Pixel Depth.
uint32_tv_resv[7];// Reserved.
uint64_tv_baseAddr;// Base address (64-bit) of video memory.
};
typedef struct Boot_VideoBoot_Video;
/* Values for v_display */
CSR_ALLOW_ANY_RECOVERY_OS | \
CSR_ALLOW_UNAPPROVED_KEXTS)
/* CSR capabilities that a booter can give to the system */
#define CSR_CAPABILITY_UNLIMITED(1 << 0)
#define CSR_CAPABILITY_CONFIG(1 << 1)
#define CSR_CAPABILITY_APPLE_INTERNAL(1 << 2)
#define CSR_VALID_CAPABILITIES (CSR_CAPABILITY_UNLIMITED | CSR_CAPABILITY_CONFIG | CSR_CAPABILITY_APPLE_INTERNAL)
typedef struct boot_args
{
uint16_t Revision;/* Revision of boot_args structure */
uint32_t MemoryMapDescriptorSize;
uint32_t MemoryMapDescriptorVersion;
Boot_VideoVideo;/* Video Information */
Boot_VideoV1VideoV1;/* Video Information */
uint32_t deviceTreeP; /* Physical address of flattened device tree */
uint32_t deviceTreeLength; /* Length of flattened tree */
uint32_t boot_SMC_plimit;
uint16_tbootProgressMeterStart;
uint16_tbootProgressMeterEnd;
uint32_t __reserved4[726];
Boot_Video Video; /* Video Information */
uint32_tapfsDataStart;// Physical address of apfs volume key structure.
uint32_tapfsDataSize;
uint32_t __reserved4[710];
} boot_args;
typedef struct boot_args_legacy
uint32_t MemoryMapDescriptorSize;
uint32_t MemoryMapDescriptorVersion;
Boot_VideoVideo;/* Video Information */
Boot_VideoV1Video;/* Video Information */
uint32_t deviceTreeP; /* Physical address of flattened device tree */
uint32_t deviceTreeLength; /* Length of flattened tree */

Archive Download the corresponding diff file

Revision: 2914