Index: trunk/i386/libsaio/bootstruct.c =================================================================== --- trunk/i386/libsaio/bootstruct.c (revision 2913) +++ trunk/i386/libsaio/bootstruct.c (revision 2914) @@ -134,13 +134,13 @@ } 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? } //============================================================================== @@ -289,10 +289,33 @@ 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; Index: trunk/i386/libsaio/bootargs.h =================================================================== --- trunk/i386/libsaio/bootargs.h (revision 2913) +++ trunk/i386/libsaio/bootargs.h (revision 2914) @@ -80,7 +80,7 @@ * Video information.. */ -struct Boot_Video { +struct Boot_VideoV1 { uint32_t v_baseAddr; /* Base address of video memory */ uint32_t v_display; /* Display Code (if Applicable */ uint32_t v_rowBytes; /* Number of bytes per pixel row */ @@ -88,6 +88,18 @@ uint32_t v_height; /* Height */ uint32_t v_depth; /* Pixel Depth */ }; +typedef struct Boot_VideoV1 Boot_VideoV1; + +struct Boot_Video +{ + uint32_t v_display; // Display Code (if Applicable). + uint32_t v_rowBytes; // Number of bytes per pixel row. + uint32_t v_width; // Width. + uint32_t v_height; // Height. + uint32_t v_depth; // Pixel Depth. + uint32_t v_resv[7]; // Reserved. + uint64_t v_baseAddr; // Base address (64-bit) of video memory. +}; typedef struct Boot_Video Boot_Video; /* Values for v_display */ @@ -162,7 +174,13 @@ 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 */ @@ -179,7 +197,7 @@ uint32_t MemoryMapDescriptorSize; uint32_t MemoryMapDescriptorVersion; - Boot_Video Video; /* Video Information */ + Boot_VideoV1 VideoV1; /* Video Information */ uint32_t deviceTreeP; /* Physical address of flattened device tree */ uint32_t deviceTreeLength; /* Length of flattened tree */ @@ -213,8 +231,14 @@ uint32_t boot_SMC_plimit; uint16_t bootProgressMeterStart; uint16_t bootProgressMeterEnd; - uint32_t __reserved4[726]; + Boot_Video Video; /* Video Information */ + + uint32_t apfsDataStart; // Physical address of apfs volume key structure. + uint32_t apfsDataSize; + + uint32_t __reserved4[710]; + } boot_args; typedef struct boot_args_legacy @@ -229,7 +253,7 @@ uint32_t MemoryMapDescriptorSize; uint32_t MemoryMapDescriptorVersion; - Boot_Video Video; /* Video Information */ + Boot_VideoV1 Video; /* Video Information */ uint32_t deviceTreeP; /* Physical address of flattened device tree */ uint32_t deviceTreeLength; /* Length of flattened tree */ Index: branches/ErmaC/Enoch/i386/libsaio/bootstruct.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/bootstruct.c (revision 2913) +++ branches/ErmaC/Enoch/i386/libsaio/bootstruct.c (revision 2914) @@ -134,13 +134,13 @@ } 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? } //============================================================================== @@ -289,10 +289,33 @@ 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; Index: branches/ErmaC/Enoch/i386/libsaio/bootargs.h =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/bootargs.h (revision 2913) +++ branches/ErmaC/Enoch/i386/libsaio/bootargs.h (revision 2914) @@ -80,7 +80,7 @@ * Video information.. */ -struct Boot_Video { +struct Boot_VideoV1 { uint32_t v_baseAddr; /* Base address of video memory */ uint32_t v_display; /* Display Code (if Applicable */ uint32_t v_rowBytes; /* Number of bytes per pixel row */ @@ -88,6 +88,18 @@ uint32_t v_height; /* Height */ uint32_t v_depth; /* Pixel Depth */ }; +typedef struct Boot_VideoV1 Boot_VideoV1; + +struct Boot_Video +{ + uint32_t v_display; // Display Code (if Applicable). + uint32_t v_rowBytes; // Number of bytes per pixel row. + uint32_t v_width; // Width. + uint32_t v_height; // Height. + uint32_t v_depth; // Pixel Depth. + uint32_t v_resv[7]; // Reserved. + uint64_t v_baseAddr; // Base address (64-bit) of video memory. +}; typedef struct Boot_Video Boot_Video; /* Values for v_display */ @@ -162,7 +174,13 @@ 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 */ @@ -179,7 +197,7 @@ uint32_t MemoryMapDescriptorSize; uint32_t MemoryMapDescriptorVersion; - Boot_Video Video; /* Video Information */ + Boot_VideoV1 VideoV1; /* Video Information */ uint32_t deviceTreeP; /* Physical address of flattened device tree */ uint32_t deviceTreeLength; /* Length of flattened tree */ @@ -213,8 +231,14 @@ uint32_t boot_SMC_plimit; uint16_t bootProgressMeterStart; uint16_t bootProgressMeterEnd; - uint32_t __reserved4[726]; + Boot_Video Video; /* Video Information */ + + uint32_t apfsDataStart; // Physical address of apfs volume key structure. + uint32_t apfsDataSize; + + uint32_t __reserved4[710]; + } boot_args; typedef struct boot_args_legacy @@ -229,7 +253,7 @@ uint32_t MemoryMapDescriptorSize; uint32_t MemoryMapDescriptorVersion; - Boot_Video Video; /* Video Information */ + Boot_VideoV1 Video; /* Video Information */ uint32_t deviceTreeP; /* Physical address of flattened device tree */ uint32_t deviceTreeLength; /* Length of flattened tree */