update apple's headers

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2020-06-24 13:31:00 +03:00
parent 1856b519e5
commit 428c6bb35a
3 changed files with 89 additions and 22 deletions

View File

@ -565,6 +565,18 @@ typedef struct {
/// build for platform min OS version
///
#define MACH_LOAD_COMMAND_BUILD_VERSION 50U
///
/// used with linkedit_data_command, payload is trie
///
#define MACH_LOAD_COMMAND_DYLD_EXPORTS_TRIE (51U | MACH_LC_REQUIRE_DYLD)
///
/// used with linkedit_data_command
///
#define MACH_LOAD_COMMAND_DYLD_CHAINED_FIXUPS (52U | MACH_LC_REQUIRE_DYLD)
///
/// used with fileset_entry_command
///
#define MACH_LOAD_COMMAND_FILESET_ENTRY (53U | MACH_LC_REQUIRE_DYLD)
typedef UINT32 MACH_LOAD_COMMAND_TYPE;
@ -1599,6 +1611,7 @@ typedef struct {
#define MACH_PLATFORM_IOSSIMULATOR 7U
#define MACH_PLATFORM_TVOSSIMULATOR 8U
#define MACH_PLATFORM_WATCHOSSIMULATOR 9U
#define MACH_PLATFORM_DRIVERKIT 10U
///
/// Known values for the tool field above.
@ -1867,7 +1880,8 @@ enum {
MachHeaderFileTypeBundle = 8,
MachHeaderFileTypeDynamicLinkerStub = 9,
MachHeaderFileTypeDsym = 10,
MachHeaderFileTypeKextBundle = 11
MachHeaderFileTypeKextBundle = 11,
MachHeaderFileTypeFileSet = 12,
};
typedef UINT32 MACH_HEADER_FILE_TYPE;

View File

@ -80,7 +80,7 @@ typedef struct EfiMemoryRange {
* Video information..
*/
struct Boot_Video {
struct Boot_VideoV1 {
UINT32 v_baseAddr; /* Base address of video memory */
UINT32 v_display; /* Display Code (if Applicable */
UINT32 v_rowBytes; /* Number of bytes per pixel row */
@ -88,7 +88,19 @@ struct Boot_Video {
UINT32 v_height; /* Height */
UINT32 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 */
uint8_t v_rotate; /* Rotation */
uint8_t v_resv_byte[3]; /* Reserved */
uint32_t v_resv[6]; /* Reserved */
uint64_t v_baseAddr; /* Base address of video memory */
};
typedef struct Boot_Video Boot_Video;
/* Values for v_display */
@ -96,6 +108,14 @@ typedef struct Boot_Video Boot_Video;
#define GRAPHICS_MODE 1
#define FB_TEXT_MODE 2
#define kBootVideoDepthMask (0xFF)
#define kBootVideoDepthDepthShift (0)
#define kBootVideoDepthRotateShift (8)
#define kBootVideoDepthScaleShift (16)
#define kBootFlagsDarkBoot (1 << 0)
/* Boot argument structure - passed into Mach kernel at boot time.
* "Revision" can be incremented for compatible changes
*/
@ -110,6 +130,7 @@ typedef struct Boot_Video Boot_Video;
#define kBootArgsVersion2 2
#define kBootArgsRevision2_0 0
#define kBootArgsRevision2_1 1
#define kBootArgsEfiMode32 32
#define kBootArgsEfiMode64 64
@ -136,6 +157,7 @@ typedef struct Boot_Video Boot_Video;
#define CSR_ALLOW_DEVICE_CONFIGURATION (1 << 7)
#define CSR_ALLOW_ANY_RECOVERY_OS (1 << 8)
#define CSR_ALLOW_UNAPPROVED_KEXTS (1 << 9)
#define CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE (1 << 10)
#define CSR_VALID_FLAGS (CSR_ALLOW_UNTRUSTED_KEXTS | \
@ -147,8 +169,17 @@ typedef struct Boot_Video Boot_Video;
CSR_ALLOW_UNRESTRICTED_NVRAM | \
CSR_ALLOW_DEVICE_CONFIGURATION | \
CSR_ALLOW_ANY_RECOVERY_OS | \
CSR_ALLOW_UNAPPROVED_KEXTS)
CSR_ALLOW_UNAPPROVED_KEXTS | \
CSR_ALLOW_EXECUTABLE_POLICY_OVERRIDE)
#define CSR_ALWAYS_ENFORCED_FLAGS (CSR_ALLOW_DEVICE_CONFIGURATION | CSR_ALLOW_ANY_RECOVERY_OS)
/* 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 {
@ -162,7 +193,7 @@ typedef struct {
UINT32 MemoryMapDescriptorSize;
UINT32 MemoryMapDescriptorVersion;
Boot_Video Video; /* Video Information */
Boot_VideoV1 Video; /* Video Information */
UINT32 deviceTreeP; /* Physical address of flattened device tree */
UINT32 deviceTreeLength; /* Length of flattened tree */
@ -183,7 +214,7 @@ typedef struct {
UINT32 __reserved3[2];
} BootArgs1;
//version2 as used in Lion
//version2 as used in Lion up to Mojave
typedef struct {
UINT16 Revision; /* Revision of boot_args structure */
@ -200,7 +231,7 @@ typedef struct {
UINT32 MemoryMapDescriptorSize;
UINT32 MemoryMapDescriptorVersion;
Boot_Video Video; /* Video Information */
Boot_VideoV1 VideoV1; /* Video Information */
UINT32 deviceTreeP; /* Physical address of flattened device tree */
UINT32 deviceTreeLength; /* Length of flattened tree */
@ -228,9 +259,26 @@ typedef struct {
UINT32 pciConfigSpaceStartBusNumber;
UINT32 pciConfigSpaceEndBusNumber;
UINT32 csrActiveConfig;
UINT32 csrPendingConfig;
UINT32 __reserved4[728];
uint32_t csrCapabilities;
uint32_t boot_SMC_plimit;
uint16_t bootProgressMeterStart;
uint16_t bootProgressMeterEnd;
Boot_Video Video; /* Video Information */
uint32_t apfsDataStart;/* Physical address of apfs volume key structure */
uint32_t apfsDataSize;
/* Version 2, Revision 1 */
UINT64 KC_hdrs_vaddr; /* First kernel virtual address pointing to Mach-O headers */
UINT64 arvRootHashStart; /* Physical address of root hash file */
UINT64 arvRootHashSize;
UINT64 arvManifestStart; /* Physical address of manifest file */
UINT64 arvManifestSize;
/* Reserved */
UINT32 __reserved4[700];
} BootArgs2;

View File

@ -75,14 +75,19 @@ EFI_GUID GPT_EMPTY_PARTITION = \
// 26baccba-6f42-11d4-bce7-008081883cc7
// 63FAECF2-E7EE-4CB9-8A0C-11CE5E89E33C protocol at FinalizeBootStruct or DrawBootGraphics
// 03B99B90-ECCF-451D-809E-8341FCB830AC RestartData protocol
// 24B73556-2197-4702-82A8-3E1337DAFBF2 before Firmware password
// 24B73556-2197-4702-82A8-3E1337DAFBF2 before Firmware password APPLE_SECURE_BOOT_PROTOCOL_GUID
// 24B73556-2197-4702-82A8-3E1337DAFBF3
// 1BAD711C-D451-4241-B1F3-8537812E0C70 GUID for MeBiosExtensionSetup variable
// 36C28AB5-6566-4C50-9EBD-CBB920F83843:preferred-networks gAppleWirelessNetworkVariableGuid
// ->SetVariable(boot-feature-usage, 62BF9B1C-8568-48EE-85DC-DD3057660863, 7, 8, 4C4ABBE8) = Success
// 00 00 08 00 00 00 00 00 | ........
// gAppleFpfConfigurationHobGuid = { 0xE3CC8EC6, 0x81C1, 0x4271, { 0xAC, 0xBC, 0xDB, 0x65, 0x08, 0x6E, 0x8D, 0xC8 }}
/*
#define APPLE_SECURE_BOOT_VARIABLE_GUID \
{ 0x94B73556, 0x2197, 0x4702, \
{ 0x82, 0xA8, 0x3E, 0x13, 0x37, 0xDA, 0xFB, 0xFB } }
->SetVariable(ApECID, 94B73556-2197-4702-82A8-3E1337DAFBFB, 6, 8, 4C4ABC90) = Success
1C 02 1B 03 0D 04 66 05 | ......f.
->SetVariable(ApChipID, 94B73556-2197-4702-82A8-3E1337DAFBFB, 6, 4, 4C4ABCB4) = Success