├── README.md ├── sdk └── include │ ├── EfiApi.h │ ├── EfiCapsule.h │ ├── EfiCommon.h │ ├── EfiDevicePath.h │ ├── EfiError.h │ ├── EfiFirmwareFileSystem.h │ ├── EfiFirmwareVolume.h │ ├── EfiFirmwareVolumeHeader.h │ ├── EfiImage.h │ ├── EfiImageFormat.h │ ├── EfiPci.h │ ├── EfiStatusCode.h │ ├── EfiStdArg.h │ ├── EfiTypes.h │ ├── Guid │ ├── Acpi │ │ └── Acpi.h │ ├── AppleAcpiVariable │ │ └── AppleAcpiVariable.h │ ├── AppleFileVaultVariable │ │ └── AppleFileVaultVariable.h │ ├── AppleFirmwareFileName │ │ └── AppleFirmwareFileName.h │ ├── AppleFirmwareVariable │ │ └── AppleFirmwareVariable.h │ ├── AppleNVRAMVariable │ │ └── AppleNVRAMVariable.h │ ├── AppleRamDmgDevicePath │ │ └── AppleRamDmgDevicePath.h │ └── Smbios │ │ └── SmBios.h │ ├── IndustryStandard │ ├── Acpi.h │ ├── Acpi1_0.h │ ├── Acpi2_0.h │ ├── Acpi3_0.h │ ├── AcpiCommon.h │ ├── Smbios.h │ ├── pci.h │ ├── pci22.h │ ├── pci23.h │ └── pci30.h │ ├── Protocol │ ├── AppleDeviceControl │ │ └── AppleDeviceControl.h │ ├── AppleDeviceProperty │ │ └── AppleDeviceProperty.h │ ├── AppleDiskIo │ │ └── AppleDiskIo.h │ ├── AppleFirmwarePassword │ │ └── AppleFirmwarePassword.h │ ├── AppleGraphConfig │ │ └── AppleGraphConfig.h │ ├── AppleGraphInfo │ │ └── AppleGraphInfo.h │ ├── AppleImageCodec │ │ └── AppleImageCodec.h │ ├── AppleKeyState │ │ └── AppleKeyState.h │ ├── AppleNetBoot │ │ └── AppleNetBoot.h │ ├── AppleSMC │ │ └── AppleSMC.h │ ├── AppleSystemInfo │ │ └── AppleSystemInfo.h │ ├── BlockIO │ │ └── BlockIO.h │ ├── ConsoleControl │ │ └── ConsoleControl.h │ ├── DataHub │ │ └── DataHub.h │ ├── DevicePath │ │ └── DevicePath.h │ ├── DiskIO │ │ └── DiskIo.h │ ├── FileInfo │ │ └── FileInfo.h │ ├── FirmwareVolume │ │ └── FirmwareVolume.h │ ├── FirmwareVolumeDispatch │ │ └── FirmwareVolumeDispatch.h │ ├── GraphicsOutput │ │ └── GraphicsOutput.h │ ├── LoadFile │ │ └── LoadFile.h │ ├── LoadedImage │ │ └── LoadedImage.h │ ├── PciIo │ │ └── PciIo.h │ ├── SimpleFileSystem │ │ └── SimpleFileSystem.h │ ├── SimplePointer │ │ └── SimplePointer.h │ ├── SimpleTextIn │ │ └── SimpleTextIn.h │ ├── SimpleTextOut │ │ └── SimpleTextOut.h │ └── UgaDraw │ │ └── UgaDraw.h │ ├── x64 │ ├── EfiBind.h │ └── EfiPeOptionalHeader.h │ └── x86 │ ├── EfiBind.h │ └── EfiPeOptionalHeader.h └── src ├── boot.sln ├── boot ├── AcpiUtils.cpp ├── AcpiUtils.h ├── ArchUtils.h ├── Base64.cpp ├── Base64.h ├── BootArgs.cpp ├── BootArgs.h ├── BootDebugger.cpp ├── BootDebugger.h ├── BootDebuggerPrivate.h ├── Config.cpp ├── Config.h ├── Console.cpp ├── Console.h ├── Crc32.cpp ├── Crc32.h ├── Debug1394.cpp ├── Debug1394.h ├── DebugUsb.cpp ├── DebugUsb.h ├── DevicePath.cpp ├── DevicePath.h ├── DeviceTree.cpp ├── DeviceTree.h ├── FileIo.cpp ├── FileIo.h ├── FileVault.cpp ├── FileVault.h ├── GuidDefine.cpp ├── GuidDefine.h ├── Hibernate.cpp ├── Hibernate.h ├── LoadDrivers.cpp ├── LoadDrivers.h ├── LoadKernel.cpp ├── LoadKernel.h ├── MD5.cpp ├── MD5.h ├── MachO.cpp ├── MachO.h ├── Main.cpp ├── Memory.cpp ├── Memory.h ├── MemoryMap.cpp ├── MemoryMap.h ├── MiscUtils.cpp ├── MiscUtils.h ├── NetBoot.cpp ├── NetBoot.h ├── Options.cpp ├── Options.h ├── PanicDialog.cpp ├── PanicDialog.h ├── PeImage.cpp ├── PeImage.h ├── PictData.h ├── PlatformExpert.cpp ├── PlatformExpert.h ├── RuntimeLib.cpp ├── RuntimeLib.h ├── SHA256.cpp ├── SHA256.h ├── StdAfx.cpp ├── StdAfx.h ├── boot.vcxproj ├── boot.vcxproj.filters ├── x64 │ ├── ArchDefine.h │ ├── ArchUtilsX64.cpp │ ├── Common.inc │ ├── CompilerX64.asm │ ├── DebugTrap.asm │ ├── DebuggerUtilsX64.cpp │ ├── PortRegisterIo.asm │ └── TransferRoutine.asm └── x86 │ ├── ArchDefine.h │ ├── ArchUtilsX86.cpp │ ├── CompilerX86.cpp │ ├── DebuggerUtilsX86.cpp │ ├── Thunk64.cpp │ ├── ThunkCode32.asm │ └── ThunkCode64.asm ├── common.props ├── debug.props ├── release.props └── rijndael ├── aes.h ├── aes_modes.c ├── aes_via_ace.h ├── aescrypt.c ├── aeskey.c ├── aesopt.h ├── aestab.c ├── aestab.h ├── aesxts.c ├── aesxts.h ├── brg_endian.h ├── brg_types.h ├── rijndael.vcxproj └── rijndael.vcxproj.filters /README.md: -------------------------------------------------------------------------------- 1 | macosxbootloader 2 | ================ 3 | 4 | A homebrew bootloader for OS X 10.9 5 | 6 | This is the native EFI32 bootloader written by tiamo. This is just a 7 | Git clone of tiamo's Subversion repository. 8 | -------------------------------------------------------------------------------- /sdk/include/EfiCapsule.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004 - 2007, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | EfiCapsule.h 15 | 16 | Abstract: 17 | 18 | Defines for the EFI Capsule functionality 19 | 20 | --*/ 21 | 22 | #ifndef _EFI_CAPSULE_H_ 23 | #define _EFI_CAPSULE_H_ 24 | 25 | 26 | #define CAPSULE_BLOCK_DESCRIPTOR_SIGNATURE EFI_SIGNATURE_32 ('C', 'B', 'D', 'S') 27 | 28 | typedef struct { 29 | EFI_GUID OemGuid; 30 | UINT32 HeaderSize; 31 | // 32 | // UINT8 OemHdrData[]; 33 | // 34 | } EFI_CAPSULE_OEM_HEADER; 35 | 36 | #if (EFI_SPECIFICATION_VERSION >= 0x00020000) 37 | 38 | #define MAX_SUPPORT_CAPSULE_NUM 50 39 | #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000 40 | #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000 41 | 42 | typedef struct { 43 | UINT64 Length; 44 | union { 45 | EFI_PHYSICAL_ADDRESS DataBlock; 46 | EFI_PHYSICAL_ADDRESS ContinuationPointer; 47 | } Union; 48 | } EFI_CAPSULE_BLOCK_DESCRIPTOR; 49 | 50 | typedef struct { 51 | EFI_GUID CapsuleGuid; 52 | UINT32 HeaderSize; 53 | UINT32 Flags; 54 | UINT32 CapsuleImageSize; 55 | } EFI_CAPSULE_HEADER; 56 | 57 | typedef struct { 58 | UINT32 CapsuleArrayNumber; 59 | VOID* CapsulePtr[1]; 60 | } EFI_CAPSULE_TABLE; 61 | 62 | // 63 | // This struct is deprecated because VendorTable entries physical address will not be fixed up when 64 | // transitioning from preboot to runtime phase. So we don't need CapsuleInfoTable to record capsule 65 | // GUIDs any more for runtime convert. 66 | // 67 | typedef struct { 68 | UINT32 CapsuleGuidNumber; 69 | EFI_GUID CapsuleGuidPtr[1]; 70 | } EFI_CAPSULE_INFO_TABLE; 71 | 72 | // 73 | // This GUID is used for collecting all capsules' Guids who install in ConfigTable. 74 | // This GUID is deprecated as well. 75 | // 76 | #define EFI_CAPSULE_INFO_GUID \ 77 | { \ 78 | 0x8B34EAC7, 0x2690, 0x460B, 0x8B, 0xA5, 0xD5, 0xCF, 0x32, 0x83, 0x17, 0x35 \ 79 | } 80 | 81 | #else 82 | 83 | typedef struct { 84 | EFI_GUID CapsuleGuid; 85 | UINT32 HeaderSize; 86 | UINT32 Flags; 87 | UINT32 CapsuleImageSize; 88 | UINT32 SequenceNumber; 89 | EFI_GUID InstanceId; 90 | UINT32 OffsetToSplitInformation; 91 | UINT32 OffsetToCapsuleBody; 92 | UINT32 OffsetToOemDefinedHeader; 93 | UINT32 OffsetToAuthorInformation; 94 | UINT32 OffsetToRevisionInformation; 95 | UINT32 OffsetToShortDescription; 96 | UINT32 OffsetToLongDescription; 97 | UINT32 OffsetToApplicableDevices; 98 | } EFI_CAPSULE_HEADER; 99 | 100 | // 101 | // An array of these describe the blocks that make up a capsule for 102 | // a capsule update. 103 | // 104 | typedef struct { 105 | UINT64 Length; // length of the data block 106 | EFI_PHYSICAL_ADDRESS Data; // physical address of the data block 107 | UINT32 Signature; // CBDS 108 | UINT32 CheckSum; // to sum this structure to 0 109 | } EFI_CAPSULE_BLOCK_DESCRIPTOR; 110 | 111 | #endif 112 | 113 | // 114 | // Bits in the flags field of the capsule header 115 | // 116 | #define EFI_CAPSULE_HEADER_FLAG_SETUP 0x00000001 // supports setup changes 117 | // 118 | // This is the GUID of the capsule header of the image on disk. 119 | // 120 | #define EFI_CAPSULE_GUID \ 121 | { \ 122 | 0x3B6686BD, 0x0D76, 0x4030, 0xB7, 0x0E, 0xB5, 0x51, 0x9E, 0x2F, 0xC5, 0xA0 \ 123 | } 124 | 125 | // 126 | // This is the GUID of the file created by the capsule application that contains 127 | // the path to the device(s) to update. 128 | // 129 | #define EFI_PATH_FILE_NAME_GUID \ 130 | { \ 131 | 0x7644C181, 0xFA6E, 0x46DA, 0x80, 0xCB, 0x04, 0xB9, 0x90, 0x40, 0x62, 0xE8 \ 132 | } 133 | // 134 | // This is the GUID of the configuration results file created by the capsule 135 | // application. 136 | // 137 | #define EFI_CONFIG_FILE_NAME_GUID \ 138 | { \ 139 | 0x98B8D59B, 0xE8BA, 0x48EE, 0x98, 0xDD, 0xC2, 0x95, 0x39, 0x2F, 0x1E, 0xDB \ 140 | } 141 | 142 | #endif // #ifndef _EFI_CAPSULE_H_ 143 | -------------------------------------------------------------------------------- /sdk/include/EfiCommon.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | EfiCommon.h 15 | 16 | Abstract: 17 | 18 | --*/ 19 | 20 | #ifndef _EFI_COMMON_H_ 21 | #define _EFI_COMMON_H_ 22 | 23 | #include "EfiBind.h" 24 | #include "EfiTypes.h" 25 | #include "EfiStdArg.h" 26 | #include "EfiError.h" 27 | 28 | // 29 | // Define macros for including Protocols and Guids. 30 | // 31 | #define EFI_STRINGIZE(a) #a 32 | #define EFI_PROTOCOL_DEFINITION(a) EFI_STRINGIZE (Protocol/a/a.h) 33 | #define EFI_GUID_DEFINITION(a) EFI_STRINGIZE (Guid/a/a.h) 34 | 35 | // 36 | // These should be used to include protocols. If they are followed, 37 | // intelligent build tools can be created to check dependencies at build 38 | // time. 39 | // 40 | #define EFI_PROTOCOL_PRODUCER(a) EFI_PROTOCOL_DEFINITION (a) 41 | #define EFI_PROTOCOL_CONSUMER(a) EFI_PROTOCOL_DEFINITION (a) 42 | #define EFI_PROTOCOL_DEPENDENCY(a) EFI_PROTOCOL_DEFINITION (a) 43 | 44 | // 45 | // Mechanism to associate a short and long ascii string with a GUID. 46 | // For normal builds the strings are not included. A build utility 47 | // can be constructed to extract the strings and build a table. It may 48 | // be possible to add a build opption to automatically generate a GUID 49 | // string table for a GUID to string utility build. 50 | // 51 | #define EFI_GUID_STRING(guidpointer, shortstring, longstring) 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /sdk/include/EfiError.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004 - 2008, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | EfiError.h 15 | 16 | Abstract: 17 | 18 | EFI error levels and thier associated defines 19 | 20 | --*/ 21 | 22 | #ifndef _EFI_ERROR_H_ 23 | #define _EFI_ERROR_H_ 24 | 25 | // 26 | // Set the upper bit to indicate EFI Error. 27 | // 28 | #define EFIERR(a) (EFI_MAX_BIT | (a)) 29 | 30 | #define EFIWARN(a) (a) 31 | #define EFI_ERROR(a) (((INTN) (a)) < 0) 32 | 33 | #define EFI_SUCCESS 0 34 | #define EFI_LOAD_ERROR EFIERR (1) 35 | #define EFI_INVALID_PARAMETER EFIERR (2) 36 | #define EFI_UNSUPPORTED EFIERR (3) 37 | #define EFI_BAD_BUFFER_SIZE EFIERR (4) 38 | #define EFI_BUFFER_TOO_SMALL EFIERR (5) 39 | #define EFI_NOT_READY EFIERR (6) 40 | #define EFI_DEVICE_ERROR EFIERR (7) 41 | #define EFI_WRITE_PROTECTED EFIERR (8) 42 | #define EFI_OUT_OF_RESOURCES EFIERR (9) 43 | #define EFI_VOLUME_CORRUPTED EFIERR (10) 44 | #define EFI_VOLUME_FULL EFIERR (11) 45 | #define EFI_NO_MEDIA EFIERR (12) 46 | #define EFI_MEDIA_CHANGED EFIERR (13) 47 | #define EFI_NOT_FOUND EFIERR (14) 48 | #define EFI_ACCESS_DENIED EFIERR (15) 49 | #define EFI_NO_RESPONSE EFIERR (16) 50 | #define EFI_NO_MAPPING EFIERR (17) 51 | #define EFI_TIMEOUT EFIERR (18) 52 | #define EFI_NOT_STARTED EFIERR (19) 53 | #define EFI_ALREADY_STARTED EFIERR (20) 54 | #define EFI_ABORTED EFIERR (21) 55 | #define EFI_ICMP_ERROR EFIERR (22) 56 | #define EFI_TFTP_ERROR EFIERR (23) 57 | #define EFI_PROTOCOL_ERROR EFIERR (24) 58 | #define EFI_INCOMPATIBLE_VERSION EFIERR (25) 59 | #define EFI_SECURITY_VIOLATION EFIERR (26) 60 | #define EFI_CRC_ERROR EFIERR (27) 61 | #define EFI_END_OF_MEDIA EFIERR (28) 62 | #define EFI_END_OF_FILE EFIERR (31) 63 | #define EFI_INVALID_LANGUAGE EFIERR (32) 64 | 65 | #define EFI_WARN_UNKNOWN_GLYPH EFIWARN (1) 66 | #define EFI_WARN_DELETE_FAILURE EFIWARN (2) 67 | #define EFI_WARN_WRITE_FAILURE EFIWARN (3) 68 | #define EFI_WARN_BUFFER_TOO_SMALL EFIWARN (4) 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /sdk/include/EfiFirmwareFileSystem.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004 - 2009, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | EfiFirmwareFileSystem.h 15 | 16 | Abstract: 17 | 18 | This file defines the data structures that comprise the FFS file system. 19 | 20 | --*/ 21 | 22 | #ifndef _EFI_FFS_FILE_SYSTEM_H_ 23 | #define _EFI_FFS_FILE_SYSTEM_H_ 24 | 25 | #include "EfiImageFormat.h" 26 | 27 | // 28 | // GUIDs defined by the FFS specification. 29 | // 30 | #define EFI_FIRMWARE_FILE_SYSTEM_GUID \ 31 | { \ 32 | 0x7A9354D9, 0x0468, 0x444a, 0x81, 0xCE, 0x0B, 0xF6, 0x17, 0xD8, 0x90, 0xDF \ 33 | } 34 | 35 | #define EFI_FFS_VOLUME_TOP_FILE_GUID \ 36 | { \ 37 | 0x1BA0062E, 0xC779, 0x4582, 0x85, 0x66, 0x33, 0x6A, 0xE8, 0xF7, 0x8F, 0x9 \ 38 | } 39 | 40 | // 41 | // FFS specific file types 42 | // 43 | #define EFI_FV_FILETYPE_FFS_PAD 0xF0 44 | 45 | // 46 | // FFS File Attributes 47 | // 48 | #define FFS_ATTRIB_TAIL_PRESENT 0x01 49 | #define FFS_ATTRIB_RECOVERY 0x02 50 | #define FFS_ATTRIB_DATA_ALIGNMENT 0x38 51 | #define FFS_ATTRIB_CHECKSUM 0x40 52 | #if (PI_SPECIFICATION_VERSION < 0x00010000) 53 | #define FFS_ATTRIB_HEADER_EXTENSION 0x04 54 | #else 55 | // 56 | // PI 1.0 definition. 57 | // 58 | #define FFS_ATTRIB_FIXED 0x04 59 | #endif 60 | 61 | 62 | // 63 | // FFS_FIXED_CHECKSUM is the default checksum value used when the 64 | // FFS_ATTRIB_CHECKSUM attribute bit is clear 65 | // note this is NOT an architecturally defined value, but is in this file for 66 | // implementation convenience 67 | // 68 | #if (PI_SPECIFICATION_VERSION < 0x00010000) 69 | #define FFS_FIXED_CHECKSUM 0x5A 70 | #else 71 | #define FFS_FIXED_CHECKSUM 0xAA 72 | #endif 73 | 74 | // 75 | // File state definitions 76 | // 77 | #define EFI_FILE_HEADER_CONSTRUCTION 0x01 78 | #define EFI_FILE_HEADER_VALID 0x02 79 | #define EFI_FILE_DATA_VALID 0x04 80 | #define EFI_FILE_MARKED_FOR_UPDATE 0x08 81 | #define EFI_FILE_DELETED 0x10 82 | #define EFI_FILE_HEADER_INVALID 0x20 83 | 84 | #define EFI_FILE_ALL_STATE_BITS (EFI_FILE_HEADER_CONSTRUCTION | \ 85 | EFI_FILE_HEADER_VALID | \ 86 | EFI_FILE_DATA_VALID | \ 87 | EFI_FILE_MARKED_FOR_UPDATE | \ 88 | EFI_FILE_DELETED | \ 89 | EFI_FILE_HEADER_INVALID \ 90 | ) 91 | 92 | #define EFI_TEST_FFS_ATTRIBUTES_BIT(FvbAttributes, TestAttributes, Bit) \ 93 | ( \ 94 | (BOOLEAN) ( \ 95 | (FvbAttributes & EFI_FVB_ERASE_POLARITY) ? (((~TestAttributes) & Bit) == Bit) : ((TestAttributes & Bit) == Bit) \ 96 | ) \ 97 | ) 98 | 99 | // 100 | // FFS file integrity check structure 101 | // 102 | typedef UINT16 EFI_FFS_FILE_TAIL; 103 | 104 | typedef union { 105 | struct { 106 | UINT8 Header; 107 | UINT8 File; 108 | } Checksum; 109 | #if (PI_SPECIFICATION_VERSION < 0x00010000) 110 | UINT16 TailReference; 111 | #else 112 | UINT16 Checksum16; 113 | #endif 114 | } EFI_FFS_INTEGRITY_CHECK; 115 | 116 | // 117 | // FFS file header definition 118 | // 119 | typedef UINT8 EFI_FFS_FILE_ATTRIBUTES; 120 | typedef UINT8 EFI_FFS_FILE_STATE; 121 | 122 | typedef struct { 123 | EFI_GUID Name; 124 | EFI_FFS_INTEGRITY_CHECK IntegrityCheck; 125 | EFI_FV_FILETYPE Type; 126 | EFI_FFS_FILE_ATTRIBUTES Attributes; 127 | UINT8 Size[3]; 128 | EFI_FFS_FILE_STATE State; 129 | } EFI_FFS_FILE_HEADER; 130 | 131 | #endif 132 | -------------------------------------------------------------------------------- /sdk/include/EfiFirmwareVolume.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2007 , Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | EfiFirmwareVolume.h 15 | 16 | Abstract: 17 | 18 | --*/ 19 | 20 | #ifndef _EFI_FIRMWARE_VOLUME_H_ 21 | #define _EFI_FIRMWARE_VOLUME_H_ 22 | 23 | 24 | #define FV_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('_', 'F', 'V', '_') 25 | #define EFI_FV_FILE_ATTRIB_ALIGNMENT 0x0000001F 26 | #define EFI_FV_UNRELIABLE_WRITE 0x00000000 27 | #define EFI_FV_RELIABLE_WRITE 0x00000001 28 | 29 | 30 | // 31 | // EFI_FV_ATTRIBUTES bit definitions 32 | // 33 | typedef UINT64 EFI_FV_ATTRIBUTES; 34 | typedef UINT32 EFI_FV_FILE_ATTRIBUTES; 35 | typedef UINT32 EFI_FV_WRITE_POLICY; 36 | 37 | 38 | typedef struct { 39 | EFI_GUID *NameGuid; 40 | EFI_FV_FILETYPE Type; 41 | EFI_FV_FILE_ATTRIBUTES FileAttributes; 42 | VOID *Buffer; 43 | UINT32 BufferSize; 44 | } EFI_FV_WRITE_FILE_DATA; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /sdk/include/EfiPci.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2006, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | EfiPci.h 15 | 16 | Abstract: 17 | Support for EFI PCI specification. 18 | 19 | Revision History 20 | 21 | --*/ 22 | 23 | #ifndef _EFI_PCI_H_ 24 | #define _EFI_PCI_H_ 25 | 26 | //#include "pci22.h" 27 | //#include "pci23.h" 28 | //#include "pci30.h" 29 | 30 | #pragma pack(push, 1) 31 | 32 | typedef struct { 33 | UINT8 Register; 34 | UINT8 Function; 35 | UINT8 Device; 36 | UINT8 Bus; 37 | UINT8 Reserved[4]; 38 | } DEFIO_PCI_ADDR; 39 | 40 | #define EFI_ROOT_BRIDGE_LIST 'eprb' 41 | #define EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE 0x0EF1 42 | 43 | typedef struct { 44 | UINT16 Signature; // 0xaa55 45 | UINT16 InitializationSize; 46 | UINT32 EfiSignature; // 0x0EF1 47 | UINT16 EfiSubsystem; 48 | UINT16 EfiMachineType; 49 | UINT16 CompressionType; 50 | UINT8 Reserved[8]; 51 | UINT16 EfiImageHeaderOffset; 52 | UINT16 PcirOffset; 53 | } EFI_PCI_EXPANSION_ROM_HEADER; 54 | 55 | typedef union { 56 | UINT8 *Raw; 57 | PCI_EXPANSION_ROM_HEADER *Generic; 58 | EFI_PCI_EXPANSION_ROM_HEADER *Efi; 59 | EFI_LEGACY_EXPANSION_ROM_HEADER *PcAt; 60 | } EFI_PCI_ROM_HEADER; 61 | 62 | #pragma pack(pop) 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /sdk/include/EfiStdArg.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | EfiStdArg.h 15 | 16 | Abstract: 17 | 18 | Support for variable length argument lists using the ANSI standard. 19 | 20 | Since we are using the ANSI standard we used the standard nameing and 21 | did not folow the coding convention 22 | 23 | VA_LIST - typedef for argument list. 24 | VA_START (VA_LIST Marker, argument before the ...) - Init Marker for use. 25 | VA_END (VA_LIST Marker) - Clear Marker 26 | VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argumnet from 27 | the ... list. You must know the size and pass it in this macro. 28 | 29 | example: 30 | 31 | UINTN 32 | ExampleVarArg ( 33 | IN UINTN NumberOfArgs, 34 | ... 35 | ) 36 | { 37 | VA_LIST Marker; 38 | UINTN Index; 39 | UINTN Result; 40 | 41 | // 42 | // Initialize the Marker 43 | // 44 | VA_START (Marker, NumberOfArgs); 45 | for (Index = 0, Result = 0; Index < NumberOfArgs; Index++) { 46 | // 47 | // The ... list is a series of UINTN values, so average them up. 48 | // 49 | Result += VA_ARG (Marker, UINTN); 50 | } 51 | 52 | VA_END (Marker); 53 | return Result 54 | } 55 | 56 | --*/ 57 | 58 | #ifndef _EFISTDARG_H_ 59 | #define _EFISTDARG_H_ 60 | 61 | #define _EFI_INT_SIZE_OF(n) ((sizeof (n) + sizeof (UINTN) - 1) &~(sizeof (UINTN) - 1)) 62 | 63 | // 64 | // Also support coding convention rules for var arg macros 65 | // 66 | #ifndef VA_START 67 | 68 | typedef CHAR8 *VA_LIST; 69 | #define VA_START(ap, v) (ap = (VA_LIST) & (v) + _EFI_INT_SIZE_OF (v)) 70 | #define VA_ARG(ap, t) (*(t *) ((ap += _EFI_INT_SIZE_OF (t)) - _EFI_INT_SIZE_OF (t))) 71 | #define VA_END(ap) (ap = (VA_LIST) 0) 72 | 73 | #endif 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /sdk/include/Guid/Acpi/Acpi.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004 - 2005, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | Acpi.h 15 | 16 | Abstract: 17 | 18 | GUIDs used for ACPI entries in the in the EFI 1.0 system table 19 | 20 | These GUIDs point the ACPI tables as defined in the ACPI specifications. 21 | ACPI 2.0 specification defines the ACPI 2.0 GUID. EFI 1.0 defines the 22 | ACPI 1.0 GUID. 23 | 24 | --*/ 25 | 26 | #ifndef _ACPI_GUID_H_ 27 | #define _ACPI_GUID_H_ 28 | 29 | #define EFI_ACPI_TABLE_GUID \ 30 | { \ 31 | 0xeb9d2d30, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d \ 32 | } 33 | 34 | #define EFI_ACPI_20_TABLE_GUID \ 35 | { \ 36 | 0x8868e871, 0xe4f1, 0x11d3, 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 \ 37 | } 38 | 39 | #define EFI_ACPI_30_TABLE_GUID EFI_ACPI_20_TABLE_GUID 40 | 41 | extern EFI_GUID gEfiAcpiTableGuid; 42 | extern EFI_GUID gEfiAcpi20TableGuid; 43 | extern EFI_GUID gEfiAcpi30TableGuid; 44 | #endif 45 | -------------------------------------------------------------------------------- /sdk/include/Guid/AppleAcpiVariable/AppleAcpiVariable.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 27:8:2012 21:30 3 | // filename: AppleAcpiVariable.h 4 | // author: tiamo 5 | // purpose: apple acpi variable 6 | //******************************************************************** 7 | 8 | #ifndef _APPLE_ACPI_VARIABLE_H_ 9 | #define _APPLE_ACPI_VARIABLE_H_ 10 | 11 | #define APPLE_ACPI_VARIABLE_GUID {0xaf9ffd67, 0xec10, 0x488a, 0x9d, 0xfc, 0x6c, 0xbf, 0x5e, 0xe2, 0x2c, 0x2e} 12 | 13 | extern EFI_GUID gAppleAcpiVariableGuid; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /sdk/include/Guid/AppleFileVaultVariable/AppleFileVaultVariable.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 30:9:2012 1:50 3 | // filename: AppleFileVaultVariable.h 4 | // author: tiamo 5 | // purpose: apple file vault variable 6 | //******************************************************************** 7 | 8 | #ifndef _APPLE_FILE_VAULT_VARIABLE_H_ 9 | #define _APPLE_FILE_VAULT_VARIABLE_H_ 10 | 11 | #define APPLE_FILE_VAULT_VARIABLE_GUID {0x8d63d4fe, 0xbd3c, 0x4aad, 0x88, 0x1d, 0x86, 0xfd, 0x97, 0x4b, 0xc1, 0xdf} 12 | 13 | extern EFI_GUID gAppleFileVaultVariableGuid; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /sdk/include/Guid/AppleFirmwareFileName/AppleFirmwareFileName.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 26:8:2012 17:00 3 | // filename: AppleFirmwareFileName.h 4 | // author: tiamo 5 | // purpose: apple firmware file name 6 | //******************************************************************** 7 | 8 | #ifndef _APPLE_FIRMWARE_FILE_NAME_H_ 9 | #define _APPLE_FIRMWARE_FILE_NAME_H_ 10 | 11 | #define APPLE_PASSWORD_UI_EFI_FILE_NAME_GUID {0x9eba2d25, 0xbbe3, 0x4ac2, 0xa2, 0xc6, 0xc8, 0x7f, 0x44, 0xa1, 0x27, 0x8c} 12 | 13 | extern EFI_GUID gApplePasswordUIEfiFileNameGuid; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /sdk/include/Guid/AppleFirmwareVariable/AppleFirmwareVariable.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 21:8:2012 21:41 3 | // filename: AppleFirmwareVariable.h 4 | // author: tiamo 5 | // purpose: apple firmware variable 6 | //******************************************************************** 7 | 8 | #ifndef _APPLE_FIRMWARE_VARIABLE_H_ 9 | #define _APPLE_FIRMWARE_VARIABLE_H_ 10 | 11 | #define APPLE_FIRMWARE_VARIABLE_GUID {0x4d1ede05, 0x38c7, 0x4a6a, 0x9c, 0xc6, 0x4b, 0xcc, 0xa8, 0xb3, 0x8c, 0x14} 12 | 13 | extern EFI_GUID gAppleFirmwareVariableGuid; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /sdk/include/Guid/AppleNVRAMVariable/AppleNVRAMVariable.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 4:8:2012 17:54 3 | // filename: AppleNVRAMVariable.h 4 | // author: tiamo 5 | // purpose: apple nvram variable guid 6 | //******************************************************************** 7 | 8 | #ifndef _APPLE_NVRAM_VARIABLE_H_ 9 | #define _APPLE_NVRAM_VARIABLE_H_ 10 | 11 | #define APPLE_NVRAM_VARIABLE_GUID {0x7c436110, 0xab2a, 0x4bbb, 0xa8, 0x80, 0xfe, 0x41, 0x99, 0x5c, 0x9f, 0x82} 12 | 13 | extern EFI_GUID gAppleNVRAMVariableGuid; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /sdk/include/Guid/AppleRamDmgDevicePath/AppleRamDmgDevicePath.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 28:8:2012 19:00 3 | // filename: AppleRamDmgDevicePath.h 4 | // author: tiamo 5 | // purpose: apple ram dmg device path 6 | //******************************************************************** 7 | 8 | #ifndef _APPLE_RAM_DMG_DEVICE_PATH_H_ 9 | #define _APPLE_RAM_DMG_DEVICE_PATH_H_ 10 | 11 | #define APPLE_RAM_DMG_DEVICE_PATH_GUID {0x040b07e8, 0x0b9c, 0x427e, 0xb0, 0xd4, 0xa4, 0x66, 0xe6, 0xe5, 0x7a, 0x62} 12 | 13 | extern EFI_GUID gAppleRamDmgDevicePathGuid; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /sdk/include/Guid/Smbios/SmBios.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | SmBios.h 15 | 16 | Abstract: 17 | 18 | GUIDs used to locate the SMBIOS tables in the EFI 1.0 system table. 19 | 20 | This GUID in the system table is the only legal way to search for and 21 | locate the SMBIOS tables. Do not search the 0xF0000 segment to find SMBIOS 22 | tables. 23 | 24 | --*/ 25 | 26 | #ifndef _SMBIOS_GUID_H_ 27 | #define _SMBIOS_GUID_H_ 28 | 29 | #define EFI_SMBIOS_TABLE_GUID \ 30 | { \ 31 | 0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d \ 32 | } 33 | 34 | extern EFI_GUID gEfiSmbiosTableGuid; 35 | 36 | // 37 | // Smbios Table Entry Point Structure 38 | // 39 | #pragma pack(1) 40 | typedef struct { 41 | UINT8 AnchorString[4]; 42 | UINT8 EntryPointStructureChecksum; 43 | UINT8 EntryPointLength; 44 | UINT8 MajorVersion; 45 | UINT8 MinorVersion; 46 | UINT16 MaxStructureSize; 47 | UINT8 EntryPointRevision; 48 | UINT8 FormattedArea[5]; 49 | UINT8 IntermediateAnchorString[5]; 50 | UINT8 IntermediateChecksum; 51 | UINT16 TableLength; 52 | UINT32 TableAddress; 53 | UINT16 NumberOfSmbiosStructures; 54 | UINT8 SmbiosBcdRevision; 55 | } SMBIOS_TABLE_ENTRY_POINT; 56 | #pragma pack() 57 | // 58 | // The Smbios structure header 59 | // 60 | #pragma pack(1) 61 | typedef struct { 62 | 63 | UINT8 Type; 64 | UINT8 Length; 65 | UINT16 Handle; 66 | 67 | } SMBIOS_STRUCTURE; 68 | #pragma pack() 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /sdk/include/IndustryStandard/Acpi.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004 - 2007, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | Acpi.h 15 | 16 | Abstract: 17 | 18 | This file contains some basic ACPI definitions that are consumed by drivers 19 | that do not care about ACPI versions. 20 | 21 | --*/ 22 | 23 | #ifndef _ACPI_H_ 24 | #define _ACPI_H_ 25 | 26 | #include "AcpiCommon.h" 27 | #include "Acpi1_0.h" 28 | #include "Acpi2_0.h" 29 | #include "Acpi3_0.h" 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /sdk/include/IndustryStandard/AcpiCommon.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2007, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | AcpiCommon.h 15 | 16 | Abstract: 17 | 18 | This file contains some basic ACPI definitions that are consumed by drivers 19 | that do not care about ACPI versions. 20 | 21 | --*/ 22 | 23 | #ifndef _ACPI_COMMON_H_ 24 | #define _ACPI_COMMON_H_ 25 | 26 | //#include "Tiano.h" 27 | 28 | // 29 | // Common table header, this prefaces all ACPI tables, including FACS, but 30 | // excluding the RSD PTR structure 31 | // 32 | typedef struct { 33 | UINT32 Signature; 34 | UINT32 Length; 35 | } EFI_ACPI_COMMON_HEADER; 36 | 37 | // 38 | // Common ACPI description table header. This structure prefaces most ACPI tables. 39 | // 40 | #pragma pack(1) 41 | 42 | typedef struct { 43 | UINT32 Signature; 44 | UINT32 Length; 45 | UINT8 Revision; 46 | UINT8 Checksum; 47 | UINT8 OemId[6]; 48 | UINT64 OemTableId; 49 | UINT32 OemRevision; 50 | UINT32 CreatorId; 51 | UINT32 CreatorRevision; 52 | } EFI_ACPI_DESCRIPTION_HEADER; 53 | 54 | #pragma pack() 55 | // 56 | // Define for Pci Host Bridge Resource Allocation 57 | // 58 | #define ACPI_ADDRESS_SPACE_DESCRIPTOR 0x8A 59 | #define ACPI_END_TAG_DESCRIPTOR 0x79 60 | 61 | #define ACPI_ADDRESS_SPACE_TYPE_MEM 0x00 62 | #define ACPI_ADDRESS_SPACE_TYPE_IO 0x01 63 | #define ACPI_ADDRESS_SPACE_TYPE_BUS 0x02 64 | 65 | // 66 | // Make sure structures match spec 67 | // 68 | #pragma pack(1) 69 | 70 | typedef struct { 71 | UINT8 Desc; 72 | UINT16 Len; 73 | UINT8 ResType; 74 | UINT8 GenFlag; 75 | UINT8 SpecificFlag; 76 | UINT64 AddrSpaceGranularity; 77 | UINT64 AddrRangeMin; 78 | UINT64 AddrRangeMax; 79 | UINT64 AddrTranslationOffset; 80 | UINT64 AddrLen; 81 | } EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR; 82 | 83 | typedef struct { 84 | UINT8 Desc; 85 | UINT8 Checksum; 86 | } EFI_ACPI_END_TAG_DESCRIPTOR; 87 | 88 | // 89 | // General use definitions 90 | // 91 | #define EFI_ACPI_RESERVED_BYTE 0x00 92 | #define EFI_ACPI_RESERVED_WORD 0x0000 93 | #define EFI_ACPI_RESERVED_DWORD 0x00000000 94 | #define EFI_ACPI_RESERVED_QWORD 0x0000000000000000 95 | 96 | #pragma pack() 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /sdk/include/IndustryStandard/pci.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2007, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | pci.h 15 | 16 | Abstract: 17 | Support for PCI standard. 18 | 19 | Revision History 20 | 21 | --*/ 22 | 23 | #ifndef _PCI_H 24 | #define _PCI_H 25 | 26 | #include "pci22.h" 27 | #include "pci23.h" 28 | #include "pci30.h" 29 | #include "EfiPci.h" 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /sdk/include/IndustryStandard/pci23.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2006 - 2009, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | pci23.h 15 | 16 | Abstract: 17 | Support for PCI 2.3 standard. 18 | 19 | Revision History 20 | 21 | --*/ 22 | 23 | #ifndef _PCI23_H 24 | #define _PCI23_H 25 | 26 | #include "pci22.h" 27 | 28 | // 29 | // PCI_CLASS_MASS_STORAGE 30 | // 31 | #define PCI_CLASS_MASS_STORAGE_ATA 0x05 32 | 33 | // 34 | // PCI_CLASS_SERIAL 35 | // 36 | #define PCI_CLASS_SERIAL_IB 0x06 37 | 38 | #define PCI_EXP_MAX_CONFIG_OFFSET 0x1000 39 | #define EFI_PCI_CAPABILITY_ID_PCIEXP 0x10 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /sdk/include/IndustryStandard/pci30.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2006 - 2007, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | pci30.h 15 | 16 | Abstract: 17 | Support for PCI 3.0 standard. 18 | 19 | Revision History 20 | 21 | --*/ 22 | 23 | #ifndef _PCI30_H 24 | #define _PCI30_H 25 | 26 | #include "pci23.h" 27 | 28 | #define PCI_CLASS_MASS_STORAGE_SATADPA 0x06 29 | #define PCI_CLASS_MASS_STORAGE_AHCI PCI_CLASS_MASS_STORAGE_SATADPA 30 | 31 | #pragma pack(push, 1) 32 | 33 | typedef struct { 34 | UINT32 Signature; // "PCIR" 35 | UINT16 VendorId; 36 | UINT16 DeviceId; 37 | UINT16 DeviceListOffset; 38 | UINT16 Length; 39 | UINT8 Revision; 40 | UINT8 ClassCode[3]; 41 | UINT16 ImageLength; 42 | UINT16 CodeRevision; 43 | UINT8 CodeType; 44 | UINT8 Indicator; 45 | UINT16 MaxRuntimeImageLength; 46 | UINT16 ConfigUtilityCodeHeaderOffset; 47 | UINT16 DMTFCLPEntryPointOffset; 48 | } PCI_3_0_DATA_STRUCTURE; 49 | 50 | #pragma pack(pop) 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /sdk/include/Protocol/AppleDeviceControl/AppleDeviceControl.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 28:8:2012 18:10 3 | // filename: AppleDeviceControl.h 4 | // author: tiamo 5 | // purpose: apple device control 6 | //******************************************************************** 7 | 8 | #ifndef _APPLE_DEVICE_CONTROL_H_ 9 | #define _APPLE_DEVICE_CONTROL_H_ 10 | 11 | #define APPLE_DEVICE_CONTROL_PROTOCOL_GUID {0x8ece08d8, 0xa6d4, 0x430b, 0xa7, 0xb0, 0x2d, 0xf3, 0x18, 0xe7, 0x88, 0x4a} 12 | 13 | EFI_FORWARD_DECLARATION(APPLE_DEVICE_CONTROL_PROTOCOL); 14 | 15 | typedef EFI_STATUS (EFIAPI* CONNECT_DISPLAY)(); 16 | typedef EFI_STATUS (EFIAPI* CONNECT_ALL)(); 17 | 18 | typedef struct _APPLE_DEVICE_CONTROL_PROTOCOL 19 | { 20 | UINTN Unknown0; 21 | CONNECT_DISPLAY ConnectDisplay; 22 | UINTN Unknown2; 23 | CONNECT_ALL ConnectAll; 24 | }APPLE_DEVICE_CONTROL_PROTOCOL; 25 | 26 | extern EFI_GUID gAppleDeviceControlProtocolGuid; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /sdk/include/Protocol/AppleDeviceProperty/AppleDeviceProperty.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 21:8:2012 22:43 3 | // filename: AppleDeviceProperty.h 4 | // author: tiamo 5 | // purpose: apple device property 6 | //******************************************************************** 7 | 8 | #ifndef _APPLE_DEVICE_PROPERTY_H_ 9 | #define _APPLE_DEVICE_PROPERTY_H_ 10 | 11 | #define APPLE_DEVICE_PROPERTY_PROTOCOL_GUID {0x91bd12fe, 0xf6c3, 0x44fb, 0xa5, 0xb7, 0x51, 0x22, 0xab, 0x30, 0x3a, 0xe0} 12 | 13 | EFI_FORWARD_DECLARATION(APPLE_DEVICE_PROPERTY_PROTOCOL); 14 | 15 | typedef EFI_STATUS (EFIAPI* GET_DEVICE_PROPERTY)(IN APPLE_DEVICE_PROPERTY_PROTOCOL* This, OUT VOID* PropertiesBuffer, IN OUT UINTN *BufferSize); 16 | 17 | typedef struct _APPLE_DEVICE_PROPERTY_PROTOCOL 18 | { 19 | UINT64 Signature; 20 | UINTN Unknown[3]; 21 | GET_DEVICE_PROPERTY GetDeviceProperty; 22 | }APPLE_DEVICE_PROPERTY_PROTOCOL; 23 | 24 | extern EFI_GUID gAppleDevicePropertyProtocolGuid; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /sdk/include/Protocol/AppleDiskIo/AppleDiskIo.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 15:9:2012 23:53 3 | // filename: AppleDiskIo.h 4 | // author: tiamo 5 | // purpose: apple disk io protocol 6 | //******************************************************************** 7 | 8 | #ifndef _APPLE_DISK_IO_H_ 9 | #define _APPLE_DISK_IO_H_ 10 | 11 | #define APPLE_DISK_IO_PROTOCOL_GUID {0x5b27263b, 0x9083, 0x415e, 0x88, 0x9e, 0x64, 0x32, 0xca, 0xa9, 0xb8, 0x13} 12 | 13 | EFI_FORWARD_DECLARATION(APPLE_DISK_IO_PROTOCOL); 14 | 15 | typedef EFI_STATUS (EFIAPI* APPLE_DISK_READ)(IN APPLE_DISK_IO_PROTOCOL* This, IN UINT32 MediaId, IN UINT64 LBA, IN UINTN BufferSize, OUT VOID* Buffer); 16 | typedef EFI_STATUS (EFIAPI* APPLE_DISK_FLUSH)(IN APPLE_DISK_IO_PROTOCOL* This); 17 | 18 | typedef struct _APPLE_DISK_IO_PROTOCOL 19 | { 20 | APPLE_DISK_READ ReadDisk; 21 | APPLE_DISK_FLUSH Flush; 22 | }APPLE_DISK_IO_PROTOCOL; 23 | 24 | extern EFI_GUID gAppleDiskIoProtocolGuid; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /sdk/include/Protocol/AppleFirmwarePassword/AppleFirmwarePassword.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 26:8:2012 17:08 3 | // filename: AppleFirmwarePassword.h 4 | // author: tiamo 5 | // purpose: apple firmware password 6 | //******************************************************************** 7 | 8 | #ifndef _APPLE_FIRMWARE_PASSWORD_H_ 9 | #define _APPLE_FIRMWARE_PASSWORD_H_ 10 | 11 | #define APPLE_FIRMWARE_PASSWORD_PROTOCOL_GUID {0x8ffeeb3a, 0x4c98, 0x4630, 0x80, 0x3f, 0x74, 0x0f, 0x95, 0x67, 0x09, 0x1d} 12 | 13 | EFI_FORWARD_DECLARATION(APPLE_FIRMWARE_PASSWORD_PROTOCOL); 14 | 15 | typedef EFI_STATUS (EFIAPI* CHECK)(IN APPLE_FIRMWARE_PASSWORD_PROTOCOL* This, OUT UINTN* CheckValue); 16 | 17 | typedef struct _APPLE_FIRMWARE_PASSWORD_PROTOCOL 18 | { 19 | UINT64 Signature; 20 | UINTN Unknown[3]; 21 | CHECK Check; 22 | }APPLE_FIRMWARE_PASSWORD_PROTOCOL; 23 | 24 | extern EFI_GUID gAppleFirmwarePasswordProtocolGuid; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /sdk/include/Protocol/AppleGraphConfig/AppleGraphConfig.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 28:8:2012 18:15 3 | // filename: AppleGraphConfig.h 4 | // author: tiamo 5 | // purpose: graph config 6 | //******************************************************************** 7 | 8 | #ifndef _APPLE_GRAPH_CONFIG_H_ 9 | #define _APPLE_GRAPH_CONFIG_H_ 10 | 11 | #define APPLE_GRAPH_CONFIG_PROTOCOL_GUID {0x8ece08d8, 0xa6d4, 0x430b, 0xa7, 0xb0, 0x2d, 0xf3, 0x18, 0xe7, 0x88, 0x4a} 12 | 13 | EFI_FORWARD_DECLARATION(APPLE_GRAPH_CONFIG_PROTOCOL); 14 | 15 | typedef EFI_STATUS (EFIAPI* RESTORE_CONFIG)(APPLE_GRAPH_CONFIG_PROTOCOL* This, UINT32 Param1, UINT32 Param2, VOID* Param3, VOID* Param4, VOID* Param5); 16 | 17 | typedef struct _APPLE_GRAPH_CONFIG_PROTOCOL 18 | { 19 | UINTN Unknown0; 20 | RESTORE_CONFIG RestoreConfig; 21 | }APPLE_GRAPH_CONFIG_PROTOCOL; 22 | 23 | extern EFI_GUID gAppleGraphConfigProtocolGuid; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /sdk/include/Protocol/AppleGraphInfo/AppleGraphInfo.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 28:8:2012 18:40 3 | // filename: AppleGraphInfo.h 4 | // author: tiamo 5 | // purpose: graph info 6 | //******************************************************************** 7 | 8 | #ifndef _APPLE_GRAPH_INFO_H_ 9 | #define _APPLE_GRAPH_INFO_H_ 10 | 11 | #define APPLE_GRAPH_INFO_PROTOCOL_GUID {0xe316e100, 0x0751, 0x4c49, 0x90, 0x56, 0x48, 0x6c, 0x7e, 0x47, 0x29, 0x03} 12 | 13 | EFI_FORWARD_DECLARATION(APPLE_GRAPH_INFO_PROTOCOL); 14 | 15 | typedef EFI_STATUS (EFIAPI* GET_INFO)(APPLE_GRAPH_INFO_PROTOCOL* This, UINT64* BaseAddress, UINT64* FrameBufferSize, UINT32* ByterPerRow, UINT32* Width, UINT32* Height, UINT32* ColorDepth); 16 | 17 | typedef struct _APPLE_GRAPH_INFO_PROTOCOL 18 | { 19 | GET_INFO GetInfo; 20 | }APPLE_GRAPH_INFO_PROTOCOL; 21 | 22 | extern EFI_GUID gAppleGraphInfoProtocolGuid; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /sdk/include/Protocol/AppleImageCodec/AppleImageCodec.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 28:8:2012 20:54 3 | // filename: AppleImageCodec.h 4 | // author: tiamo 5 | // purpose: image code 6 | //******************************************************************** 7 | 8 | #ifndef _APPLE_IMAGE_CODEC_H_ 9 | #define _APPLE_IMAGE_CODEC_H_ 10 | 11 | #define APPLE_IMAGE_CODEC_PROTOCOL_GUID {0x0dfce9f6, 0xc4e3, 0x45ee, 0xa0, 0x6a, 0xa8, 0x61, 0x3b, 0x98, 0xa5, 0x07} 12 | 13 | EFI_FORWARD_DECLARATION(APPLE_IMAGE_CODEC_PROTOCOL); 14 | 15 | typedef EFI_STATUS (EFIAPI* RECOGNIZE_IMAGE_DATA)(VOID* ImageBuffer, UINTN ImageSize); 16 | typedef EFI_STATUS (EFIAPI* GET_IMAGE_DIMS)(VOID* ImageBuffer, UINTN ImageSize, UINTN* ImageWidth, UINTN* ImageHeight); 17 | typedef EFI_STATUS (EFIAPI* DECODE_IMAGE_DATA)(VOID* ImageBuffer, UINTN ImageSize, EFI_UGA_PIXEL** RawImageData, UINTN* RawImageDataSize); 18 | 19 | typedef struct _APPLE_IMAGE_CODEC_PROTOCOL 20 | { 21 | UINT64 Version; 22 | UINTN FileExt; 23 | RECOGNIZE_IMAGE_DATA RecognizeImageData; 24 | GET_IMAGE_DIMS GetImageDims; 25 | DECODE_IMAGE_DATA DecodeImageData; 26 | }APPLE_IMAGE_CODEC_PROTOCOL; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /sdk/include/Protocol/AppleKeyState/AppleKeyState.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 27:8:2012 21:30 3 | // filename: AppleKeyState.h 4 | // author: tiamo 5 | // purpose: apple key state 6 | //******************************************************************** 7 | 8 | #ifndef _APPLE_KEY_STATE_H_ 9 | #define _APPLE_KEY_STATE_H_ 10 | 11 | #define APPLE_KEY_STATE_PROTOCOL_GUID {0x5b213447, 0x6e73, 0x4901, 0xa4, 0xf1, 0xb8, 0x64, 0xf3, 0xb7, 0xa1, 0x72} 12 | 13 | #define APPLE_KEY_STATE_MODIFY_LEFT_CONTROL 0x01 14 | #define APPLE_KEY_STATE_MODIFY_LEFT_SHIFT 0x02 15 | #define APPLE_KEY_STATE_MODIFY_LEFT_OPTION 0x04 16 | #define APPLE_KEY_STATE_MODIFY_LEFT_COMMAND 0x08 17 | #define APPLE_KEY_STATE_MODIFY_RIGHT_CONTROL 0x10 18 | #define APPLE_KEY_STATE_MODIFY_RIGHT_SHIFT 0x20 19 | #define APPLE_KEY_STATE_MODIFY_RIGHT_OPTION 0x40 20 | #define APPLE_KEY_STATE_MODIFY_RIGHT_COMMAND 0x80 21 | 22 | #define APPLE_KEY_STATE_A 0x7004 23 | #define APPLE_KEY_STATE_B 0x7005 24 | #define APPLE_KEY_STATE_C 0x7006 25 | #define APPLE_KEY_STATE_D 0x7007 26 | #define APPLE_KEY_STATE_E 0x7008 27 | #define APPLE_KEY_STATE_F 0x7009 28 | #define APPLE_KEY_STATE_G 0x700a 29 | #define APPLE_KEY_STATE_H 0x700b 30 | #define APPLE_KEY_STATE_I 0x700c 31 | #define APPLE_KEY_STATE_J 0x700d 32 | #define APPLE_KEY_STATE_K 0x700e 33 | #define APPLE_KEY_STATE_L 0x700f 34 | #define APPLE_KEY_STATE_M 0x7010 35 | #define APPLE_KEY_STATE_N 0x7011 36 | #define APPLE_KEY_STATE_O 0x7012 37 | #define APPLE_KEY_STATE_P 0x7013 38 | #define APPLE_KEY_STATE_Q 0x7014 39 | #define APPLE_KEY_STATE_R 0x7015 40 | #define APPLE_KEY_STATE_S 0x7016 41 | #define APPLE_KEY_STATE_T 0x7017 42 | #define APPLE_KEY_STATE_U 0x7018 43 | #define APPLE_KEY_STATE_V 0x7019 44 | #define APPLE_KEY_STATE_W 0x701a 45 | #define APPLE_KEY_STATE_X 0x701b 46 | #define APPLE_KEY_STATE_Y 0x701c 47 | #define APPLE_KEY_STATE_Z 0x701d 48 | #define APPLE_KEY_STATE_1 0x701e 49 | #define APPLE_KEY_STATE_2 0x701f 50 | #define APPLE_KEY_STATE_3 0x7020 51 | #define APPLE_KEY_STATE_4 0x7021 52 | #define APPLE_KEY_STATE_5 0x7022 53 | #define APPLE_KEY_STATE_6 0x7023 54 | #define APPLE_KEY_STATE_7 0x7024 55 | #define APPLE_KEY_STATE_8 0x7025 56 | #define APPLE_KEY_STATE_9 0x7026 57 | #define APPLE_KEY_STATE_0 0x7027 58 | #define APPLE_KEY_STATE_ENTER 0x7028 59 | #define APPLE_KEY_STATE_ESCAPE 0x7029 60 | #define APPLE_KEY_STATE_BACKSPACE 0x702a 61 | #define APPLE_KEY_STATE_TAB 0x702b 62 | 63 | #define APPLE_KEY_STATE_MINUS 0x702d 64 | #define APPLE_KEY_STATE_EQUAL 0x702e 65 | #define APPLE_KEY_STATE_LEFT_BARCKET 0x702f 66 | #define APPLE_KEY_STATE_RIGHT_BARCKET 0x7030 67 | #define APPLE_KEY_STATE_BACKSLASH 0x7031 68 | #define APPLE_KEY_STATE_SEMICOLON 0x7033 69 | #define APPLE_KEY_STATE_QUOTATION 0x7034 70 | #define APPLE_KEY_STATE_ACUTE 0x7035 71 | #define APPLE_KEY_STATE_COMMA 0x7036 72 | #define APPLE_KEY_STATE_PERIOD 0x7037 73 | #define APPLE_KEY_STATE_SLASH 0x7038 74 | #define APPLE_KEY_STATE_CAPS_LOCK 0x7039 75 | #define APPLE_KEY_STATE_F1 0x703a 76 | #define APPLE_KEY_STATE_F2 0x703b 77 | #define APPLE_KEY_STATE_F3 0x703c 78 | #define APPLE_KEY_STATE_F4 0x703d 79 | #define APPLE_KEY_STATE_F5 0x703e 80 | #define APPLE_KEY_STATE_F6 0x703f 81 | #define APPLE_KEY_STATE_F7 0x7040 82 | #define APPLE_KEY_STATE_F8 0x7041 83 | #define APPLE_KEY_STATE_F9 0x7043 84 | #define APPLE_KEY_STATE_F10 0x7043 85 | #define APPLE_KEY_STATE_F11 0x7044 86 | #define APPLE_KEY_STATE_F12 0x7045 87 | #define APPLE_KEY_STATE_F14 0x7046 88 | #define APPLE_KEY_STATE_F15 0x7047 89 | #define APPLE_KEY_STATE_F16 0x7048 90 | #define APPLE_KEY_STATE_INSERT 0x7049 91 | #define APPLE_KEY_STATE_HOME 0x704a 92 | #define APPLE_KEY_STATE_PAGE_UP 0x704b 93 | #define APPLE_KEY_STATE_DELETE 0x704c 94 | #define APPLE_KEY_STATE_END 0x704d 95 | #define APPLE_KEY_STATE_PAGE_DOWN 0x704e 96 | #define APPLE_KEY_STATE_RIGHT_ARROW 0x704f 97 | #define APPLE_KEY_STATE_LEFT_ARROW 0x7050 98 | #define APPLE_KEY_STATE_DOWN_ARROW 0x7051 99 | #define APPLE_KEY_STATE_UP_ARROW 0x7052 100 | #define APPLE_KEY_STATE_NUM_PAD_CLEAR 0x7053 101 | #define APPLE_KEY_STATE_NUM_PAD_DIV 0x7054 102 | #define APPLE_KEY_STATE_NUM_PAD_MUL 0x7055 103 | #define APPLE_KEY_STATE_NUM_PAD_MINUS 0x7056 104 | #define APPLE_KEY_STATE_NUM_PAD_PLUS 0x7057 105 | #define APPLE_KEY_STATE_NUM_PAD_ENTER 0x7058 106 | #define APPLE_KEY_STATE_NUM_PAD_1 0x7059 107 | #define APPLE_KEY_STATE_NUM_PAD_2 0x705a 108 | #define APPLE_KEY_STATE_NUM_PAD_3 0x705b 109 | #define APPLE_KEY_STATE_NUM_PAD_4 0x705c 110 | #define APPLE_KEY_STATE_NUM_PAD_5 0x705d 111 | #define APPLE_KEY_STATE_NUM_PAD_6 0x705e 112 | #define APPLE_KEY_STATE_NUM_PAD_7 0x705f 113 | #define APPLE_KEY_STATE_NUM_PAD_8 0x7060 114 | #define APPLE_KEY_STATE_NUM_PAD_9 0x7061 115 | #define APPLE_KEY_STATE_NUM_PAD_INSERT 0x7062 116 | #define APPLE_KEY_STATE_NUM_PAD_DELETE 0x7063 117 | #define APPLE_KEY_STATE_APPLICATION 0x7065 118 | 119 | EFI_FORWARD_DECLARATION (APPLE_KEY_STATE_PROTOCOL); 120 | 121 | typedef EFI_STATUS (EFIAPI *READ_KEY_STATE)(IN APPLE_KEY_STATE_PROTOCOL *This, OUT UINT16 *ModifyFlags, OUT UINTN *PressedKeyStatesCount, OUT CHAR16 *PressedKeyStates); 122 | 123 | typedef struct _APPLE_KEY_STATE_PROTOCOL 124 | { 125 | UINT64 Signature; 126 | READ_KEY_STATE ReadKeyState; 127 | }APPLE_KEY_STATE_PROTOCOL; 128 | 129 | extern EFI_GUID gAppleKeyStateProtocolGuid; 130 | 131 | #endif 132 | -------------------------------------------------------------------------------- /sdk/include/Protocol/AppleNetBoot/AppleNetBoot.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 21:8:2012 22:43 3 | // filename: AppleNetBoot.h 4 | // author: tiamo 5 | // purpose: apple net boot 6 | //******************************************************************** 7 | 8 | #ifndef _APPLE_NET_BOOT_H_ 9 | #define _APPLE_NET_BOOT_H_ 10 | 11 | #define APPLE_NET_BOOT_PROTOCOL_GUID {0x78ee99fb, 0x6a5e, 0x4186, 0x97, 0xde, 0xcd, 0x0a, 0xba, 0x34, 0x5a, 0x74} 12 | 13 | EFI_FORWARD_DECLARATION(APPLE_NET_BOOT_PROTOCOL); 14 | 15 | typedef EFI_STATUS (EFIAPI* GET_DHCP_RESPONSE)(APPLE_NET_BOOT_PROTOCOL* This, UINTN* BufferSize, VOID* DataBuffer); 16 | typedef EFI_STATUS (EFIAPI* GET_BSDP_RESPONSE)(APPLE_NET_BOOT_PROTOCOL* This, UINTN* BufferSize, VOID* DataBuffer); 17 | 18 | typedef struct _APPLE_NET_BOOT_PROTOCOL 19 | { 20 | GET_DHCP_RESPONSE GetDhcpResponse; 21 | GET_BSDP_RESPONSE GetBsdpResponse; 22 | }APPLE_NET_BOOT_PROTOCOL; 23 | 24 | extern EFI_GUID gAppleNetBootProtocolGuid; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /sdk/include/Protocol/AppleSMC/AppleSMC.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 29:9:2012 13:49 3 | // filename: AppleSMC.h 4 | // author: tiamo 5 | // purpose: apple smc 6 | //******************************************************************** 7 | 8 | #ifndef _APPLE_SMC_H_ 9 | #define _APPLE_SMC_H_ 10 | 11 | #define APPLE_SMC_PROTOCOL_GUID {0x17407e5a, 0xaf6c, 0x4ee8, 0x98, 0xa8, 0x00, 0x21, 0x04, 0x53, 0xcd, 0xd9} 12 | 13 | EFI_FORWARD_DECLARATION(APPLE_SMC_PROTOCOL); 14 | 15 | typedef EFI_STATUS (EFIAPI* APPLE_SMC_READ_DATA)(IN _APPLE_SMC_PROTOCOL* This, IN UINT32 DataId, IN UINT32 DataLength, OUT VOID* DataBuffer); 16 | 17 | typedef struct _APPLE_SMC_PROTOCOL 18 | { 19 | UINT64 Signature; 20 | APPLE_SMC_READ_DATA ReadData; 21 | }APPLE_SMC_PROTOCOL; 22 | 23 | extern EFI_GUID gAppleSMCProtocolGuid; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /sdk/include/Protocol/AppleSystemInfo/AppleSystemInfo.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 21:8:2012 22:18 3 | // filename: AppleSystemInfo.h 4 | // author: tiamo 5 | // purpose: apple system info 6 | //******************************************************************** 7 | 8 | #ifndef _APPLE_SYSTEM_INFO_H_ 9 | #define _APPLE_SYSTEM_INFO_H_ 10 | 11 | #define APPLE_SYSTEM_INFO_PRODUCER_NAME_GUID {0x64517cc8, 0x6561, 0x4051, 0xb0, 0x3c, 0x59, 0x64, 0xb6, 0x0f, 0x4c, 0x7a} 12 | 13 | typedef struct _APPLE_SYSTEM_INFO_DATA_RECORD 14 | { 15 | UINT32 Unknown[4]; 16 | UINT32 NameLength; 17 | UINT32 ValueLength; 18 | }APPLE_SYSTEM_INFO_DATA_RECORD; 19 | 20 | extern EFI_GUID gAppleSystemInfoProducerNameGuid; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /sdk/include/Protocol/ConsoleControl/ConsoleControl.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004 - 2009, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | ConsoleControl.h 15 | 16 | Abstract: 17 | 18 | Abstraction of a Text mode or GOP/UGA screen 19 | 20 | --*/ 21 | 22 | #ifndef __CONSOLE_CONTROL_H__ 23 | #define __CONSOLE_CONTROL_H__ 24 | 25 | #define EFI_CONSOLE_CONTROL_PROTOCOL_GUID \ 26 | { 0xf42f7782, 0x12e, 0x4c12, 0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21 } 27 | 28 | typedef struct _EFI_CONSOLE_CONTROL_PROTOCOL EFI_CONSOLE_CONTROL_PROTOCOL; 29 | 30 | 31 | typedef enum { 32 | EfiConsoleControlScreenText, 33 | EfiConsoleControlScreenGraphics, 34 | EfiConsoleControlScreenMaxValue 35 | } EFI_CONSOLE_CONTROL_SCREEN_MODE; 36 | 37 | 38 | typedef 39 | EFI_STATUS 40 | (EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE) ( 41 | IN EFI_CONSOLE_CONTROL_PROTOCOL *This, 42 | OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *Mode, 43 | OUT BOOLEAN *GopUgaExists, OPTIONAL 44 | OUT BOOLEAN *StdInLocked OPTIONAL 45 | ) 46 | /*++ 47 | 48 | Routine Description: 49 | Return the current video mode information. Also returns info about existence 50 | of Graphics Output devices or UGA Draw devices in system, and if the Std In 51 | device is locked. All the arguments are optional and only returned if a non 52 | NULL pointer is passed in. 53 | 54 | Arguments: 55 | This - Protocol instance pointer. 56 | Mode - Are we in text of grahics mode. 57 | GopUgaExists - TRUE if Console Spliter has found a GOP or UGA device 58 | StdInLocked - TRUE if StdIn device is keyboard locked 59 | 60 | Returns: 61 | EFI_SUCCESS - Mode information returned. 62 | 63 | --*/ 64 | ; 65 | 66 | 67 | typedef 68 | EFI_STATUS 69 | (EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE) ( 70 | IN EFI_CONSOLE_CONTROL_PROTOCOL *This, 71 | IN EFI_CONSOLE_CONTROL_SCREEN_MODE Mode 72 | ) 73 | /*++ 74 | 75 | Routine Description: 76 | Set the current mode to either text or graphics. Graphics is 77 | for Quiet Boot. 78 | 79 | Arguments: 80 | This - Protocol instance pointer. 81 | Mode - Mode to set the 82 | 83 | Returns: 84 | EFI_SUCCESS - Mode information returned. 85 | 86 | --*/ 87 | ; 88 | 89 | 90 | typedef 91 | EFI_STATUS 92 | (EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN) ( 93 | IN EFI_CONSOLE_CONTROL_PROTOCOL *This, 94 | IN CHAR16 *Password 95 | ) 96 | /*++ 97 | 98 | Routine Description: 99 | Lock Std In devices until Password is typed. 100 | 101 | Arguments: 102 | This - Protocol instance pointer. 103 | Password - Password needed to unlock screen. NULL means unlock keyboard 104 | 105 | Returns: 106 | EFI_SUCCESS - Mode information returned. 107 | EFI_DEVICE_ERROR - Std In not locked 108 | 109 | --*/ 110 | ; 111 | 112 | 113 | 114 | typedef struct _EFI_CONSOLE_CONTROL_PROTOCOL { 115 | EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE GetMode; 116 | EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE SetMode; 117 | EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN LockStdIn; 118 | } EFI_CONSOLE_CONTROL_PROTOCOL; 119 | 120 | extern EFI_GUID gEfiConsoleControlProtocolGuid; 121 | 122 | #endif 123 | -------------------------------------------------------------------------------- /sdk/include/Protocol/DataHub/DataHub.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | DataHub.h 15 | 16 | Abstract: 17 | 18 | The data hub protocol is used both by agents wishing to log 19 | data and those wishing to be made aware of all information that 20 | has been logged. 21 | 22 | For more information please look at Intel Platform Innovation 23 | Framework for EFI Data Hub Specification. 24 | 25 | --*/ 26 | 27 | #ifndef __DATA_HUB_H__ 28 | #define __DATA_HUB_H__ 29 | 30 | #define EFI_DATA_HUB_PROTOCOL_GUID \ 31 | { \ 32 | 0xae80d021, 0x618e, 0x11d4, 0xbc, 0xd7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 \ 33 | } 34 | 35 | // 36 | // EFI generic Data Hub Header 37 | // 38 | // A Data Record is an EFI_DATA_RECORD_HEADER followed by RecordSize bytes of 39 | // data. The format of the data is defined by the DataRecordGuid. 40 | // 41 | // If EFI_DATA_RECORD_HEADER is extended in the future the Version number must 42 | // change and the HeaderSize will change if the definition of 43 | // EFI_DATA_RECORD_HEADER is extended. 44 | // 45 | // The logger is responcible for initializing: 46 | // Version, HeaderSize, RecordSize, DataRecordGuid, DataRecordClass 47 | // 48 | // The Data Hub driver is responcible for initializing: 49 | // LogTime and LogMonotonicCount. 50 | // 51 | #define EFI_DATA_RECORD_HEADER_VERSION 0x0100 52 | typedef struct { 53 | UINT16 Version; 54 | UINT16 HeaderSize; 55 | UINT32 RecordSize; 56 | EFI_GUID DataRecordGuid; 57 | EFI_GUID ProducerName; 58 | UINT64 DataRecordClass; 59 | EFI_TIME LogTime; 60 | UINT64 LogMonotonicCount; 61 | } EFI_DATA_RECORD_HEADER; 62 | 63 | // 64 | // Definition of DataRecordClass. These are used to filter out class types 65 | // at a very high level. The DataRecordGuid still defines the format of 66 | // the data. See DateHub.doc for rules on what can and can not be a 67 | // new DataRecordClass 68 | // 69 | #define EFI_DATA_RECORD_CLASS_DEBUG 0x0000000000000001 70 | #define EFI_DATA_RECORD_CLASS_ERROR 0x0000000000000002 71 | #define EFI_DATA_RECORD_CLASS_DATA 0x0000000000000004 72 | #define EFI_DATA_RECORD_CLASS_PROGRESS_CODE 0x0000000000000008 73 | 74 | // 75 | // Forward reference for pure ANSI compatability 76 | // 77 | EFI_FORWARD_DECLARATION (EFI_DATA_HUB_PROTOCOL); 78 | 79 | typedef 80 | EFI_STATUS 81 | (EFIAPI *EFI_DATA_HUB_LOG_DATA) ( 82 | IN EFI_DATA_HUB_PROTOCOL * This, 83 | IN EFI_GUID * DataRecordGuid, 84 | IN EFI_GUID * ProducerName, 85 | IN UINT64 DataRecordClass, 86 | IN VOID *RawData, 87 | IN UINT32 RawDataSize 88 | ); 89 | 90 | typedef 91 | EFI_STATUS 92 | (EFIAPI *EFI_DATA_HUB_GET_NEXT_RECORD) ( 93 | IN EFI_DATA_HUB_PROTOCOL * This, 94 | IN OUT UINT64 *MonotonicCount, 95 | IN EFI_EVENT * FilterDriver OPTIONAL, 96 | OUT EFI_DATA_RECORD_HEADER **Record 97 | ); 98 | 99 | typedef 100 | EFI_STATUS 101 | (EFIAPI *EFI_DATA_HUB_REGISTER_FILTER_DRIVER) ( 102 | IN EFI_DATA_HUB_PROTOCOL * This, 103 | IN EFI_EVENT FilterEvent, 104 | IN EFI_TPL FilterTpl, 105 | IN UINT64 FilterClass, 106 | IN EFI_GUID * FilterDataRecordGuid OPTIONAL 107 | ); 108 | 109 | typedef 110 | EFI_STATUS 111 | (EFIAPI *EFI_DATA_HUB_UNREGISTER_FILTER_DRIVER) ( 112 | IN EFI_DATA_HUB_PROTOCOL * This, 113 | IN EFI_EVENT FilterEvent 114 | ); 115 | 116 | typedef struct _EFI_DATA_HUB_PROTOCOL { 117 | EFI_DATA_HUB_LOG_DATA LogData; 118 | EFI_DATA_HUB_GET_NEXT_RECORD GetNextRecord; 119 | EFI_DATA_HUB_REGISTER_FILTER_DRIVER RegisterFilterDriver; 120 | EFI_DATA_HUB_UNREGISTER_FILTER_DRIVER UnregisterFilterDriver; 121 | } EFI_DATA_HUB_PROTOCOL; 122 | 123 | extern EFI_GUID gEfiDataHubProtocolGuid; 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /sdk/include/Protocol/DevicePath/DevicePath.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | DevicePath.h 15 | 16 | Abstract: 17 | 18 | The device path protocol as defined in EFI 1.0. 19 | 20 | The device path represents a programatic path to a device. It's the view 21 | from a software point of view. It also must persist from boot to boot, so 22 | it can not contain things like PCI bus numbers that change from boot to boot. 23 | 24 | 25 | --*/ 26 | 27 | #ifndef _DEVICE_PATH_H_ 28 | #define _DEVICE_PATH_H_ 29 | 30 | // 31 | // Device Path protocol 32 | // 33 | #define EFI_DEVICE_PATH_PROTOCOL_GUID \ 34 | { \ 35 | 0x9576e91, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b \ 36 | } 37 | 38 | #pragma pack(push, 1) 39 | 40 | typedef struct { 41 | UINT8 Type; 42 | UINT8 SubType; 43 | UINT8 Length[2]; 44 | } EFI_DEVICE_PATH_PROTOCOL; 45 | 46 | #pragma pack(pop) 47 | 48 | #define EFI_END_ENTIRE_DEVICE_PATH 0xff 49 | #define EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff 50 | #define EFI_END_INSTANCE_DEVICE_PATH 0x01 51 | #define EFI_END_DEVICE_PATH_LENGTH (sizeof (EFI_DEVICE_PATH_PROTOCOL)) 52 | 53 | #define EfiDevicePathNodeLength(a) (((a)->Length[0]) | ((a)->Length[1] << 8)) 54 | #define EfiNextDevicePathNode(a) ((EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) (a)) + EfiDevicePathNodeLength (a))) 55 | 56 | #define EfiDevicePathType(a) (((a)->Type) & 0x7f) 57 | #define EfiIsDevicePathEndType(a) (EfiDevicePathType (a) == 0x7f) 58 | 59 | #define EfiIsDevicePathEndSubType(a) ((a)->SubType == EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE) 60 | #define EfiIsDevicePathEndInstanceSubType(a) ((a)->SubType == EFI_END_INSTANCE_DEVICE_PATH) 61 | 62 | #define EfiIsDevicePathEnd(a) (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndSubType (a)) 63 | #define EfiIsDevicePathEndInstance(a) (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndInstanceSubType (a)) 64 | 65 | extern EFI_GUID gEfiDevicePathProtocolGuid; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /sdk/include/Protocol/DiskIO/DiskIo.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | DiskIo.h 15 | 16 | Abstract: 17 | 18 | Disk IO protocol as defined in the EFI 1.0 specification. 19 | 20 | The Disk IO protocol is used to convert block oriented devices into byte 21 | oriented devices. The Disk IO protocol is intended to layer on top of the 22 | Block IO protocol. 23 | 24 | --*/ 25 | 26 | #ifndef __DISK_IO_H__ 27 | #define __DISK_IO_H__ 28 | 29 | #define EFI_DISK_IO_PROTOCOL_GUID \ 30 | { \ 31 | 0xce345171, 0xba0b, 0x11d2, 0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b \ 32 | } 33 | 34 | EFI_FORWARD_DECLARATION (EFI_DISK_IO_PROTOCOL); 35 | 36 | typedef 37 | EFI_STATUS 38 | (EFIAPI *EFI_DISK_READ) ( 39 | IN EFI_DISK_IO_PROTOCOL * This, 40 | IN UINT32 MediaId, 41 | IN UINT64 Offset, 42 | IN UINTN BufferSize, 43 | OUT VOID *Buffer 44 | ) 45 | /*++ 46 | 47 | Routine Description: 48 | Read BufferSize bytes from Offset into Buffer. 49 | 50 | Arguments: 51 | This - Protocol instance pointer. 52 | MediaId - Id of the media, changes every time the media is replaced. 53 | Offset - The starting byte offset to read from 54 | BufferSize - Size of Buffer 55 | Buffer - Buffer containing read data 56 | 57 | Returns: 58 | EFI_SUCCESS - The data was read correctly from the device. 59 | EFI_DEVICE_ERROR - The device reported an error while performing the read. 60 | EFI_NO_MEDIA - There is no media in the device. 61 | EFI_MEDIA_CHNAGED - The MediaId does not matched the current device. 62 | EFI_INVALID_PARAMETER - The read request contains device addresses that are not 63 | valid for the device. 64 | 65 | --*/ 66 | ; 67 | 68 | typedef 69 | EFI_STATUS 70 | (EFIAPI *EFI_DISK_WRITE) ( 71 | IN EFI_DISK_IO_PROTOCOL * This, 72 | IN UINT32 MediaId, 73 | IN UINT64 Offset, 74 | IN UINTN BufferSize, 75 | IN VOID *Buffer 76 | ) 77 | /*++ 78 | 79 | Routine Description: 80 | Read BufferSize bytes from Offset into Buffer. 81 | 82 | Arguments: 83 | This - Protocol instance pointer. 84 | MediaId - Id of the media, changes every time the media is replaced. 85 | Offset - The starting byte offset to read from 86 | BufferSize - Size of Buffer 87 | Buffer - Buffer containing read data 88 | 89 | Returns: 90 | EFI_SUCCESS - The data was written correctly to the device. 91 | EFI_WRITE_PROTECTED - The device can not be written to. 92 | EFI_DEVICE_ERROR - The device reported an error while performing the write. 93 | EFI_NO_MEDIA - There is no media in the device. 94 | EFI_MEDIA_CHNAGED - The MediaId does not matched the current device. 95 | EFI_INVALID_PARAMETER - The write request contains device addresses that are not 96 | valid for the device. 97 | 98 | --*/ 99 | ; 100 | 101 | #define EFI_DISK_IO_PROTOCOL_REVISION 0x00010000 102 | 103 | typedef struct _EFI_DISK_IO_PROTOCOL { 104 | UINT64 Revision; 105 | EFI_DISK_READ ReadDisk; 106 | EFI_DISK_WRITE WriteDisk; 107 | } EFI_DISK_IO_PROTOCOL; 108 | 109 | extern EFI_GUID gEfiDiskIoProtocolGuid; 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /sdk/include/Protocol/FileInfo/FileInfo.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | FileInfo.c 15 | 16 | Abstract: 17 | 18 | SimpleFileSystem protocol as defined in the EFI 1.0 specification. 19 | 20 | The SimpleFileSystem protocol is the programatic access to the FAT (12,16,32) 21 | file system specified in EFI 1.0. It can also be used to abstract any 22 | file system other than FAT. 23 | 24 | EFI 1.0 can boot from any valid EFI image contained in a SimpleFileSystem 25 | 26 | --*/ 27 | 28 | #ifndef _FILE_INFO_H_ 29 | #define _FILE_INFO_H_ 30 | 31 | #define EFI_FILE_INFO_ID \ 32 | { \ 33 | 0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b \ 34 | } 35 | 36 | typedef struct { 37 | UINT64 Size; 38 | UINT64 FileSize; 39 | UINT64 PhysicalSize; 40 | EFI_TIME CreateTime; 41 | EFI_TIME LastAccessTime; 42 | EFI_TIME ModificationTime; 43 | UINT64 Attribute; 44 | CHAR16 FileName[1]; 45 | } EFI_FILE_INFO; 46 | 47 | // 48 | // The FileName field of the EFI_FILE_INFO data structure is variable length. 49 | // Whenever code needs to know the size of the EFI_FILE_INFO data structure, it needs to 50 | // be the size of the data structure without the FileName field. The following macro 51 | // computes this size correctly no matter how big the FileName array is declared. 52 | // This is required to make the EFI_FILE_INFO data structure ANSI compilant. 53 | // 54 | #define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET (EFI_FILE_INFO, FileName) 55 | 56 | extern EFI_GUID gEfiFileInfoGuid; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /sdk/include/Protocol/FirmwareVolumeDispatch/FirmwareVolumeDispatch.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | FirmwareVolumeDispatch.h 15 | 16 | Abstract: 17 | 18 | Firmware Volume Dispatch protocol as defined in the Tiano Firmware Volume 19 | specification. 20 | 21 | Presence of this protocol tells the dispatch to dispatch from this Firmware 22 | Volume 23 | 24 | --*/ 25 | 26 | #ifndef __FIRMWARE_VOLUME_DISPATCH_H__ 27 | #define __FIRMWARE_VOLUME_DISPATCH_H__ 28 | 29 | #define EFI_FIRMWARE_VOLUME_DISPATCH_PROTOCOL_GUID \ 30 | { 0x7aa35a69, 0x506c, 0x444f, 0xa7, 0xaf, 0x69, 0x4b, 0xf5, 0x6f, 0x71, 0xc8 } 31 | 32 | 33 | extern EFI_GUID gEfiFirmwareVolumeDispatchProtocolGuid; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /sdk/include/Protocol/LoadFile/LoadFile.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | LoadFile.h 15 | 16 | Abstract: 17 | 18 | Load File protocol as defined in the EFI 1.0 specification. 19 | 20 | Load file protocol exists to supports the addition of new boot devices, 21 | and to support booting from devices that do not map well to file system. 22 | Network boot is done via a LoadFile protocol. 23 | 24 | EFI 1.0 can boot from any device that produces a LoadFile protocol. 25 | 26 | --*/ 27 | 28 | #ifndef _LOAD_FILE_H_ 29 | #define _LOAD_FILE_H_ 30 | 31 | #define LOAD_FILE_PROTOCOL_GUID \ 32 | { \ 33 | 0x56EC3091, 0x954C, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B \ 34 | } 35 | 36 | EFI_FORWARD_DECLARATION (EFI_LOAD_FILE_PROTOCOL); 37 | 38 | typedef 39 | EFI_STATUS 40 | (EFIAPI *EFI_LOAD_FILE) ( 41 | IN EFI_LOAD_FILE_PROTOCOL * This, 42 | IN EFI_DEVICE_PATH_PROTOCOL * FilePath, 43 | IN BOOLEAN BootPolicy, 44 | IN OUT UINTN *BufferSize, 45 | IN VOID *Buffer OPTIONAL 46 | ) 47 | /*++ 48 | 49 | Routine Description: 50 | Causes the driver to load a specified file. 51 | 52 | Arguments: 53 | This - Protocol instance pointer. 54 | FilePath - The device specific path of the file to load. 55 | BootPolicy - If TRUE, indicates that the request originates from the 56 | boot manager is attempting to load FilePath as a boot 57 | selection. If FALSE, then FilePath must match as exact file 58 | to be loaded. 59 | BufferSize - On input the size of Buffer in bytes. On output with a return 60 | code of EFI_SUCCESS, the amount of data transferred to 61 | Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL, 62 | the size of Buffer required to retrieve the requested file. 63 | Buffer - The memory buffer to transfer the file to. IF Buffer is NULL, 64 | then no the size of the requested file is returned in 65 | BufferSize. 66 | 67 | Returns: 68 | EFI_SUCCESS - The file was loaded. 69 | EFI_UNSUPPORTED - The device does not support the provided BootPolicy 70 | EFI_INVALID_PARAMETER - FilePath is not a valid device path, or 71 | BufferSize is NULL. 72 | EFI_NO_MEDIA - No medium was present to load the file. 73 | EFI_DEVICE_ERROR - The file was not loaded due to a device error. 74 | EFI_NO_RESPONSE - The remote system did not respond. 75 | EFI_NOT_FOUND - The file was not found 76 | EFI_ABORTED - The file load process was manually cancelled. 77 | 78 | --*/ 79 | ; 80 | 81 | typedef struct _EFI_LOAD_FILE_PROTOCOL { 82 | EFI_LOAD_FILE LoadFile; 83 | } EFI_LOAD_FILE_PROTOCOL; 84 | 85 | extern EFI_GUID gEfiLoadFileProtocolGuid; 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /sdk/include/Protocol/LoadedImage/LoadedImage.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | LoadedImage.h 15 | 16 | Abstract: 17 | 18 | EFI 1.0 Loaded image protocol definition. 19 | 20 | Every EFI driver and application is passed an image handle when it is loaded. 21 | This image handle will contain a Loaded Image Protocol. 22 | 23 | --*/ 24 | 25 | #ifndef _LOADED_IMAGE_H_ 26 | #define _LOADED_IMAGE_H_ 27 | 28 | #define EFI_LOADED_IMAGE_PROTOCOL_GUID \ 29 | { \ 30 | 0x5B1B31A1, 0x9562, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B \ 31 | } 32 | 33 | // 34 | // EFI_SYSTEM_TABLE & EFI_IMAGE_UNLOAD are defined in EfiApi.h 35 | // 36 | #define EFI_LOADED_IMAGE_INFORMATION_REVISION 0x1000 37 | 38 | typedef struct { 39 | UINT32 Revision; 40 | EFI_HANDLE ParentHandle; 41 | EFI_SYSTEM_TABLE *SystemTable; 42 | 43 | // 44 | // Source location of image 45 | // 46 | EFI_HANDLE DeviceHandle; 47 | EFI_DEVICE_PATH_PROTOCOL *FilePath; 48 | VOID *Reserved; 49 | 50 | // 51 | // Images load options 52 | // 53 | UINT32 LoadOptionsSize; 54 | VOID *LoadOptions; 55 | 56 | // 57 | // Location of where image was loaded 58 | // 59 | VOID *ImageBase; 60 | UINT64 ImageSize; 61 | EFI_MEMORY_TYPE ImageCodeType; 62 | EFI_MEMORY_TYPE ImageDataType; 63 | 64 | // 65 | // If the driver image supports a dynamic unload request 66 | // 67 | EFI_IMAGE_UNLOAD Unload; 68 | 69 | } EFI_LOADED_IMAGE_PROTOCOL; 70 | 71 | extern EFI_GUID gEfiLoadedImageProtocolGuid; 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /sdk/include/Protocol/SimplePointer/SimplePointer.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | SimplePointer.h 15 | 16 | Abstract: 17 | 18 | Simple Pointer protocol from the EFI 1.1 specification. 19 | 20 | Abstraction of a very simple pointer device like a mice or tracekballs. 21 | 22 | --*/ 23 | 24 | #ifndef _SIMPLE_POINTER_H_ 25 | #define _SIMPLE_POINTER_H_ 26 | 27 | #define EFI_SIMPLE_POINTER_PROTOCOL_GUID \ 28 | { \ 29 | 0x31878c87, 0xb75, 0x11d5, 0x9a, 0x4f, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d \ 30 | } 31 | 32 | EFI_FORWARD_DECLARATION (EFI_SIMPLE_POINTER_PROTOCOL); 33 | 34 | // 35 | // Data structures 36 | // 37 | typedef struct { 38 | INT32 RelativeMovementX; 39 | INT32 RelativeMovementY; 40 | INT32 RelativeMovementZ; 41 | BOOLEAN LeftButton; 42 | BOOLEAN RightButton; 43 | } EFI_SIMPLE_POINTER_STATE; 44 | 45 | typedef struct { 46 | UINT64 ResolutionX; 47 | UINT64 ResolutionY; 48 | UINT64 ResolutionZ; 49 | BOOLEAN LeftButton; 50 | BOOLEAN RightButton; 51 | } EFI_SIMPLE_POINTER_MODE; 52 | 53 | typedef 54 | EFI_STATUS 55 | (EFIAPI *EFI_SIMPLE_POINTER_RESET) ( 56 | IN EFI_SIMPLE_POINTER_PROTOCOL * This, 57 | IN BOOLEAN ExtendedVerification 58 | ); 59 | 60 | typedef 61 | EFI_STATUS 62 | (EFIAPI *EFI_SIMPLE_POINTER_GET_STATE) ( 63 | IN EFI_SIMPLE_POINTER_PROTOCOL * This, 64 | IN OUT EFI_SIMPLE_POINTER_STATE * State 65 | ); 66 | 67 | typedef struct _EFI_SIMPLE_POINTER_PROTOCOL { 68 | EFI_SIMPLE_POINTER_RESET Reset; 69 | EFI_SIMPLE_POINTER_GET_STATE GetState; 70 | EFI_EVENT WaitForInput; 71 | EFI_SIMPLE_POINTER_MODE *Mode; 72 | } EFI_SIMPLE_POINTER_PROTOCOL; 73 | 74 | extern EFI_GUID gEfiSimplePointerProtocolGuid; 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /sdk/include/Protocol/SimpleTextIn/SimpleTextIn.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | SimpleTextIn.h 15 | 16 | Abstract: 17 | 18 | Simple Text In protocol from the EFI 1.0 specification. 19 | 20 | Abstraction of a very simple input device like a keyboard or serial 21 | terminal. 22 | 23 | --*/ 24 | 25 | #ifndef _SIMPLE_TEXT_IN_H_ 26 | #define _SIMPLE_TEXT_IN_H_ 27 | 28 | #define EFI_SIMPLE_TEXT_IN_PROTOCOL_GUID \ 29 | { \ 30 | 0x387477c1, 0x69c7, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b \ 31 | } 32 | 33 | EFI_FORWARD_DECLARATION (EFI_SIMPLE_TEXT_IN_PROTOCOL); 34 | 35 | // 36 | // Data structures 37 | // 38 | typedef struct { 39 | UINT16 ScanCode; 40 | CHAR16 UnicodeChar; 41 | } EFI_INPUT_KEY; 42 | 43 | // 44 | // Required unicode control chars 45 | // 46 | #define CHAR_NULL 0x0000 47 | #define CHAR_BACKSPACE 0x0008 48 | #define CHAR_TAB 0x0009 49 | #define CHAR_LINEFEED 0x000A 50 | #define CHAR_CARRIAGE_RETURN 0x000D 51 | 52 | // 53 | // EFI Scan codes 54 | // 55 | #define SCAN_NULL 0x0000 56 | #define SCAN_UP 0x0001 57 | #define SCAN_DOWN 0x0002 58 | #define SCAN_RIGHT 0x0003 59 | #define SCAN_LEFT 0x0004 60 | #define SCAN_HOME 0x0005 61 | #define SCAN_END 0x0006 62 | #define SCAN_INSERT 0x0007 63 | #define SCAN_DELETE 0x0008 64 | #define SCAN_PAGE_UP 0x0009 65 | #define SCAN_PAGE_DOWN 0x000A 66 | #define SCAN_F1 0x000B 67 | #define SCAN_F2 0x000C 68 | #define SCAN_F3 0x000D 69 | #define SCAN_F4 0x000E 70 | #define SCAN_F5 0x000F 71 | #define SCAN_F6 0x0010 72 | #define SCAN_F7 0x0011 73 | #define SCAN_F8 0x0012 74 | #define SCAN_F9 0x0013 75 | #define SCAN_F10 0x0014 76 | #define SCAN_F11 0x0015 77 | #define SCAN_F12 0x0016 78 | #define SCAN_ESC 0x0017 79 | 80 | typedef 81 | EFI_STATUS 82 | (EFIAPI *EFI_INPUT_RESET) ( 83 | IN EFI_SIMPLE_TEXT_IN_PROTOCOL * This, 84 | IN BOOLEAN ExtendedVerification 85 | ) 86 | /*++ 87 | 88 | Routine Description: 89 | Reset the input device and optionaly run diagnostics 90 | 91 | Arguments: 92 | This - Protocol instance pointer. 93 | ExtendedVerification - Driver may perform diagnostics on reset. 94 | 95 | Returns: 96 | EFI_SUCCESS - The device was reset. 97 | EFI_DEVICE_ERROR - The device is not functioning properly and could 98 | not be reset. 99 | 100 | --*/ 101 | ; 102 | 103 | typedef 104 | EFI_STATUS 105 | (EFIAPI *EFI_INPUT_READ_KEY) ( 106 | IN EFI_SIMPLE_TEXT_IN_PROTOCOL * This, 107 | OUT EFI_INPUT_KEY * Key 108 | ) 109 | /*++ 110 | 111 | Routine Description: 112 | Reads the next keystroke from the input device. The WaitForKey Event can 113 | be used to test for existance of a keystroke via WaitForEvent () call. 114 | 115 | Arguments: 116 | This - Protocol instance pointer. 117 | Key - Driver may perform diagnostics on reset. 118 | 119 | Returns: 120 | EFI_SUCCESS - The keystroke information was returned. 121 | EFI_NOT_READY - There was no keystroke data availiable. 122 | EFI_DEVICE_ERROR - The keydtroke information was not returned due to 123 | hardware errors. 124 | 125 | --*/ 126 | ; 127 | 128 | typedef struct _EFI_SIMPLE_TEXT_IN_PROTOCOL { 129 | EFI_INPUT_RESET Reset; 130 | EFI_INPUT_READ_KEY ReadKeyStroke; 131 | EFI_EVENT WaitForKey; 132 | } EFI_SIMPLE_TEXT_IN_PROTOCOL; 133 | 134 | extern EFI_GUID gEfiSimpleTextInProtocolGuid; 135 | 136 | #endif 137 | -------------------------------------------------------------------------------- /sdk/include/x64/EfiBind.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2005 - 2007, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | EfiBind.h 15 | 16 | Abstract: 17 | 18 | Processor or Compiler specific defines and types for x64. 19 | We are using the ANSI C 2000 _t type definitions for basic types. 20 | This it technically a violation of the coding standard, but they 21 | are used to make EfiTypes.h portable. Code other than EfiTypes.h 22 | should never use any ANSI C 2000 _t integer types. 23 | 24 | --*/ 25 | 26 | #ifndef _EFI_BIND_H_ 27 | #define _EFI_BIND_H_ 28 | 29 | 30 | #define EFI_DRIVER_ENTRY_POINT(InitFunction) 31 | #define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT 32 | 33 | 34 | 35 | // 36 | // Make sure we are useing the correct packing rules per EFI specification 37 | // 38 | #pragma pack() 39 | 40 | #if _MSC_EXTENSIONS 41 | 42 | // 43 | // Disable warning that make it impossible to compile at /W4 44 | // This only works for Microsoft* tools 45 | // 46 | 47 | // 48 | // Disabling bitfield type checking warnings. 49 | // 50 | #pragma warning ( disable : 4214 ) 51 | 52 | // 53 | // Disabling the unreferenced formal parameter warnings. 54 | // 55 | #pragma warning ( disable : 4100 ) 56 | 57 | // 58 | // Disable slightly different base types warning as CHAR8 * can not be set 59 | // to a constant string. 60 | // 61 | #pragma warning ( disable : 4057 ) 62 | 63 | // 64 | // ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning 65 | // 66 | #pragma warning ( disable : 4127 ) 67 | 68 | // 69 | // Int64ShllMod32 unreferenced inline function 70 | // 71 | #pragma warning ( disable : 4514 ) 72 | 73 | // 74 | // Unreferenced formal parameter - We are object oriented, so we pass This even 75 | // if we don't need them. 76 | // 77 | #pragma warning ( disable : 4100 ) 78 | 79 | // 80 | // This warning is caused by empty (after preprocessing) souce file. 81 | // 82 | #pragma warning ( disable : 4206 ) 83 | 84 | // 85 | // Warning: The result of the unary '&' operator may be unaligned. Ignore it. 86 | // 87 | #pragma warning ( disable : 4366 ) 88 | 89 | #endif 90 | 91 | 92 | #if (__STDC_VERSION__ < 199901L) 93 | // 94 | // No ANSI C 2000 stdint.h integer width declarations, so define equivalents 95 | // 96 | 97 | #if _MSC_EXTENSIONS 98 | 99 | // 100 | // use Microsoft* C complier dependent interger width types 101 | // 102 | typedef unsigned __int64 uint64_t; 103 | typedef __int64 int64_t; 104 | typedef unsigned __int32 uint32_t; 105 | typedef __int32 int32_t; 106 | typedef unsigned short uint16_t; 107 | typedef short int16_t; 108 | typedef unsigned char uint8_t; 109 | typedef char int8_t; 110 | #else 111 | 112 | // 113 | // Assume standard IA-32 alignment. 114 | // BugBug: Need to check portability of long long 115 | // 116 | typedef unsigned long long uint64_t; 117 | typedef long long int64_t; 118 | typedef unsigned int uint32_t; 119 | typedef int int32_t; 120 | typedef unsigned short uint16_t; 121 | typedef short int16_t; 122 | typedef unsigned char uint8_t; 123 | typedef char int8_t; 124 | #endif 125 | #else 126 | // 127 | // Use ANSI C 2000 stdint.h integer width declarations 128 | // 129 | #include "stdint.h" 130 | #endif 131 | 132 | // 133 | // Native integer size in stdint.h 134 | // 135 | typedef uint64_t uintn_t; 136 | typedef int64_t intn_t; 137 | 138 | // 139 | // Processor specific defines 140 | // 141 | #define EFI_MAX_BIT 0x8000000000000000 142 | #define MAX_2_BITS 0xC000000000000000 143 | 144 | // 145 | // Maximum legal IA-32 address 146 | // 147 | #define EFI_MAX_ADDRESS 0xFFFFFFFFFFFFFFFF 148 | 149 | // 150 | // Bad pointer value to use in check builds. 151 | // if you see this value you are using uninitialized or free'ed data 152 | // 153 | #define EFI_BAD_POINTER 0xAFAFAFAFAFAFAFAF 154 | #define EFI_BAD_POINTER_AS_BYTE 0xAF 155 | 156 | // 157 | // Inject a break point in the code to assist debugging. 158 | // 159 | #define EFI_DEADLOOP() { volatile int __iii; __iii = 1; while (__iii); } 160 | #define EFI_BREAKPOINT() __debugbreak() 161 | 162 | // 163 | // Memory Fence forces serialization, and is needed to support out of order 164 | // memory transactions. The Memory Fence is mainly used to make sure IO 165 | // transactions complete in a deterministic sequence, and to syncronize locks 166 | // an other MP code. Currently no memory fencing is required. 167 | // 168 | #define MEMORY_FENCE() 169 | 170 | // 171 | // Some compilers don't support the forward reference construct: 172 | // typedef struct XXXXX. The forward reference is required for 173 | // ANSI compatibility. 174 | // 175 | // The following macro provide a workaround for such cases. 176 | // 177 | 178 | 179 | #ifdef EFI_NO_INTERFACE_DECL 180 | #define EFI_FORWARD_DECLARATION(x) 181 | #else 182 | #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x 183 | #endif 184 | 185 | 186 | // 187 | // Some C compilers optimize the calling conventions to increase performance. 188 | // _EFIAPI is used to make all public APIs follow the standard C calling 189 | // convention. 190 | // 191 | #if _MSC_EXTENSIONS 192 | // 193 | // Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C. 194 | // 195 | 196 | #define _EFIAPI __cdecl 197 | #else 198 | #define _EFIAPI 199 | #endif 200 | 201 | 202 | #ifdef _EFI_WINNT 203 | 204 | #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \ 205 | warning ( disable : 4142 ) 206 | 207 | #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \ 208 | warning ( default : 4142 ) 209 | #else 210 | 211 | #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \ 212 | warning ( disable : 4068 ) 213 | 214 | #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \ 215 | warning ( default : 4068 ) 216 | 217 | #endif 218 | 219 | 220 | 221 | #endif 222 | 223 | -------------------------------------------------------------------------------- /sdk/include/x64/EfiPeOptionalHeader.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2005 - 2006, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | EfiPeOptionalHeader.h 15 | 16 | Abstract: 17 | Defines the optional header in the PE image per the PE specification. This 18 | file must be included only from within EfiImage.h since 19 | EFI_IMAGE_DATA_DIRECTORY and EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES are defined 20 | there. 21 | 22 | --*/ 23 | 24 | #ifndef _EFI_PE_OPTIONAL_HEADER_H_ 25 | #define _EFI_PE_OPTIONAL_HEADER_H_ 26 | 27 | #define EFI_IMAGE_MACHINE_TYPE (EFI_IMAGE_MACHINE_X64) 28 | 29 | #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \ 30 | (((Machine) == EFI_IMAGE_MACHINE_X64) || ((Machine) == EFI_IMAGE_MACHINE_EBC)) 31 | 32 | #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_IA32) 33 | 34 | // 35 | // Assume we can use IPF values 36 | // 37 | #define EFI_IMAGE_NT_OPTIONAL_HDR_MAGIC EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC 38 | typedef EFI_IMAGE_OPTIONAL_HEADER64 EFI_IMAGE_OPTIONAL_HEADER; 39 | typedef EFI_IMAGE_NT_HEADERS64 EFI_IMAGE_NT_HEADERS; 40 | 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /sdk/include/x86/EfiPeOptionalHeader.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 2004 - 2006, Intel Corporation 4 | All rights reserved. This program and the accompanying materials 5 | are licensed and made available under the terms and conditions of the BSD License 6 | which accompanies this distribution. The full text of the license may be found at 7 | http://opensource.org/licenses/bsd-license.php 8 | 9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 | 12 | Module Name: 13 | 14 | EfiPeOptionalHeader.h 15 | 16 | Abstract: 17 | Defines the optional header in the PE image per the PE specification. This 18 | file must be included only from within EfiImage.h since 19 | EFI_IMAGE_DATA_DIRECTORY and EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES are defined 20 | there. 21 | 22 | --*/ 23 | 24 | #ifndef _EFI_PE_OPTIONAL_HEADER_H_ 25 | #define _EFI_PE_OPTIONAL_HEADER_H_ 26 | 27 | #define EFI_IMAGE_MACHINE_TYPE (EFI_IMAGE_MACHINE_IA32) 28 | 29 | #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \ 30 | (((Machine) == EFI_IMAGE_MACHINE_IA32) || ((Machine) == EFI_IMAGE_MACHINE_EBC)) 31 | 32 | #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_X64) 33 | 34 | #define EFI_IMAGE_NT_OPTIONAL_HDR_MAGIC EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC 35 | typedef EFI_IMAGE_OPTIONAL_HEADER32 EFI_IMAGE_OPTIONAL_HEADER; 36 | typedef EFI_IMAGE_NT_HEADERS32 EFI_IMAGE_NT_HEADERS; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/boot.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "boot", "boot\boot.vcxproj", "{70F7FD9D-E4CB-43B3-8A96-43C7E33288CB}" 5 | ProjectSection(ProjectDependencies) = postProject 6 | {1B43E5F7-D447-4FCF-AC9B-4767AB47DB8B} = {1B43E5F7-D447-4FCF-AC9B-4767AB47DB8B} 7 | EndProjectSection 8 | EndProject 9 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_props", "_props", "{63AAC00E-25BA-4B7B-96EF-0B951C8AD68C}" 10 | ProjectSection(SolutionItems) = preProject 11 | common.props = common.props 12 | debug.props = debug.props 13 | release.props = release.props 14 | EndProjectSection 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rijndael", "rijndael\rijndael.vcxproj", "{1B43E5F7-D447-4FCF-AC9B-4767AB47DB8B}" 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 20 | Debug|Win32 = Debug|Win32 21 | Debug|x64 = Debug|x64 22 | Release|Win32 = Release|Win32 23 | Release|x64 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 26 | {70F7FD9D-E4CB-43B3-8A96-43C7E33288CB}.Debug|Win32.ActiveCfg = Debug|Win32 27 | {70F7FD9D-E4CB-43B3-8A96-43C7E33288CB}.Debug|Win32.Build.0 = Debug|Win32 28 | {70F7FD9D-E4CB-43B3-8A96-43C7E33288CB}.Debug|x64.ActiveCfg = Debug|x64 29 | {70F7FD9D-E4CB-43B3-8A96-43C7E33288CB}.Debug|x64.Build.0 = Debug|x64 30 | {70F7FD9D-E4CB-43B3-8A96-43C7E33288CB}.Release|Win32.ActiveCfg = Release|Win32 31 | {70F7FD9D-E4CB-43B3-8A96-43C7E33288CB}.Release|Win32.Build.0 = Release|Win32 32 | {70F7FD9D-E4CB-43B3-8A96-43C7E33288CB}.Release|x64.ActiveCfg = Release|x64 33 | {70F7FD9D-E4CB-43B3-8A96-43C7E33288CB}.Release|x64.Build.0 = Release|x64 34 | {1B43E5F7-D447-4FCF-AC9B-4767AB47DB8B}.Debug|Win32.ActiveCfg = Debug|Win32 35 | {1B43E5F7-D447-4FCF-AC9B-4767AB47DB8B}.Debug|Win32.Build.0 = Debug|Win32 36 | {1B43E5F7-D447-4FCF-AC9B-4767AB47DB8B}.Debug|x64.ActiveCfg = Debug|x64 37 | {1B43E5F7-D447-4FCF-AC9B-4767AB47DB8B}.Debug|x64.Build.0 = Debug|x64 38 | {1B43E5F7-D447-4FCF-AC9B-4767AB47DB8B}.Release|Win32.ActiveCfg = Release|Win32 39 | {1B43E5F7-D447-4FCF-AC9B-4767AB47DB8B}.Release|Win32.Build.0 = Release|Win32 40 | {1B43E5F7-D447-4FCF-AC9B-4767AB47DB8B}.Release|x64.ActiveCfg = Release|x64 41 | {1B43E5F7-D447-4FCF-AC9B-4767AB47DB8B}.Release|x64.Build.0 = Release|x64 42 | EndGlobalSection 43 | GlobalSection(SolutionProperties) = preSolution 44 | HideSolutionNode = FALSE 45 | EndGlobalSection 46 | GlobalSection(ExtensibilityGlobals) = postSolution 47 | VisualSVNWorkingCopyRoot = . 48 | EndGlobalSection 49 | EndGlobal 50 | -------------------------------------------------------------------------------- /src/boot/AcpiUtils.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 6:11:2009 15:28 3 | // filename: AcpiUtils.h 4 | // author: tiamo 5 | // purpose: acpi utils 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // get fadt 12 | // 13 | VOID CONST* AcpiGetFixedAcpiDescriptionTable(); 14 | 15 | // 16 | // get machine signature 17 | // 18 | EFI_STATUS AcpiGetMachineSignature(UINT32* machineSignature); 19 | 20 | // 21 | // get pci config space info 22 | // 23 | EFI_STATUS AcpiGetPciConfigSpaceInfo(UINT64* baseAddress, UINT32* startBus, UINT32* endBus); 24 | 25 | // 26 | // detect acpi nvs memory 27 | // 28 | VOID AcpiDetectNVSMemory(); 29 | 30 | // 31 | // adjust memory map for acpi nvs memory 32 | // 33 | UINTN AcpiAdjustMemoryMap(EFI_MEMORY_DESCRIPTOR* memoryMap, UINTN memoryMapSize, UINTN descriptorSize); -------------------------------------------------------------------------------- /src/boot/ArchUtils.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 4:11:2009 10:34 3 | // filename: ArchUtils.h 4 | // author: tiamo 5 | // purpose: arch utils 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // initialize phase 0 12 | // 13 | EFI_STATUS ArchInitialize0(); 14 | 15 | // 16 | // initialize phase 1 17 | // 18 | EFI_STATUS ArchInitialize1(); 19 | 20 | // 21 | // check 64bit cpu 22 | // 23 | EFI_STATUS ArchCheck64BitCpu(); 24 | 25 | // 26 | // sweep instruction cache 27 | // 28 | VOID BOOTAPI ArchSweepIcacheRange(VOID* startAddress, UINT32 bytesCount); 29 | 30 | // 31 | // transfer to kernel 32 | // 33 | VOID BOOTAPI ArchStartKernel(VOID* kernelEntry, VOID* bootArgs); 34 | 35 | // 36 | // setup thunk code 37 | // 38 | VOID BOOTAPI ArchSetupThunkCode0(UINT64 thunkOffset, struct _MACH_O_LOADED_INFO* loadedInfo); 39 | 40 | // 41 | // setup thunk code 42 | // 43 | VOID BOOTAPI ArchSetupThunkCode1(UINT64* efiSystemTablePhysicalAddress, UINT64 thunkOffset); 44 | 45 | // 46 | // cpu id 47 | // 48 | VOID BOOTAPI ArchCpuId(UINT32 command, UINT32* eaxValue, UINT32* ebxValue, UINT32* ecxValue, UINT32* edxValue); 49 | 50 | // 51 | // get cpu tick 52 | // 53 | UINT64 BOOTAPI ArchGetCpuTick(); 54 | 55 | // 56 | // random 57 | // 58 | UINTN BOOTAPI ArchHardwareRandom(); 59 | 60 | // 61 | // read port uint8 62 | // 63 | UINT8 BOOTAPI ARCH_READ_PORT_UINT8(UINT8* port); 64 | 65 | // 66 | // read port uint16 67 | // 68 | UINT16 BOOTAPI ARCH_READ_PORT_UINT16(UINT16* port); 69 | 70 | // 71 | // read port uint32 72 | // 73 | UINT32 BOOTAPI ARCH_READ_PORT_UINT32(UINT32* port); 74 | 75 | // 76 | // write port uint8 77 | // 78 | VOID BOOTAPI ARCH_WRITE_PORT_UINT8(UINT8* port, UINT8 value); 79 | 80 | // 81 | // write port uint16 82 | // 83 | VOID BOOTAPI ARCH_WRITE_PORT_UINT16(UINT16* port, UINT16 value); 84 | 85 | // 86 | // write port uint32 87 | // 88 | VOID BOOTAPI ARCH_WRITE_PORT_UINT32(UINT32* port, UINT32 value); 89 | 90 | // 91 | // read register uint8 92 | // 93 | UINT8 BOOTAPI ARCH_READ_REGISTER_UINT8(UINT8* port); 94 | 95 | // 96 | // read register uint16 97 | // 98 | UINT16 BOOTAPI ARCH_READ_REGISTER_UINT16(UINT16* port); 99 | 100 | // 101 | // read register uint32 102 | // 103 | UINT32 BOOTAPI ARCH_READ_REGISTER_UINT32(UINT32* port); 104 | 105 | // 106 | // write register uint8 107 | // 108 | VOID BOOTAPI ARCH_WRITE_REGISTER_UINT8(UINT8* port, UINT8 value); 109 | 110 | // 111 | // write register uint16 112 | // 113 | VOID BOOTAPI ARCH_WRITE_REGISTER_UINT16(UINT16* port, UINT16 value); 114 | 115 | // 116 | // write register uint32 117 | // 118 | VOID BOOTAPI ARCH_WRITE_REGISTER_UINT32(UINT32* port, UINT32 value); -------------------------------------------------------------------------------- /src/boot/Base64.cpp: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 20:9:2012 21:17 3 | // filename: Base64.cpp 4 | // author: tiamo 5 | // purpose: base64 6 | //******************************************************************** 7 | 8 | #include "StdAfx.h" 9 | 10 | // 11 | // decode 12 | // 13 | UINTN Base64Decode(CHAR8 CONST* inputString, UINTN inputLength, VOID* outputBuffer, UINTN* outputLength) 14 | { 15 | STATIC CHAR8 table64[] = "|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq"; 16 | UINTN retLength = 0; 17 | 18 | while(inputLength && *inputString) 19 | { 20 | CHAR8 iBuf[4] = {0}; 21 | CHAR8 oBuf[3] = {0}; 22 | UINTN inputParts = 0; 23 | for(UINTN i = 0; i < 4; ) 24 | { 25 | iBuf[i] = 0; 26 | CHAR8 v = inputLength ? *inputString : 0; 27 | if(!v) 28 | break; 29 | 30 | inputString += 1; 31 | inputLength -= 1; 32 | if(v == '\n' || v == '\r' || v == '\t' || v == ' ') 33 | continue; 34 | 35 | inputParts += 1; 36 | v = v < 43 || v > 122 ? 0 : table64[v - 43]; 37 | if(v) 38 | v = v == '$' ? 0 : v - 61; 39 | iBuf[i++] = v ? v - 1 : 0; 40 | } 41 | if(!inputParts) 42 | break; 43 | 44 | oBuf[0] = (iBuf[0] << 2 | iBuf[1] >> 4); 45 | oBuf[1] = (iBuf[1] << 4 | iBuf[2] >> 2); 46 | oBuf[2] = (((iBuf[2] << 6) & 0xc0) | iBuf[3]); 47 | 48 | if(*outputLength < retLength + inputParts - 1) 49 | break; 50 | 51 | memcpy(Add2Ptr(outputBuffer, retLength, VOID*), oBuf, inputParts - 1); 52 | retLength += inputParts - 1; 53 | } 54 | 55 | *outputLength = retLength; 56 | return inputLength; 57 | } 58 | 59 | -------------------------------------------------------------------------------- /src/boot/Base64.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 20:9:2012 21:16 3 | // filename: Base64.h 4 | // author: tiamo 5 | // purpose: base64 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // decode 12 | // 13 | UINTN Base64Decode(CHAR8 CONST* inputString, UINTN inputLength, VOID* outputBuffer, UINTN* outputLength); 14 | -------------------------------------------------------------------------------- /src/boot/BootArgs.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 8:11:2009 16:39 3 | // filename: BootArgs.h 4 | // author: tiamo 5 | // purpose: boot arg 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // video 12 | // 13 | #include 14 | typedef struct _BOOT_VIDEO 15 | { 16 | // 17 | // vram base address 18 | // 19 | UINT32 BaseAddress; 20 | 21 | // 22 | // mode,1 = graph,2 = text 23 | // 24 | UINT32 DisplayMode; 25 | 26 | // 27 | // bytes per row 28 | // 29 | UINT32 BytesPerRow; 30 | 31 | // 32 | // horz res 33 | // 34 | UINT32 HorzRes; 35 | 36 | // 37 | // vert res 38 | // 39 | UINT32 VertRes; 40 | 41 | // 42 | // color depth 43 | // 44 | UINT32 ColorDepth; 45 | }BOOT_VIDEO; 46 | 47 | // 48 | // boot arg 49 | // 50 | typedef struct _BOOT_ARGS 51 | { 52 | // 53 | // revision 54 | // 55 | UINT16 Revision; 56 | 57 | // 58 | // version 59 | // 60 | UINT16 Version; 61 | 62 | // 63 | // efi mode 64 | // 65 | UINT8 EfiMode; 66 | 67 | // 68 | // debug mode 69 | // 70 | UINT8 DebugMode; 71 | 72 | // 73 | // flags 74 | // 75 | UINT16 Flags; 76 | 77 | // 78 | // command line 79 | // 80 | CHAR8 CommandLine[1024]; 81 | 82 | // 83 | // memory map physical address < 4GB 84 | // 85 | UINT32 MemoryMap; 86 | 87 | // 88 | // memory map size 89 | // 90 | UINT32 MemoryMapSize; 91 | 92 | // 93 | // memory map descriptor size 94 | // 95 | UINT32 MemoryMapDescriptorSize; 96 | 97 | // 98 | // memory map descriptor version 99 | // 100 | UINT32 MemoryMapDescriptorVersion; 101 | 102 | // 103 | // video 104 | // 105 | BOOT_VIDEO BootVideo; 106 | 107 | // 108 | // device tree physical address < 4GB 109 | // 110 | UINT32 DeviceTree; 111 | 112 | // 113 | // device tree length 114 | // 115 | UINT32 DeviceTreeLength; 116 | 117 | // 118 | // kernel start physical address < 4GB 119 | // 120 | UINT32 KernelAddress; 121 | 122 | // 123 | // kernel size 124 | // 125 | UINT32 KernelSize; 126 | 127 | // 128 | // efi runtime page start physical address 129 | // 130 | UINT32 EfiRuntimeServicesPageStart; 131 | 132 | // 133 | // efi runtime page count 134 | // 135 | UINT32 EfiRuntimeServicesPageCount; 136 | 137 | // 138 | // efi runtime page start virtual address 139 | // 140 | UINT64 EfiRuntimeServicesVirtualPageStart; 141 | 142 | // 143 | // system table physical address 144 | // 145 | UINT32 EfiSystemTable; 146 | 147 | // 148 | // ASLR displacement 149 | // 150 | UINT32 ASLRDisplacement; 151 | 152 | // 153 | // performance data start 154 | // 155 | UINT32 PerformanceDataStart; 156 | 157 | // 158 | // performance data size 159 | // 160 | UINT32 PerformanceDataSize; 161 | 162 | // 163 | // key store data start 164 | // 165 | UINT32 KeyStoreDataStart; 166 | 167 | // 168 | // key store data size 169 | // 170 | UINT32 KeyStoreDataSize; 171 | 172 | // 173 | // boot mem start 174 | // 175 | UINT64 BootMemStart; 176 | 177 | // 178 | // boot mem size 179 | // 180 | UINT64 BootMemSize; 181 | 182 | // 183 | // physical memory size 184 | // 185 | UINT64 PhysicalMemorySize; 186 | 187 | // 188 | // FSB frequencey 189 | // 190 | UINT64 FSBFrequency; 191 | 192 | // 193 | // pci config space base address 194 | // 195 | UINT64 PCIConfigSpaceBaseAddress; 196 | 197 | // 198 | // pci config space start bus number 199 | // 200 | UINT32 PCIConfigSpaceStartBusNumber; 201 | 202 | // 203 | // pci config space end bus number 204 | // 205 | UINT32 PCIConfigSpaceEndBusNumber; 206 | 207 | // 208 | // padding 209 | // 210 | UINT32 Reserved3[730]; 211 | }BOOT_ARGS; 212 | #include 213 | 214 | // 215 | // add memory range 216 | // 217 | EFI_STATUS BlAddMemoryRangeNode(CHAR8 CONST* rangeName, UINT64 physicalAddress, UINT64 rangeLength); 218 | 219 | // 220 | // init boot args 221 | // 222 | EFI_STATUS BlInitializeBootArgs(EFI_DEVICE_PATH_PROTOCOL* bootDevicePath, EFI_DEVICE_PATH_PROTOCOL* bootFilePath, EFI_HANDLE kernelDeviceHandle, CHAR8 CONST* bootCommandLine, BOOT_ARGS** bootArgsP); 223 | 224 | // 225 | // finalize boot args 226 | // 227 | EFI_STATUS BlFinalizeBootArgs(BOOT_ARGS* bootArgs, CHAR8 CONST* kernelCommandLine, EFI_HANDLE bootDeviceHandle, struct _MACH_O_LOADED_INFO* loadedInfo); -------------------------------------------------------------------------------- /src/boot/BootDebugger.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 6:11:2009 21:34 3 | // filename: BootDebugger.h 4 | // author: tiamo 5 | // purpose: boot debugger 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // initialize boot debugger 12 | // 13 | EFI_STATUS BdInitialize(CHAR8 CONST* loaderOptions); 14 | 15 | // 16 | // debugger is enabled 17 | // 18 | BOOLEAN BdDebuggerEnabled(); 19 | 20 | // 21 | // poll break in 22 | // 23 | BOOLEAN BdPollBreakIn(); 24 | 25 | // 26 | // poll connection 27 | // 28 | VOID BdPollConnection(); 29 | 30 | // 31 | // dbg breakpoint 32 | // 33 | VOID BOOTAPI DbgBreakPoint(); 34 | 35 | // 36 | // dbg print 37 | // 38 | UINT32 DbgPrint(CHAR8 CONST* printFormat, ...); 39 | 40 | // 41 | // destroy debugger 42 | // 43 | EFI_STATUS BdFinalize(); -------------------------------------------------------------------------------- /src/boot/Config.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 8:11:2009 18:25 3 | // filename: Config.h 4 | // author: tiamo 5 | // purpose: config 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // define 12 | // 13 | #define XML_TAG_NONE 0 14 | #define XML_TAG_DICT 1 15 | #define XML_TAG_KEY 2 16 | #define XML_TAG_STRING 3 17 | #define XML_TAG_INTEGER 4 18 | #define XML_TAG_DATA 5 19 | #define XML_TAG_DATE 6 20 | #define XML_TAG_FALSE 7 21 | #define XML_TAG_TRUE 8 22 | #define XML_TAG_ARRAY 9 23 | 24 | // 25 | // xml tag 26 | // 27 | typedef struct _XML_TAG 28 | { 29 | // 30 | // type 31 | // 32 | UINTN Type; 33 | 34 | // 35 | // string value 36 | // 37 | CHAR8* StringValue; 38 | 39 | // 40 | // int value 41 | // 42 | INT64 IntegerValue; 43 | 44 | // 45 | // data buffer 46 | // 47 | VOID* DataValue; 48 | 49 | // 50 | // data length 51 | // 52 | UINTN DataLength; 53 | 54 | // 55 | // tag value 56 | // 57 | struct _XML_TAG* TagValue; 58 | 59 | // 60 | // next tag 61 | // 62 | struct _XML_TAG* NextTag; 63 | }XML_TAG; 64 | 65 | // 66 | // get value for key 67 | // 68 | CHAR8 CONST* CmGetStringValueForKeyAndCommandLine(CHAR8 CONST* commandLine, CHAR8 CONST* keyName, UINTN* valueLength, BOOLEAN checkConfigFile); 69 | 70 | // 71 | // parse config file 72 | // 73 | EFI_STATUS CmParseXmlFile(CHAR8* fileBuffer, XML_TAG** rootTag); 74 | 75 | // 76 | // get tag 77 | // 78 | XML_TAG* CmGetTagValueForKey(XML_TAG* dictTag, CHAR8 CONST* keyName); 79 | 80 | // 81 | // get integer value for key 82 | // 83 | EFI_STATUS CmGetIntegerValueForKey(CHAR8 CONST* keyName, INT64* integerValue); 84 | 85 | // 86 | // get string value for key 87 | // 88 | CHAR8 CONST* CmGetStringValueForKey(XML_TAG* dictTag, CHAR8 CONST* keyName, UINTN* valueLength); 89 | 90 | // 91 | // get list element count 92 | // 93 | UINTN CmGetListTagElementsCount(XML_TAG* listTag); 94 | 95 | // 96 | // get list element by index 97 | // 98 | XML_TAG* CmGetListTagElementByIndex(XML_TAG* listTag, UINTN index); 99 | 100 | // 101 | // serialize value 102 | // 103 | CHAR8 CONST* CmSerializeValueForKey(CHAR8 CONST* keyName, UINTN* valueLength); 104 | 105 | // 106 | // free tag 107 | // 108 | VOID CmFreeTag(XML_TAG* theTag); -------------------------------------------------------------------------------- /src/boot/Console.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 4:11:2009 10:41 3 | // filename: Console.h 4 | // author: tiamo 5 | // purpose: console 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // initialize 12 | // 13 | EFI_STATUS CsInitialize(); 14 | 15 | // 16 | // connect device 17 | // 18 | EFI_STATUS CsConnectDevice(BOOLEAN connectAll, BOOLEAN connectDisplay); 19 | 20 | // 21 | // set text mode 22 | // 23 | EFI_STATUS CsSetConsoleMode(BOOLEAN textMode, BOOLEAN force); 24 | 25 | // 26 | // initialize graph mode 27 | // 28 | EFI_STATUS CsInitializeGraphMode(); 29 | 30 | // 31 | // draw boot image 32 | // 33 | EFI_STATUS CsDrawBootImage(BOOLEAN normalLogo); 34 | 35 | // 36 | // draw panic image 37 | // 38 | EFI_STATUS CsDrawPanicImage(); 39 | 40 | // 41 | // initialize boot video 42 | // 43 | EFI_STATUS CsInitializeBootVideo(struct _BOOT_VIDEO* bootVideo); 44 | 45 | // 46 | // setup device tree 47 | // 48 | EFI_STATUS CsSetupDeviceTree(struct _BOOT_ARGS* bootArgs); 49 | 50 | // 51 | // clear screen 52 | // 53 | VOID CsClearScreen(); 54 | 55 | // 56 | // console finalize 57 | // 58 | EFI_STATUS CsFinalize(); 59 | 60 | // 61 | // print string 62 | // 63 | VOID CsPrintf(CHAR8 CONST* printForamt, ...); 64 | 65 | // 66 | // draw preview 67 | // 68 | VOID CsDrawPreview(HIBERNATE_PREVIEW* previewBuffer, UINT32 imageIndex, UINT8 progressSaveUnder[HIBERNATE_PROGRESS_COUNT][HIBERNATE_PROGRESS_SAVE_UNDER_SIZE], BOOLEAN colorMode, BOOLEAN fromFV2, INT32* gfxRestoreStatus); 69 | 70 | // 71 | // update progress 72 | // 73 | VOID CsUpdateProgress(UINT8 progressSaveUnder[HIBERNATE_PROGRESS_COUNT][HIBERNATE_PROGRESS_SAVE_UNDER_SIZE], UINTN prevBlob, UINTN currentBlob); -------------------------------------------------------------------------------- /src/boot/Crc32.cpp: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 11:11:2009 0:15 3 | // filename: Crc32.cpp 4 | // author: tiamo 5 | // purpose: crc32 6 | //******************************************************************** 7 | 8 | #include "stdafx.h" 9 | 10 | STATIC UINT32 CONST BlpCrc32Table[] = 11 | { 12 | 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 13 | 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 14 | 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 15 | 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 16 | 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 17 | 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 18 | 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 19 | 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 20 | 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 21 | 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 22 | 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 23 | 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 24 | 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 25 | 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 26 | 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 27 | 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, 28 | }; 29 | 30 | // 31 | // calc crc32 32 | // 33 | UINT32 BlCrc32(UINT32 crcValue, VOID CONST* inputBuffer, UINTN bufferLength) 34 | { 35 | UINT8 CONST* theBuffer = static_cast(inputBuffer); 36 | crcValue = ~crcValue; 37 | 38 | while(bufferLength --) 39 | crcValue = BlpCrc32Table[(crcValue ^ * theBuffer ++) & 0xff] ^ (crcValue >> 8); 40 | 41 | return ~crcValue; 42 | } -------------------------------------------------------------------------------- /src/boot/Crc32.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 11:11:2009 0:16 3 | // filename: Crc32.h 4 | // author: tiamo 5 | // purpose: crc32 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // calc crc32 12 | // 13 | UINT32 BlCrc32(UINT32 crcValue, VOID CONST* inputBuffer, UINTN bufferLength); -------------------------------------------------------------------------------- /src/boot/Debug1394.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 7:11:2009 2:01 3 | // filename: Debug1394.h 4 | // author: tiamo 5 | // purpose: debug over 1394 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | #include "BootDebuggerPrivate.h" 11 | 12 | // 13 | // setup debug device 14 | // 15 | EFI_STATUS Bd1394ConfigureDebuggerDevice(CHAR8 CONST* loaderOptions); 16 | 17 | // 18 | // send packet 19 | // 20 | VOID Bd1394SendPacket(UINT32 packetType, STRING* messageHeader, STRING* messageData); 21 | 22 | // 23 | // receive packet 24 | // 25 | UINT32 Bd1394ReceivePacket(UINT32 packetType, STRING* messageHeader, STRING* messageData, UINT32* dataLength); 26 | 27 | // 28 | // close debug device 29 | // 30 | EFI_STATUS Bd1394CloseDebuggerDevice(); -------------------------------------------------------------------------------- /src/boot/DebugUsb.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 5:8:2012 15:03 3 | // filename: DebugUsb.h 4 | // author: tiamo 5 | // purpose: debug over usb 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | #include "BootDebuggerPrivate.h" 11 | 12 | // 13 | // setup debug device 14 | // 15 | EFI_STATUS BdUsbConfigureDebuggerDevice(CHAR8 CONST* loaderOptions); 16 | 17 | // 18 | // send packet 19 | // 20 | VOID BdUsbSendPacket(UINT32 packetType, STRING* messageHeader, STRING* messageData); 21 | 22 | // 23 | // receive packet 24 | // 25 | UINT32 BdUsbReceivePacket(UINT32 packetType, STRING* messageHeader, STRING* messageData, UINT32* dataLength); 26 | 27 | // 28 | // close debug device 29 | // 30 | EFI_STATUS BdUsbCloseDebuggerDevice(); 31 | -------------------------------------------------------------------------------- /src/boot/DevicePath.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 8:11:2009 6:38 3 | // filename: DevicePath.h 4 | // author: tiamo 5 | // purpose: device path 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // get device path size 12 | // 13 | UINTN DevPathGetSize(EFI_DEVICE_PATH_PROTOCOL* devicePath); 14 | 15 | // 16 | // get node count 17 | // 18 | UINTN DevPathGetNodeCount(EFI_DEVICE_PATH_PROTOCOL* devicePath); 19 | 20 | // 21 | // get node 22 | // 23 | EFI_DEVICE_PATH_PROTOCOL* DevPathGetNode(EFI_DEVICE_PATH_PROTOCOL* devicePath, UINT8 type, UINT8 subType); 24 | 25 | // 26 | // copy device path 27 | // 28 | EFI_DEVICE_PATH_PROTOCOL* DevPathDuplicate(EFI_DEVICE_PATH_PROTOCOL* devicePath); 29 | 30 | // 31 | // append device path 32 | // 33 | EFI_DEVICE_PATH_PROTOCOL* DevPathAppendDevicePath(EFI_DEVICE_PATH_PROTOCOL* devicePath, EFI_DEVICE_PATH_PROTOCOL* appendPath); 34 | 35 | // 36 | // append file path 37 | // 38 | EFI_DEVICE_PATH_PROTOCOL* DevPathAppendFilePath(EFI_DEVICE_PATH_PROTOCOL* devicePath, CHAR16 CONST* fileName); 39 | 40 | // 41 | // append file path 42 | // 43 | EFI_DEVICE_PATH_PROTOCOL* DevPathAppendLastComponent(EFI_DEVICE_PATH_PROTOCOL* devicePath, CHAR8 CONST* fileName, BOOLEAN replaceLastComponent); 44 | 45 | // 46 | // extract file path name 47 | // 48 | CHAR8* DevPathExtractFilePathName(EFI_DEVICE_PATH_PROTOCOL* devicePath, BOOLEAN fullPath); 49 | 50 | // 51 | // check net 52 | // 53 | BOOLEAN DevPathHasMacAddressNode(EFI_DEVICE_PATH_PROTOCOL* devicePath); 54 | 55 | // 56 | // get device path protocol 57 | // 58 | EFI_DEVICE_PATH_PROTOCOL* DevPathGetDevicePathProtocol(EFI_HANDLE theHandle); 59 | 60 | // 61 | // get partition number 62 | // 63 | UINT32 DevPathGetPartitionNumber(EFI_DEVICE_PATH_PROTOCOL* devicePath); 64 | 65 | // 66 | // get partition handle by number 67 | // 68 | EFI_HANDLE DevPathGetPartitionHandleByNumber(EFI_DEVICE_PATH_PROTOCOL* referencePath, UINT32 number); -------------------------------------------------------------------------------- /src/boot/DeviceTree.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 4:11:2009 10:44 3 | // filename: DeviceTree.h 4 | // author: tiamo 5 | // purpose: device tree 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // device tree property 12 | // 13 | typedef struct _DEVICE_TREE_PROPERTY 14 | { 15 | // 16 | // name 17 | // 18 | CHAR8 Name[32]; 19 | 20 | // 21 | // value length 22 | // 23 | UINT32 Length; 24 | 25 | // 26 | // value buffer 27 | // 28 | VOID* Value; 29 | 30 | // 31 | // free value buffer 32 | // 33 | BOOLEAN ValueBufferAllocated; 34 | 35 | // 36 | // next property 37 | // 38 | struct _DEVICE_TREE_PROPERTY* Next; 39 | }DEVICE_TREE_PROPERTY; 40 | 41 | // 42 | // device tree node 43 | // 44 | typedef struct _DEVICE_TREE_NODE 45 | { 46 | // 47 | // properties 48 | // 49 | DEVICE_TREE_PROPERTY* Properties; 50 | 51 | // 52 | // last property 53 | // 54 | DEVICE_TREE_PROPERTY* LastProperty; 55 | 56 | // 57 | // children node 58 | // 59 | struct _DEVICE_TREE_NODE* Children; 60 | 61 | // 62 | // next node 63 | // 64 | struct _DEVICE_TREE_NODE* Next; 65 | }DEVICE_TREE_NODE; 66 | 67 | // 68 | // initialize 69 | // 70 | EFI_STATUS DevTreeInitialize(); 71 | 72 | // 73 | // get name 74 | // 75 | CHAR8 CONST* DevTreeGetName(DEVICE_TREE_NODE* theNode); 76 | 77 | // 78 | // get property 79 | // 80 | VOID CONST* DevTreeGetProperty(DEVICE_TREE_NODE* theNode, CHAR8 CONST* propertyName, UINT32* propertyLength); 81 | 82 | // 83 | // find node by name 84 | // 85 | DEVICE_TREE_NODE* DevTreeFindNode(CHAR8 CONST* nodePath, BOOLEAN createIfMissing); 86 | 87 | // 88 | // add child 89 | // 90 | DEVICE_TREE_NODE* DevTreeAddChild(DEVICE_TREE_NODE* parentNode, CHAR8 CONST* childName); 91 | 92 | // 93 | // add property 94 | // 95 | EFI_STATUS DevTreeAddProperty(DEVICE_TREE_NODE* theNode, CHAR8 CONST* propertyName, VOID CONST* propertyValue, UINT32 valueLength, BOOLEAN allocAndCopy); 96 | 97 | // 98 | // free device tree 99 | // 100 | VOID DevTreeFinalize(); 101 | 102 | // 103 | // flatten 104 | // 105 | EFI_STATUS DevTreeFlatten(VOID** flattenBuffer, UINT32* bufferLength); -------------------------------------------------------------------------------- /src/boot/FileIo.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 11:11:2009 23:25 3 | // filename: FileIo.h 4 | // author: tiamo 5 | // purpose: file io 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // open mode 12 | // 13 | #define IO_OPEN_MODE_NORMAL 0 14 | #define IO_OPEN_MODE_KERNEL 1 15 | #define IO_OPEN_MODE_RAMDISK 2 16 | 17 | // 18 | // opened file handle 19 | // 20 | typedef struct _IO_FILE_HANDLE 21 | { 22 | // 23 | // efi file 24 | // 25 | EFI_FILE_HANDLE EfiFileHandle; 26 | 27 | // 28 | // load file protocol 29 | // 30 | EFI_LOAD_FILE_PROTOCOL* EfiLoadFileProtocol; 31 | 32 | // 33 | // file path 34 | // 35 | EFI_DEVICE_PATH_PROTOCOL* EfiFilePath; 36 | 37 | // 38 | // cache buffer 39 | // 40 | UINT8* FileBuffer; 41 | 42 | // 43 | // offset 44 | // 45 | UINTN FileOffset; 46 | 47 | // 48 | // size 49 | // 50 | UINTN FileSize; 51 | }IO_FILE_HANDLE; 52 | 53 | // 54 | // detect root 55 | // 56 | EFI_STATUS IoDetectRoot(EFI_HANDLE* deviceHandle, EFI_DEVICE_PATH_PROTOCOL** bootFilePath, BOOLEAN detectBoot); 57 | 58 | // 59 | // booting from net 60 | // 61 | BOOLEAN IoBootingFromNet(); 62 | 63 | // 64 | // open file 65 | // 66 | EFI_STATUS IoOpenFile(CHAR8 CONST* filePathName, EFI_DEVICE_PATH_PROTOCOL* filePath, IO_FILE_HANDLE* fileHandle, UINTN openMode); 67 | 68 | // 69 | // set position 70 | // 71 | EFI_STATUS IoSetFilePosition(IO_FILE_HANDLE* fileHandle, UINT64 filePosition); 72 | 73 | // 74 | // get file size 75 | // 76 | EFI_STATUS IoGetFileSize(IO_FILE_HANDLE* fileHandle, UINT64* fileSize); 77 | 78 | // 79 | // get file info 80 | // 81 | EFI_STATUS IoGetFileInfo(IO_FILE_HANDLE* fileHandle, EFI_FILE_INFO** fileInfo); 82 | 83 | // 84 | // read file 85 | // 86 | EFI_STATUS IoReadFile(IO_FILE_HANDLE* fileHandle, VOID* readBuffer, UINTN bufferSize, UINTN* readLength, BOOLEAN directoryFile); 87 | 88 | // 89 | // close file 90 | // 91 | VOID IoCloseFile(IO_FILE_HANDLE* fileHandle); 92 | 93 | // 94 | // read whole file 95 | // 96 | EFI_STATUS IoReadWholeFile(EFI_DEVICE_PATH_PROTOCOL* bootFilePath, CHAR8 CONST* fileName, CHAR8** fileBuffer, UINTN* fileSize, BOOLEAN asTextFile); 97 | 98 | // 99 | // load booter 100 | // 101 | EFI_STATUS IoLoadBooterWithRootUUID(EFI_DEVICE_PATH_PROTOCOL* bootFilePath, CHAR8 CONST* rootUUID, EFI_HANDLE* imageHandle); -------------------------------------------------------------------------------- /src/boot/FileVault.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 19:9:2012 18:18 3 | // filename: FileVault.h 4 | // author: tiamo 5 | // purpose: FileVault2 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // load and unlock core volume 12 | // 13 | EFI_STATUS FvLookupUnlockCoreVolumeKey(EFI_DEVICE_PATH_PROTOCOL* bootDevicePath, BOOLEAN resumeFromCoreStorage); 14 | 15 | // 16 | // find volume key 17 | // 18 | BOOLEAN FvFindCoreVolumeKey(UINT8 CONST* volumeIdent, UINT8* volumeKey, UINTN volumeKeyLength); 19 | 20 | // 21 | // setup device tree 22 | // 23 | EFI_STATUS FvSetupDeviceTree(UINT64* keyStorePhysicalAddress, UINTN* keyStoreSize, BOOLEAN setupDeviceTree); 24 | -------------------------------------------------------------------------------- /src/boot/GuidDefine.cpp: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 4:8:2012 13:41 3 | // filename: GuidDefine.cpp 4 | // author: tiamo 5 | // purpose: guid define 6 | //******************************************************************** 7 | 8 | #include "StdAfx.h" 9 | #include "GuidDefine.h" 10 | 11 | EFI_GUID EfiDataHubProtocolGuid = EFI_DATA_HUB_PROTOCOL_GUID; 12 | EFI_GUID EfiAcpi20TableGuid = EFI_ACPI_20_TABLE_GUID; 13 | EFI_GUID EfiAcpiTableGuid = EFI_ACPI_TABLE_GUID; 14 | EFI_GUID EfiLoadedImageProtocolGuid = EFI_LOADED_IMAGE_PROTOCOL_GUID; 15 | EFI_GUID EfiPciIoProtocolGuid = EFI_PCI_IO_PROTOCOL_GUID; 16 | EFI_GUID EfiSmbiosTableGuid = EFI_SMBIOS_TABLE_GUID; 17 | EFI_GUID EfiConsoleControlProtocolGuid = EFI_CONSOLE_CONTROL_PROTOCOL_GUID; 18 | EFI_GUID EfiSimpleFileSystemProtocolGuid = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID; 19 | EFI_GUID EfiDevicePathProtocolGuid = EFI_DEVICE_PATH_PROTOCOL_GUID; 20 | EFI_GUID EfiBlockIoProtocolGuid = EFI_BLOCK_IO_PROTOCOL_GUID; 21 | EFI_GUID EfiDiskIoProtocolGuid = EFI_DISK_IO_PROTOCOL_GUID; 22 | EFI_GUID EfiGraphicsOutputProtocolGuid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; 23 | EFI_GUID EfiUgaDrawProtocolGuid = EFI_UGA_DRAW_PROTOCOL_GUID; 24 | EFI_GUID EfiFileInfoGuid = EFI_FILE_INFO_ID; 25 | EFI_GUID EfiLoadFileProtocolGuid = LOAD_FILE_PROTOCOL_GUID; 26 | EFI_GUID EfiFirmwareVolumeProtocolGuid = EFI_FIRMWARE_VOLUME_PROTOCOL_GUID; 27 | EFI_GUID EfiFirmwareVolumeDispatchProtocolGuid = EFI_FIRMWARE_VOLUME_DISPATCH_PROTOCOL_GUID; 28 | EFI_GUID EfiDevicePathMessagingSASGuid = DEVICE_PATH_MESSAGING_SAS; 29 | EFI_GUID EfiSimplePointerProtocolGuid = EFI_SIMPLE_POINTER_PROTOCOL_GUID; 30 | EFI_GUID AppleKeyStateProtocolGuid = APPLE_KEY_STATE_PROTOCOL_GUID; 31 | EFI_GUID AppleNVRAMVariableGuid = APPLE_NVRAM_VARIABLE_GUID; 32 | EFI_GUID AppleFirmwareVariableGuid = APPLE_FIRMWARE_VARIABLE_GUID; 33 | EFI_GUID AppleAcpiVariableGuid = APPLE_ACPI_VARIABLE_GUID; 34 | EFI_GUID AppleSystemInfoProducerNameGuid = APPLE_SYSTEM_INFO_PRODUCER_NAME_GUID; 35 | EFI_GUID AppleDevicePropertyProtocolGuid = APPLE_DEVICE_PROPERTY_PROTOCOL_GUID; 36 | EFI_GUID AppleNetBootProtocolGuid = APPLE_NET_BOOT_PROTOCOL_GUID; 37 | EFI_GUID ApplePasswordUIEfiFileNameGuid = APPLE_PASSWORD_UI_EFI_FILE_NAME_GUID; 38 | EFI_GUID AppleFirmwarePasswordProtocolGuid = APPLE_FIRMWARE_PASSWORD_PROTOCOL_GUID; 39 | EFI_GUID AppleDeviceControlProtocolGuid = APPLE_DEVICE_CONTROL_PROTOCOL_GUID; 40 | EFI_GUID AppleGraphConfigProtocolGuid = APPLE_GRAPH_CONFIG_PROTOCOL_GUID; 41 | EFI_GUID AppleGraphInfoProtocolGuid = APPLE_GRAPH_INFO_PROTOCOL_GUID; 42 | EFI_GUID AppleRamDmgDevicePathGuid = APPLE_RAM_DMG_DEVICE_PATH_GUID; 43 | EFI_GUID AppleImageCodecProtocolGuid = APPLE_IMAGE_CODEC_PROTOCOL_GUID; 44 | EFI_GUID AppleDiskIoProtocolGuid = APPLE_DISK_IO_PROTOCOL_GUID; 45 | EFI_GUID AppleSMCProtocolGuid = APPLE_SMC_PROTOCOL_GUID; 46 | EFI_GUID AppleFileVaultVariableGuid = APPLE_FILE_VAULT_VARIABLE_GUID; 47 | 48 | EFI_SYSTEM_TABLE* EfiSystemTable = nullptr; 49 | EFI_BOOT_SERVICES* EfiBootServices = nullptr; 50 | EFI_RUNTIME_SERVICES* EfiRuntimeServices = nullptr; 51 | EFI_HANDLE EfiImageHandle = nullptr; -------------------------------------------------------------------------------- /src/boot/GuidDefine.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 4:8:2012 13:39 3 | // filename: GuidDefine.h 4 | // author: tiamo 5 | // purpose: guid define 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | #include EFI_GUID_DEFINITION(Acpi) 11 | #include EFI_GUID_DEFINITION(SmBios) 12 | #include EFI_GUID_DEFINITION(AppleNVRAMVariable) 13 | #include EFI_GUID_DEFINITION(AppleFirmwareVariable) 14 | #include EFI_GUID_DEFINITION(AppleAcpiVariable) 15 | #include EFI_GUID_DEFINITION(AppleFirmwareFileName) 16 | #include EFI_GUID_DEFINITION(AppleRamDmgDevicePath) 17 | #include EFI_GUID_DEFINITION(AppleFileVaultVariable) 18 | 19 | #include EFI_PROTOCOL_DEFINITION(LoadedImage) 20 | #include EFI_PROTOCOL_DEFINITION(PciIo) 21 | #include EFI_PROTOCOL_DEFINITION(DataHub) 22 | #include EFI_PROTOCOL_DEFINITION(DevicePath) 23 | #include EFI_PROTOCOL_DEFINITION(ConsoleControl) 24 | #include EFI_PROTOCOL_DEFINITION(SimpleTextOut) 25 | #include EFI_PROTOCOL_DEFINITION(SimpleFileSystem) 26 | #include EFI_PROTOCOL_DEFINITION(FileInfo) 27 | #include EFI_PROTOCOL_DEFINITION(LoadFile) 28 | #include EFI_PROTOCOL_DEFINITION(BlockIo) 29 | #include EFI_PROTOCOL_DEFINITION(DiskIo) 30 | #include EFI_PROTOCOL_DEFINITION(GraphicsOutput) 31 | #include EFI_PROTOCOL_DEFINITION(UgaDraw) 32 | #include EFI_PROTOCOL_DEFINITION(FirmwareVolume) 33 | #include EFI_PROTOCOL_DEFINITION(FirmwareVolumeDispatch) 34 | #include EFI_PROTOCOL_DEFINITION(SimplePointer) 35 | #include EFI_PROTOCOL_DEFINITION(AppleKeyState) 36 | #include EFI_PROTOCOL_DEFINITION(AppleSystemInfo) 37 | #include EFI_PROTOCOL_DEFINITION(AppleDeviceProperty) 38 | #include EFI_PROTOCOL_DEFINITION(AppleNetBoot) 39 | #include EFI_PROTOCOL_DEFINITION(AppleFirmwarePassword) 40 | #include EFI_PROTOCOL_DEFINITION(AppleDeviceControl) 41 | #include EFI_PROTOCOL_DEFINITION(AppleGraphConfig) 42 | #include EFI_PROTOCOL_DEFINITION(AppleGraphInfo) 43 | #include EFI_PROTOCOL_DEFINITION(AppleImageCodec) 44 | #include EFI_PROTOCOL_DEFINITION(AppleDiskIo) 45 | #include EFI_PROTOCOL_DEFINITION(AppleSMC) 46 | 47 | extern EFI_SYSTEM_TABLE* EfiSystemTable; 48 | extern EFI_BOOT_SERVICES* EfiBootServices; 49 | extern EFI_RUNTIME_SERVICES* EfiRuntimeServices; 50 | extern EFI_HANDLE EfiImageHandle; 51 | 52 | extern EFI_GUID EfiDataHubProtocolGuid; 53 | extern EFI_GUID EfiAcpi20TableGuid; 54 | extern EFI_GUID EfiAcpiTableGuid; 55 | extern EFI_GUID EfiLoadedImageProtocolGuid; 56 | extern EFI_GUID EfiPciIoProtocolGuid; 57 | extern EFI_GUID EfiSmbiosTableGuid; 58 | extern EFI_GUID EfiConsoleControlProtocolGuid; 59 | extern EFI_GUID EfiSimpleFileSystemProtocolGuid; 60 | extern EFI_GUID EfiDevicePathProtocolGuid; 61 | extern EFI_GUID EfiBlockIoProtocolGuid; 62 | extern EFI_GUID EfiDiskIoProtocolGuid; 63 | extern EFI_GUID EfiGraphicsOutputProtocolGuid; 64 | extern EFI_GUID EfiUgaDrawProtocolGuid; 65 | extern EFI_GUID EfiFileInfoGuid; 66 | extern EFI_GUID EfiLoadFileProtocolGuid; 67 | extern EFI_GUID EfiFirmwareVolumeProtocolGuid; 68 | extern EFI_GUID EfiFirmwareVolumeDispatchProtocolGuid; 69 | extern EFI_GUID EfiDevicePathMessagingSASGuid; 70 | extern EFI_GUID EfiSimplePointerProtocolGuid; 71 | extern EFI_GUID AppleKeyStateProtocolGuid; 72 | extern EFI_GUID AppleNVRAMVariableGuid; 73 | extern EFI_GUID AppleFirmwareVariableGuid; 74 | extern EFI_GUID AppleAcpiVariableGuid; 75 | extern EFI_GUID AppleSystemInfoProducerNameGuid; 76 | extern EFI_GUID AppleDevicePropertyProtocolGuid; 77 | extern EFI_GUID AppleNetBootProtocolGuid; 78 | extern EFI_GUID ApplePasswordUIEfiFileNameGuid; 79 | extern EFI_GUID AppleFirmwarePasswordProtocolGuid; 80 | extern EFI_GUID AppleDeviceControlProtocolGuid; 81 | extern EFI_GUID AppleGraphConfigProtocolGuid; 82 | extern EFI_GUID AppleGraphInfoProtocolGuid; 83 | extern EFI_GUID AppleRamDmgDevicePathGuid; 84 | extern EFI_GUID AppleImageCodecProtocolGuid; 85 | extern EFI_GUID AppleDiskIoProtocolGuid; 86 | extern EFI_GUID AppleSMCProtocolGuid; 87 | extern EFI_GUID AppleFileVaultVariableGuid; -------------------------------------------------------------------------------- /src/boot/Hibernate.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 14:9:2012 20:29 3 | // filename: Hibernate.h 4 | // author: tiamo 5 | // purpose: hibernate 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | #define HIBERNATE_PROGRESS_COUNT 19 11 | #define HIBERNATE_PROGRESS_SAVE_UNDER_SIZE 38 12 | #define HIBERNATE_PROGRESS_WIDTH 7 13 | #define HIBERNATE_PROGRESS_HEIGHT 16 14 | #define HIBERNATE_PROGRESS_SPACING 3 15 | #define HIBERNATE_PROGRESS_ORIGINY 81 16 | #define HIBERNATE_PROGRESS_DARK_GRAY 92 17 | #define HIBERNATE_PROGRESS_MID_GRAY 174 18 | #define HIBERNATE_PROGRESS_LIGHT_GRAY 230 19 | 20 | // 21 | // preview 22 | // 23 | typedef struct _HIBERNATE_PREVIEW 24 | { 25 | // 26 | // image count 27 | // 28 | UINT32 ImageCount; 29 | 30 | // 31 | // width 32 | // 33 | UINT32 Width; 34 | 35 | // 36 | // height 37 | // 38 | UINT32 Height; 39 | 40 | // 41 | // depth 42 | // 43 | UINT32 Depth; 44 | 45 | // 46 | // lock time 47 | // 48 | UINT32 LockTime; 49 | 50 | // 51 | // reserved 52 | // 53 | UINT32 ReservedG[8]; 54 | 55 | // 56 | // reserved 57 | // 58 | UINT32 ReservedK[8]; 59 | }HIBERNATE_PREVIEW; 60 | 61 | // 62 | // start resume from hiberate 63 | // 64 | BOOLEAN HbStartResumeFromHibernate(UINT8* coreStorageVolumeKeyIdent); 65 | 66 | // 67 | // continue resume 68 | // 69 | VOID HbContinueResumeFromHibernate(UINT8* coreStorageVolumeKey, UINTN coreStorageVolumeKeyLength); 70 | -------------------------------------------------------------------------------- /src/boot/LoadDrivers.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 11:11:2009 21:31 3 | // filename: LoadDrivers.h 4 | // author: tiamo 5 | // purpose: load drivers 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // load drivers 12 | // 13 | EFI_STATUS LdrLoadDrivers(); 14 | -------------------------------------------------------------------------------- /src/boot/LoadKernel.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 12:11:2009 1:48 3 | // filename: LoadKernel.h 4 | // author: tiamo 5 | // purpose: load kernel 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | #define CPU_ARCH_NONE 0x00000000 11 | #define CPU_ARCH_X86 0x00000007 12 | #define CPU_ARCH_X64 0x01000007 13 | 14 | // 15 | // load kernel cache 16 | // 17 | EFI_STATUS LdrLoadKernelCache(struct _MACH_O_LOADED_INFO* loadedInfo, EFI_DEVICE_PATH_PROTOCOL* bootDevicePath); 18 | 19 | // 20 | // load kernel 21 | // 22 | EFI_STATUS LdrLoadKernel(struct _MACH_O_LOADED_INFO* loadedInfo); 23 | 24 | // 25 | // load ramdisk 26 | // 27 | EFI_STATUS LdrLoadRamDisk(); 28 | 29 | // 30 | // setup ASLR 31 | // 32 | VOID LdrSetupASLR(BOOLEAN enableASLR, UINT8 slideValue); 33 | 34 | // 35 | // get aslr displacement 36 | // 37 | UINT64 LdrGetASLRDisplacement(); 38 | 39 | // 40 | // get kernel path name 41 | // 42 | CHAR8 CONST* LdrGetKernelPathName(); 43 | 44 | // 45 | // get kernel cache path name 46 | // 47 | CHAR8 CONST* LdrGetKernelCachePathName(); 48 | 49 | // 50 | // get kernel cache override 51 | // 52 | BOOLEAN LdrGetKernelCacheOverride(); 53 | 54 | // 55 | // setup kernel cache path 56 | // 57 | VOID LdrSetupKernelCachePath(EFI_DEVICE_PATH_PROTOCOL* filePath, CHAR8* fileName, BOOLEAN cacheOverride); 58 | 59 | // 60 | // setup kernel path 61 | // 62 | VOID LdrSetupKernelPath(EFI_DEVICE_PATH_PROTOCOL* filePath, CHAR8* fileName); 63 | 64 | // 65 | // setup ramdisk path 66 | // 67 | VOID LdrSetupRamDiskPath(EFI_DEVICE_PATH_PROTOCOL* filePath, CHAR8* fileName); -------------------------------------------------------------------------------- /src/boot/MD5.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 8:11:2009 20:04 3 | // filename: MD5.h 4 | // author: tiamo 5 | // purpose: md5 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // context 12 | // 13 | typedef struct _MD5_CONTEXT 14 | { 15 | // 16 | // state 17 | // 18 | UINT32 State[4]; 19 | 20 | // 21 | // count 22 | // 23 | UINT32 Count[2]; 24 | 25 | // 26 | // input buffer 27 | // 28 | UINT8 InputBuffer[64]; 29 | }MD5_CONTEXT; 30 | 31 | // 32 | // init 33 | // 34 | VOID MD5Init(MD5_CONTEXT* md5Context); 35 | 36 | // 37 | // update 38 | // 39 | VOID MD5Update(MD5_CONTEXT* md5Context, VOID CONST* byteBuffer, UINT32 bufferLength); 40 | 41 | // 42 | // finish 43 | // 44 | VOID MD5Final(UINT8* md5Result, MD5_CONTEXT* md5Context); -------------------------------------------------------------------------------- /src/boot/MachO.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 12:11:2009 1:41 3 | // filename: MachO.h 4 | // author: tiamo 5 | // purpose: mach-o 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // loaded mach-o info 12 | // 13 | typedef struct _MACH_O_LOADED_INFO 14 | { 15 | // 16 | // image base physical address 17 | // 18 | UINT64 ImageBasePhysicalAddress; 19 | 20 | // 21 | // image base virtual address 22 | // 23 | UINT64 ImageBaseVirtualAddress; 24 | 25 | // 26 | // min physical address 27 | // 28 | UINT64 MinPhysicalAddress; 29 | 30 | // 31 | // max physical address 32 | // 33 | UINT64 MaxPhysicalAddress; 34 | 35 | // 36 | // entry point physical address 37 | // 38 | UINT64 EntryPointPhysicalAddress; 39 | 40 | // 41 | // min virtual address 42 | // 43 | UINT64 MinVirtualAddress; 44 | 45 | // 46 | // max virtual address 47 | // 48 | UINT64 MaxVirtualAddress; 49 | 50 | // 51 | // entry point virtual address 52 | // 53 | UINT64 EntryPointVirtualAddress; 54 | 55 | // 56 | // arch type 57 | // 58 | UINT32 ArchType; 59 | }MACH_O_LOADED_INFO; 60 | 61 | // 62 | // get thin fat info 63 | // 64 | EFI_STATUS MachLoadThinFatFile(IO_FILE_HANDLE* fileHandle, UINT64* offsetInFile, UINTN* dataSize); 65 | 66 | // 67 | // load mach-o 68 | // 69 | EFI_STATUS MachLoadMachO(IO_FILE_HANDLE* fileHandle, BOOLEAN useKernelMemory, MACH_O_LOADED_INFO* loadedInfo); 70 | 71 | // 72 | // get symbol virtual address by name 73 | // 74 | UINT64 MachFindSymbolVirtualAddressByName(MACH_O_LOADED_INFO* loadedInfo, CHAR8 CONST* symbolName); -------------------------------------------------------------------------------- /src/boot/Memory.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 4:11:2009 11:47 3 | // filename: memory.h 4 | // author: tiamo 5 | // purpose: memory 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // initialize 12 | // 13 | EFI_STATUS MmInitialize(); 14 | 15 | // 16 | // finalize 17 | // 18 | VOID MmFinalize(); 19 | 20 | // 21 | // translate address 22 | // 23 | BOOLEAN BOOTAPI MmTranslateVirtualAddress(VOID* virtualAddress, UINT64* physicalAddress); 24 | 25 | // 26 | // allocate pool 27 | // 28 | VOID* MmAllocatePool(UINTN bufferLength); 29 | 30 | // 31 | // free 32 | // 33 | VOID MmFreePool(VOID* freeBuffer); 34 | 35 | // 36 | // allocate page 37 | // 38 | VOID* MmAllocatePages(EFI_ALLOCATE_TYPE allocateType, EFI_MEMORY_TYPE memoryType, UINTN pagesCount, UINT64* physicalAddress); 39 | 40 | // 41 | // free pages 42 | // 43 | VOID MmFreePages(UINT64 phyAddress); 44 | 45 | // 46 | // allocate kernel memory 47 | // 48 | UINT64 MmAllocateKernelMemory(UINTN* bufferLength, UINT64* virtualAddress); 49 | 50 | // 51 | // free kernel memory 52 | // 53 | VOID MmFreeKernelMemory(UINT64 virtualAddress, UINT64 physicalAddress); 54 | 55 | // 56 | // allocate loader data memory 57 | // 58 | UINT64 MmAllocateLoaderData(UINTN* bufferLength, UINT64* virtualAddress); 59 | 60 | // 61 | // free loader data memory 62 | // 63 | VOID MmFreeLoaderData(UINT64 virtualAddress, UINT64 physicalAddress); 64 | 65 | // 66 | // get kernel memory range 67 | // 68 | VOID MmGetKernelPhysicalRange(UINT64* lowerAddress, UINT64* upperAddress); 69 | 70 | // 71 | // get kernel virtual start 72 | // 73 | UINT64 MmGetKernelVirtualStart(); -------------------------------------------------------------------------------- /src/boot/MemoryMap.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 9:11:2009 0:30 3 | // filename: MemoryMap.h 4 | // author: tiamo 5 | // purpose: memory map 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // get memory map 12 | // 13 | EFI_STATUS MmGetMemoryMap(UINTN* memoryMapSize, EFI_MEMORY_DESCRIPTOR** memoryMap, UINTN* memoryMapKey, UINTN* descriptorSize, UINT32* descriptorVersion); 14 | 15 | // 16 | // get runtime memory info 17 | // 18 | UINTN MmGetRuntimeMemoryInfo(EFI_MEMORY_DESCRIPTOR* memoryMap, UINTN memoryMapSize, UINTN descriptorSize, UINT64* totalPages); 19 | 20 | // 21 | // remove non runtime descriptors 22 | // 23 | EFI_STATUS MmRemoveNonRuntimeDescriptors(EFI_MEMORY_DESCRIPTOR* memoryMap, UINTN* memoryMapSize, UINTN descriptorSize); 24 | 25 | // 26 | // sort 27 | // 28 | VOID MmSortMemoryMap(EFI_MEMORY_DESCRIPTOR* memoryMap, UINTN memoryMapSize, UINTN descriptorSize); 29 | 30 | // 31 | // convert pointers 32 | // 33 | EFI_STATUS MmConvertPointers(EFI_MEMORY_DESCRIPTOR* memoryMap, UINTN* memmapSize, UINTN descSize, UINT32 descVersion, UINT64 rtPhysical, UINT64 runtimePages, UINT64 rtVirtual, UINT64* efiSysTablePhy, BOOLEAN createSubRegion, struct _MACH_O_LOADED_INFO* loadedInfo); -------------------------------------------------------------------------------- /src/boot/MiscUtils.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 7:11:2009 1:36 3 | // filename: MiscUtils.h 4 | // author: tiamo 5 | // purpose: utils 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // get memory capacity 12 | // 13 | UINT64 BlGetMemoryCapacity(); 14 | 15 | // 16 | // get memory size 17 | // 18 | UINT64 BlGetMemorySize(); 19 | 20 | // 21 | // get board id 22 | // 23 | CHAR8* BlGetBoardId(); 24 | 25 | // 26 | // connect drivers 27 | // 28 | EFI_STATUS BlConnectAllController(); 29 | 30 | // 31 | // get base and size 32 | // 33 | EFI_STATUS BlGetApplicationBaseAndSize(UINT64* imageBase, UINT64* imageSize); 34 | 35 | // 36 | // parse device location 37 | // 38 | VOID BlParseDeviceLocation(CHAR8 CONST* loaderOptions, UINTN* segment, UINTN* bus, UINTN* device, UINTN* func); 39 | 40 | // 41 | // pci get bar attribute 42 | // 43 | EFI_STATUS BlGetPciBarAttribute(EFI_PCI_IO_PROTOCOL* pciIoProtocol, UINT8 barIndex, UINT64* baseAddress, UINT64* barLength, BOOLEAN* isMemorySpace); 44 | 45 | // 46 | // find pci device 47 | // 48 | EFI_STATUS BlFindPciDevice(UINTN segment, UINTN bus, UINTN device, UINTN func, UINT8 baseClass, UINT8 subClass, UINT8 progIf, EFI_PCI_IO_PROTOCOL** outPciIoProtocol, EFI_HANDLE* outHandle); 49 | 50 | // 51 | // start pci device 52 | // 53 | EFI_STATUS BlStartPciDevice(EFI_PCI_IO_PROTOCOL* pciIoProtocol, BOOLEAN decodeIo, BOOLEAN decodeMemory, BOOLEAN busMaster); 54 | 55 | // 56 | // detect memory size 57 | // 58 | EFI_STATUS BlDetectMemorySize(); 59 | 60 | // 61 | // unicode to utf8 62 | // 63 | EFI_STATUS BlUnicodeToUtf8(CHAR16 CONST* unicodeBuffer, UINTN unicodeCharCount, CHAR8* utf8Buffer, UINTN utf8BufferLength); 64 | 65 | // 66 | // unicode to ansi 67 | // 68 | EFI_STATUS BlUnicodeToAnsi(CHAR16 CONST* unicodeBuffer, UINTN unicodeCharCount, CHAR8* ansiBuffer, UINTN ansiBufferLength); 69 | 70 | // 71 | // utf8 to unicode 72 | // 73 | EFI_STATUS BlUtf8ToUnicode(CHAR8 CONST* utf8Buffer, UINTN bytesCount, CHAR16* unicodeBuffer, UINTN unicodeBufferLengthInChar); 74 | 75 | // 76 | // build utf8 string from unicode 77 | // 78 | CHAR8* BlAllocateUtf8FromUnicode(CHAR16 CONST* unicodeString, UINTN unicodeCharCount); 79 | 80 | // 81 | // build unicode string from utf8 82 | // 83 | CHAR16* BlAllocateUnicodeFromUtf8(CHAR8 CONST* utf8String, UINTN utf8Length); 84 | 85 | // 86 | // allocate string 87 | // 88 | CHAR8* BlAllocateString(CHAR8 CONST* inputString); 89 | 90 | // 91 | // convert path sep 92 | // 93 | VOID BlConvertPathSeparator(CHAR8* pathName, CHAR8 fromChar, CHAR8 toChar); 94 | 95 | // 96 | // uuid to buffer 97 | // 98 | BOOLEAN BlUUIDStringToBuffer(CHAR8 CONST* uuidString, UINT8* uuidBuffer); 99 | 100 | // 101 | // compare time 102 | // 103 | INTN BlCompareTime(EFI_TIME* time1, EFI_TIME* time2); 104 | 105 | // 106 | // add one second 107 | // 108 | VOID BlAddOneSecond(EFI_TIME* theTime); 109 | 110 | // 111 | // efi time to unix time 112 | // 113 | UINT32 BlEfiTimeToUnixTime(EFI_TIME CONST* efiTime); 114 | 115 | // 116 | // get current unix time 117 | // 118 | UINT32 BlGetCurrentUnixTime(); 119 | 120 | // 121 | // alder32 122 | // 123 | UINT32 BlAlder32(VOID CONST* inputBuffer, UINTN bufferLength); 124 | 125 | // 126 | // uncompress 127 | // 128 | EFI_STATUS BlDecompress(VOID CONST* compressedBuffer, UINTN compressedSize, VOID* uncompressedBuffer, UINTN uncompressedBufferSize, UINTN* uncompressedSize); -------------------------------------------------------------------------------- /src/boot/NetBoot.cpp: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 8:11:2009 19:39 3 | // filename: NetBoot.cpp 4 | // author: tiamo 5 | // purpose: net boot 6 | //******************************************************************** 7 | 8 | #include "stdafx.h" 9 | 10 | // 11 | // get root match dict 12 | // 13 | CHAR8 CONST* NetGetRootMatchDict(EFI_DEVICE_PATH_PROTOCOL* bootDevicePath) 14 | { 15 | STATIC CHAR8 CONST part1Text[0xac] = "IOProviderClassIONetworkInterfaceIOParentMatch" 16 | "IOPropertyMatchIOMACAddress"; 17 | STATIC CHAR8 CONST part2Text[0x1d] = ""; 18 | MAC_ADDR_DEVICE_PATH* macAddrDevicePath = _CR(DevPathGetNode(bootDevicePath, MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP), MAC_ADDR_DEVICE_PATH, Header); 19 | if(!macAddrDevicePath) 20 | return nullptr; 21 | 22 | UINTN macAddressLength = macAddrDevicePath->IfType < 2 ? 6 : sizeof(macAddrDevicePath->MacAddress); 23 | UINTN bufferLength = (ARRAYSIZE(part1Text) + macAddressLength * 2 + ARRAYSIZE(part2Text)) * sizeof(CHAR8); 24 | CHAR8* dictBuffer = static_cast(MmAllocatePool(bufferLength)); 25 | if(!dictBuffer) 26 | return nullptr; 27 | 28 | strcpy(dictBuffer, part1Text); 29 | CHAR8* writeBuffer = dictBuffer + ARRAYSIZE(part1Text) - 1; 30 | for(UINTN i = 0; i < macAddressLength; i ++, writeBuffer += 2) 31 | snprintf(writeBuffer, bufferLength / sizeof(CHAR8), CHAR8_CONST_STRING("%02x"), macAddrDevicePath->MacAddress.Addr[i]); 32 | 33 | strcpy(writeBuffer, part2Text); 34 | return dictBuffer; 35 | } 36 | 37 | // 38 | // insert info into device 39 | // 40 | EFI_STATUS NetSetupDeviceTree(EFI_HANDLE bootDeviceHandle) 41 | { 42 | VOID* dhcpResponse = 0; 43 | VOID* bsdpResponse = 0; 44 | EFI_STATUS status = EFI_SUCCESS; 45 | 46 | __try 47 | { 48 | // 49 | // get protocol from device handle 50 | // 51 | APPLE_NET_BOOT_PROTOCOL* netBootProtocol = nullptr; 52 | if(EFI_ERROR(EfiBootServices->HandleProtocol(bootDeviceHandle, &AppleNetBootProtocolGuid, reinterpret_cast(&netBootProtocol)))) 53 | { 54 | if(EFI_ERROR(EfiBootServices->LocateProtocol(&AppleNetBootProtocolGuid, nullptr, reinterpret_cast(&netBootProtocol)))) 55 | try_leave(NOTHING); 56 | } 57 | 58 | // 59 | // get chosen node 60 | // 61 | DEVICE_TREE_NODE* theNode = DevTreeFindNode(CHAR8_CONST_STRING("/chosen"), TRUE); 62 | if(!theNode) 63 | try_leave(status = EFI_OUT_OF_RESOURCES); 64 | 65 | // 66 | // get length 67 | // 68 | UINTN bufferSize = 0; 69 | if(netBootProtocol->GetDhcpResponse(netBootProtocol, &bufferSize, nullptr) != EFI_BUFFER_TOO_SMALL) 70 | try_leave(NOTHING); 71 | 72 | // 73 | // allocate buffer 74 | // 75 | dhcpResponse = MmAllocatePool(bufferSize); 76 | if(!dhcpResponse) 77 | try_leave(NOTHING); 78 | 79 | // 80 | // get and add it 81 | // 82 | if(!EFI_ERROR(netBootProtocol->GetDhcpResponse(netBootProtocol, &bufferSize, dhcpResponse))) 83 | DevTreeAddProperty(theNode, CHAR8_CONST_STRING("dhcp-response"), dhcpResponse, static_cast(bufferSize), TRUE); 84 | 85 | // 86 | // get length 87 | // 88 | bufferSize = 0; 89 | if(netBootProtocol->GetBsdpResponse(netBootProtocol, &bufferSize, nullptr) != EFI_BUFFER_TOO_SMALL) 90 | try_leave(NOTHING); 91 | 92 | // 93 | // allocate buffer 94 | // 95 | bsdpResponse = MmAllocatePool(bufferSize); 96 | if(!bsdpResponse) 97 | try_leave(NOTHING); 98 | 99 | // 100 | // get and add it 101 | // 102 | if(!EFI_ERROR(netBootProtocol->GetBsdpResponse(netBootProtocol, &bufferSize, bsdpResponse))) 103 | DevTreeAddProperty(theNode, CHAR8_CONST_STRING("bsdp-response"), bsdpResponse, static_cast(bufferSize), TRUE); 104 | } 105 | __finally 106 | { 107 | if(dhcpResponse) 108 | MmFreePool(dhcpResponse); 109 | 110 | if(bsdpResponse) 111 | MmFreePool(bsdpResponse); 112 | } 113 | 114 | return status; 115 | } -------------------------------------------------------------------------------- /src/boot/NetBoot.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 8:11:2009 19:41 3 | // filename: NetBoot.h 4 | // author: tiamo 5 | // purpose: net boot 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // get root match 12 | // 13 | CHAR8 CONST* NetGetRootMatchDict(EFI_DEVICE_PATH_PROTOCOL* bootDevicePath); 14 | 15 | // 16 | // insert info into device 17 | // 18 | EFI_STATUS NetSetupDeviceTree(EFI_HANDLE bootDeviceHandle); -------------------------------------------------------------------------------- /src/boot/Options.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 8:11:2009 18:33 3 | // filename: Options.h 4 | // author: tiamo 5 | // purpose: option 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | #define BOOT_MODE_NORMAL 0x000000 11 | #define BOOT_MODE_SAFE 0x000001 12 | #define BOOT_MODE_VERBOSE 0x000002 13 | #define BOOT_MODE_NET 0x000004 14 | #define BOOT_MODE_ALT_KERNEL 0x000008 15 | #define BOOT_MODE_SINGLE_USER 0x000010 16 | #define BOOT_MODE_GRAPH 0x000020 17 | #define BOOT_MODE_FIRMWARE_PASSWORD 0x000040 18 | #define BOOT_MODE_DEBUG 0x000080 19 | 20 | #define BOOT_MODE_BOOT_IS_NOT_ROOT 0x000100 21 | #define BOOT_MODE_HAS_FILE_VAULT2_CONFIG 0x000200 22 | #define BOOT_MODE_X 0x000400 23 | #define BOOT_MODE_EFI_NVRAM_RECOVERY_BOOT_MODE 0x000800 24 | #define BOOT_MODE_FROM_RECOVER_BOOT_DIRECTORY 0x001000 25 | #define BOOT_MODE_HIBER_FROM_FV 0x002000 26 | #define BOOT_MODE_ASLR 0x004000 27 | #define BOOT_MODE_SKIP_BOARD_ID_CHECK 0x008000 28 | #define BOOT_MODE_SKIP_PANIC_DIALOG 0x010000 29 | 30 | // 31 | // detect hot key 32 | // 33 | EFI_STATUS BlDetectHotKey(); 34 | 35 | // 36 | // process option 37 | // 38 | EFI_STATUS BlProcessOptions(CHAR8 CONST* bootCommandLine, CHAR8** kernelCommandLine, EFI_DEVICE_PATH_PROTOCOL* bootDevicePath, EFI_DEVICE_PATH_PROTOCOL* bootFilePath); 39 | 40 | // 41 | // test boot mode 42 | // 43 | UINT32 BlTestBootMode(UINT32 bootMode); 44 | 45 | // 46 | // set boot mode 47 | // 48 | VOID BlSetBootMode(UINT32 setValue, UINT32 clearValue); 49 | 50 | // 51 | // setup kernel command line 52 | // 53 | CHAR8* BlSetupKernelCommandLine(CHAR8 CONST* bootOptions, CHAR8 CONST* bootArgsVariable, CHAR8 CONST* kernelFlags); -------------------------------------------------------------------------------- /src/boot/PanicDialog.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 12:9:2012 23:09 3 | // filename: PanicDialog.h 4 | // author: tiamo 5 | // purpose: panic dialog 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // show panic dialog 12 | // 13 | VOID BlShowPanicDialog(CHAR8** kernelCommandLine); 14 | -------------------------------------------------------------------------------- /src/boot/PeImage.cpp: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 6:11:2009 23:35 3 | // filename: PeImage.cpp 4 | // author: tiamo 5 | // purpose: pe image 6 | //******************************************************************** 7 | 8 | #include "stdafx.h" 9 | 10 | // 11 | // get image nt header 12 | // 13 | EFI_IMAGE_NT_HEADERS* PeImageNtHeader(VOID* imageBase) 14 | { 15 | EFI_IMAGE_DOS_HEADER* dosHeader = static_cast(imageBase); 16 | if(!dosHeader || dosHeader->e_magic != EFI_IMAGE_DOS_SIGNATURE) 17 | return nullptr; 18 | 19 | EFI_IMAGE_NT_HEADERS* ntHeader = Add2Ptr(imageBase, dosHeader->e_lfanew, EFI_IMAGE_NT_HEADERS*); 20 | return ntHeader->Signature == EFI_IMAGE_NT_SIGNATURE ? ntHeader : nullptr; 21 | } 22 | 23 | // 24 | // get image size 25 | // 26 | UINT32 PeImageGetSize(VOID* ntHeaders) 27 | { 28 | EFI_IMAGE_NT_HEADERS32* ntHeaders32 = static_cast(ntHeaders); 29 | EFI_IMAGE_NT_HEADERS64* ntHeaders64 = static_cast(ntHeaders); 30 | return ntHeaders32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC ? ntHeaders64->OptionalHeader.SizeOfImage : ntHeaders32->OptionalHeader.SizeOfImage; 31 | } 32 | 33 | // 34 | // get checksum 35 | // 36 | UINT32 PeImageGetChecksum(VOID* ntHeaders) 37 | { 38 | EFI_IMAGE_NT_HEADERS32* ntHeaders32 = static_cast(ntHeaders); 39 | EFI_IMAGE_NT_HEADERS64* ntHeaders64 = static_cast(ntHeaders); 40 | return ntHeaders32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC ? ntHeaders64->OptionalHeader.CheckSum : ntHeaders32->OptionalHeader.CheckSum; 41 | } 42 | 43 | // 44 | // get entry point 45 | // 46 | VOID* PeImageGetEntryPoint(VOID* imageBase) 47 | { 48 | EFI_IMAGE_NT_HEADERS* ntHeaders = PeImageNtHeader(imageBase); 49 | if(!ntHeaders) 50 | return nullptr; 51 | 52 | EFI_IMAGE_NT_HEADERS32* ntHeaders32 = static_cast(static_cast(ntHeaders)); 53 | EFI_IMAGE_NT_HEADERS64* ntHeaders64 = static_cast(static_cast(ntHeaders)); 54 | if(ntHeaders32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) 55 | return Add2Ptr(imageBase, ntHeaders64->OptionalHeader.AddressOfEntryPoint, VOID*); 56 | return Add2Ptr(imageBase, ntHeaders32->OptionalHeader.AddressOfEntryPoint, VOID*); 57 | } -------------------------------------------------------------------------------- /src/boot/PeImage.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 6:11:2009 23:43 3 | // filename: PeImage.h 4 | // author: tiamo 5 | // purpose: pe image 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // get image nt header 12 | // 13 | EFI_IMAGE_NT_HEADERS* PeImageNtHeader(VOID* imageBase); 14 | 15 | // 16 | // get image size 17 | // 18 | UINT32 PeImageGetSize(VOID* ntHeaders); 19 | 20 | // 21 | // get checksum 22 | // 23 | UINT32 PeImageGetChecksum(VOID* ntHeaders); 24 | 25 | // 26 | // get entry point 27 | // 28 | VOID* PeImageGetEntryPoint(VOID* imageBase); -------------------------------------------------------------------------------- /src/boot/PlatformExpert.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 7:11:2009 12:49 3 | // filename: PlatformExpert.h 4 | // author: tiamo 5 | // purpose: platform expert 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // init platform node 12 | // 13 | EFI_STATUS PeInitialize(); 14 | 15 | // 16 | // get model name 17 | // 18 | CHAR8 CONST* PeGetModelName(); 19 | 20 | // 21 | // setup device tree 22 | // 23 | EFI_STATUS PeSetupDeviceTree(); -------------------------------------------------------------------------------- /src/boot/RuntimeLib.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 7:11:2009 13:28 3 | // filename: RuntimeLib.h 4 | // author: tiamo 5 | // purpose: runtime lib 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // define 12 | // 13 | #define isspace(ch) ((ch) == ' ' || (ch) == '\t' || (ch) == '\r' || (ch) == '\n') 14 | 15 | extern "C" 16 | { 17 | // 18 | // allocate from stack 19 | // 20 | VOID* BOOTAPI _alloca(UINTN bufferLength); 21 | #pragma intrinsic(_alloca) 22 | 23 | // 24 | // memcpy 25 | // 26 | VOID* memcpy(VOID* dstBuffer, VOID CONST* srcBuffer, UINTN bufferLength); 27 | 28 | // 29 | // memset 30 | // 31 | VOID* memset(VOID* dstBuffer, UINT8 setValue, UINTN bufferLength); 32 | 33 | // 34 | // memcmp 35 | // 36 | int memcmp(VOID CONST* buffer1, VOID CONST* buffer2, UINTN bufferLength); 37 | 38 | // 39 | // wcslen 40 | // 41 | UINTN wcslen(CHAR16 CONST* stringBuffer); 42 | 43 | // 44 | // strlen 45 | // 46 | UINTN strlen(CONST CHAR8* stringBuffer); 47 | 48 | // 49 | // strcmp 50 | // 51 | int strcmp(CHAR8 CONST* stringBuffer1, CHAR8 CONST* stringBuffer2); 52 | 53 | // 54 | // strncmp 55 | // 56 | INTN strnicmp(CHAR8 CONST* stringBuffer1, CHAR8 CONST* stringBuffer2, UINTN checkLength); 57 | 58 | // 59 | // strcpy 60 | // 61 | CHAR8* strcpy(CHAR8* dstBuffer, CHAR8 CONST* srcBuffer); 62 | 63 | // 64 | // strcat 65 | // 66 | CHAR8* strcat(CHAR8* dstBuffer, CHAR8 CONST* srcBuffer); 67 | 68 | // 69 | // strncpy 70 | // 71 | CHAR8* strncpy(CHAR8* dstBuffer, CHAR8 CONST* srcBuffer, UINTN maxCharCount); 72 | 73 | // 74 | // strstr 75 | // 76 | CHAR8 CONST* strstr(CHAR8 CONST* stringBuffer, CHAR8 CONST* findString); 77 | 78 | // 79 | // sprintf 80 | // 81 | UINTN snprintf(CHAR8* dstBuffer, UINTN bufferLength, CHAR8 CONST* formatString, ...); 82 | 83 | // 84 | // vsprintf 85 | // 86 | UINTN vsnprintf(CHAR8* dstBuffer, UINTN bufferLength, CHAR8 CONST* formatString, VA_LIST marker); 87 | 88 | // 89 | // atoi 90 | // 91 | INTN atoi(CHAR8 CONST* numberString); 92 | 93 | // 94 | // atoi64 95 | // 96 | INT64 atoi64(CHAR8 CONST* numberString); 97 | 98 | // 99 | // strtoul64 100 | // 101 | CHAR8 CONST* strtoul64_base16(CHAR8 CONST* numberString, UINT64* resultValue); 102 | 103 | // 104 | // upper case 105 | // 106 | CHAR8* strupr(CHAR8* stringBuffer); 107 | 108 | // 109 | // lower case 110 | // 111 | CHAR8* strlwr(CHAR8* stringBuffer); 112 | } -------------------------------------------------------------------------------- /src/boot/SHA256.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 20:9:2012 18:17 3 | // filename: SHA256.h 4 | // author: tiamo 5 | // purpose: sha256 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | // 11 | // context 12 | // 13 | typedef struct _SHA256_CONTEXT 14 | { 15 | // 16 | // length 17 | // 18 | UINT32 TotalLength[2]; 19 | 20 | // 21 | // state 22 | // 23 | UINT32 State[8]; 24 | 25 | // 26 | // buffer 27 | // 28 | UINT8 Buffer[64]; 29 | }SHA256_CONTEXT; 30 | 31 | // 32 | // init 33 | // 34 | VOID SHA256_Init(SHA256_CONTEXT* sha256Context); 35 | 36 | // 37 | // update 38 | // 39 | VOID SHA256_Update(VOID CONST* dataBuffer, UINTN dataLength, SHA256_CONTEXT* sha256Context); 40 | 41 | // 42 | // final 43 | // 44 | VOID SHA256_Final(UINT8* resultBuffer, SHA256_CONTEXT* sha256Context); 45 | 46 | // 47 | // sha256 buffer 48 | // 49 | VOID SHA256(VOID CONST* dataBuffer, UINTN dataLength, UINT8* resultBuffer); 50 | -------------------------------------------------------------------------------- /src/boot/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 4:11:2009 10:04 3 | // filename: stdafx.cpp 4 | // author: tiamo 5 | // purpose: stdafx 6 | //******************************************************************** 7 | 8 | #include "StdAfx.h" -------------------------------------------------------------------------------- /src/boot/StdAfx.h: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 4:11:2009 10:03 3 | // filename: stdafx.h 4 | // author: tiamo 5 | // purpose: stdafx 6 | //******************************************************************** 7 | 8 | #pragma once 9 | 10 | #define NOTHING 11 | #define BOOTAPI __cdecl 12 | #define CHAR8_CONST_STRING(S) static_cast(static_cast(S)) 13 | #define CHAR16_CONST_STRING(S) static_cast(static_cast(S)) 14 | #define CHAR8_STRING(S) static_cast(static_cast(S)) 15 | #define CHAR16_STRING(S) static_cast(static_cast(S)) 16 | #define try_leave(S) do{S;__leave;}while(0) 17 | #define ARRAYSIZE(A) (sizeof((A)) / sizeof((A)[0])) 18 | #define ArchConvertAddressToPointer(P,T) ((T)((UINTN)(P))) 19 | #define ArchConvertPointerToAddress(A) ((UINTN)(A)) 20 | #define ArchNeedEFI64Mode() (MmGetKernelVirtualStart() > static_cast(-1) || sizeof(UINTN) == sizeof(UINT64)) 21 | #define LdrStaticVirtualToPhysical(V) ((V) & (1 * 1024 * 1024 * 1024 - 1)) 22 | #define Add2Ptr(P, O, T) ArchConvertAddressToPointer(ArchConvertPointerToAddress(P) + (O), T) 23 | #define PAGE_ALIGN(A) ((A) & ~EFI_PAGE_MASK) 24 | #define BYTE_OFFSET(A) ((UINT32)(A) & EFI_PAGE_MASK) 25 | 26 | #define SWAP32(V) ((((UINT32)(V) & 0xff) << 24) | (((UINT32)(V) & 0xff00) << 8) | (((UINT32)(V) & 0xff0000) >> 8) | (((UINT32)(V) & 0xff000000) >> 24)) 27 | #define SWAP_BE32_TO_HOST SWAP32 28 | 29 | #include "EfiCommon.h" 30 | #include "EfiApi.h" 31 | #include "EfiImage.h" 32 | #include "EfiDevicePath.h" 33 | #include "IndustryStandard/Acpi.h" 34 | #include "IndustryStandard/pci.h" 35 | #include "IndustryStandard/SmBios.h" 36 | 37 | #include "GuidDefine.h" 38 | #include "RuntimeLib.h" 39 | #include "ArchUtils.h" 40 | #include "Memory.h" 41 | #include "MiscUtils.h" 42 | #include "AcpiUtils.h" 43 | #include "PeImage.h" 44 | #include "BootDebugger.h" 45 | #include "Base64.h" 46 | #include "Crc32.h" 47 | #include "MD5.h" 48 | #include "SHA256.h" 49 | #include "DeviceTree.h" 50 | #include "DevicePath.h" 51 | #include "Config.h" 52 | #include "FileIo.h" 53 | #include "MachO.h" 54 | #include "PlatformExpert.h" 55 | #include "NetBoot.h" 56 | #include "Hibernate.h" 57 | #include "Console.h" 58 | #include "Options.h" 59 | #include "LoadKernel.h" 60 | #include "LoadDrivers.h" 61 | #include "BootArgs.h" 62 | #include "MemoryMap.h" 63 | #include "PanicDialog.h" 64 | #include "FileVault.h" -------------------------------------------------------------------------------- /src/boot/x64/ArchUtilsX64.cpp: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 5:11:2009 13:45 3 | // filename: ArchUtils.cpp 4 | // author: tiamo 5 | // purpose: arch utils 6 | //******************************************************************** 7 | 8 | #include "stdafx.h" 9 | #include "ArchDefine.h" 10 | 11 | // 12 | // global 13 | // 14 | typedef VOID (BOOTAPI *ArchTransferRoutine)(VOID* kernelEntry, VOID* bootArgs); 15 | ArchTransferRoutine ArchpTransferRoutine = nullptr; 16 | 17 | // 18 | // init phase 0 19 | // 20 | EFI_STATUS ArchInitialize0() 21 | { 22 | return EFI_SUCCESS; 23 | } 24 | 25 | // 26 | // init phase 1 27 | // 28 | EFI_STATUS ArchInitialize1() 29 | { 30 | extern VOID ArchTransferRoutineBegin(); 31 | extern VOID ArchTransferRoutineEnd(); 32 | UINTN bytesCount = ArchConvertPointerToAddress(&ArchTransferRoutineEnd) - ArchConvertPointerToAddress(&ArchTransferRoutineBegin); 33 | UINT64 physicalAddress = 4 * 1024 * 1024 * 1024ULL - 1; 34 | VOID* transferRoutineBuffer = MmAllocatePages(AllocateMaxAddress, EfiLoaderCode, EFI_SIZE_TO_PAGES(bytesCount), &physicalAddress); 35 | if(!transferRoutineBuffer) 36 | return EFI_OUT_OF_RESOURCES; 37 | 38 | memcpy(transferRoutineBuffer, &ArchTransferRoutineBegin, bytesCount); 39 | ArchpTransferRoutine = reinterpret_cast(transferRoutineBuffer); 40 | return EFI_SUCCESS; 41 | } 42 | 43 | // 44 | // check 64bit cpu 45 | // 46 | EFI_STATUS ArchCheck64BitCpu() 47 | { 48 | return EFI_SUCCESS; 49 | } 50 | 51 | // 52 | // set idt entry 53 | // 54 | VOID ArchSetIdtEntry(UINT64 base, UINT32 index, UINT32 segCs, VOID* offset,UINT32 access) 55 | { 56 | KIDTENTRY* idtEntry = Add2Ptr(base, index * sizeof(KIDTENTRY), KIDTENTRY*); 57 | idtEntry->Selector = static_cast(segCs); 58 | idtEntry->Access = static_cast(access); 59 | idtEntry->Offset = static_cast(ArchConvertPointerToAddress(offset) & 0xffff); 60 | idtEntry->ExtendedOffset = static_cast(ArchConvertPointerToAddress(offset) >> 16); 61 | idtEntry->HighOffset = static_cast(ArchConvertPointerToAddress(offset) >> 32); 62 | idtEntry->Reserved = 0; 63 | } 64 | 65 | // 66 | // sweep instruction cache 67 | // 68 | VOID ArchSweepIcacheRange(VOID* startAddress, UINT32 bytesCount) 69 | { 70 | } 71 | 72 | // 73 | // transfer to kernel 74 | // 75 | VOID ArchStartKernel(VOID* kernelEntry, VOID* bootArgs) 76 | { 77 | ArchpTransferRoutine(kernelEntry, bootArgs); 78 | } 79 | 80 | // 81 | // setup thunk code 82 | // 83 | VOID ArchSetupThunkCode0(UINT64 thunkOffset, struct _MACH_O_LOADED_INFO* loadedInfo) 84 | { 85 | 86 | } 87 | 88 | // 89 | // setup thunk code 90 | // 91 | VOID ArchSetupThunkCode1(UINT64* efiSystemTablePhysicalAddress, UINT64 thunkOffset) 92 | { 93 | } -------------------------------------------------------------------------------- /src/boot/x64/Common.inc: -------------------------------------------------------------------------------- 1 | 2 | struc _KDESCRIPTOR 3 | .Padding resw 3 4 | .Limit resw 1 5 | .Base resq 1 6 | endstruc 7 | 8 | struc _KSPECIAL_REGISTERS 9 | .Cr0: resq 1 10 | .Cr2: resq 1 11 | .Cr3: resq 1 12 | .Cr4: resq 1 13 | .KernelDr0: resq 1 14 | .KernelDr1: resq 1 15 | .KernelDr2: resq 1 16 | .KernelDr3: resq 1 17 | .KernelDr6: resq 1 18 | .KernelDr7: resq 1 19 | .GdtrPadding resw 3 20 | .GdtrLimit resw 1 21 | .GdtrBase resq 1 22 | .IdtrPadding resw 3 23 | .IdtrLimit resw 1 24 | .IdtrBase resq 1 25 | .Tr: resw 1 26 | .Ldtr: resw 1 27 | .MxCsr resd 1 28 | .DebugControl: resq 1 29 | .LastBranchToRip: resq 1 30 | .LastBranchFromRip: resq 1 31 | .LastExceptionToRip: resq 1 32 | .LastExceptionFromRip: resq 1 33 | .Cr8: resq 1 34 | .MsrGsBase: resq 1 35 | .MsrGsSwap: resq 1 36 | .MsrStart: resq 1 37 | .MsrLStart: resq 1 38 | .MsrCStart: resq 1 39 | .MsrSyscallMask. resq 1 40 | endstruc 41 | 42 | struc _KTRAP_FRAME 43 | .P1Home resq 1 44 | .P2Home resq 1 45 | .P3Home resq 1 46 | .P4Home resq 1 47 | .P5Home resq 1 48 | .PreviousMode resb 1 49 | .PreviousIrql resb 1 50 | .FaultIndicator resb 1 51 | .ExceptionActive resb 1 52 | .MxCsr resd 1 53 | .Rax: resq 1 54 | .Rcx: resq 1 55 | .Rdx: resq 1 56 | .R8: resq 1 57 | .R9: resq 1 58 | .R10: resq 1 59 | .R11: resq 1 60 | .GsBase: 61 | .GsSwap: resq 1 62 | .Xmm0: resq 2 63 | .Xmm1: resq 2 64 | .Xmm2: resq 2 65 | .Xmm3: resq 2 66 | .Xmm4: resq 2 67 | .Xmm5: resq 2 68 | .FaultAddress: 69 | .ContextRecord: 70 | .TimeStampCKCL: resq 1 71 | .Dr0: resq 1 72 | .Dr1: resq 1 73 | .Dr2: resq 1 74 | .Dr3: resq 1 75 | .Dr6: resq 1 76 | .Dr7: resq 1 77 | .DebugControl: 78 | .LastBranchControl resq 1 79 | .LastBranchToRip: 80 | .LastBranchMsr: resq 1 81 | .LastBranchFromRip: resq 1 82 | .LastExceptionToRip: resq 1 83 | .LastExceptionFromRip: resq 1 84 | .SegDs: resw 1 85 | .SegEs: resw 1 86 | .SegFs: resw 1 87 | .SegGs: resw 1 88 | .TrapFrame: resq 1 89 | .Rbx: resq 1 90 | .Rdi: resq 1 91 | .Rsi: resq 1 92 | .Rbp: resq 1 93 | .ErrCode: 94 | .ExceptionFrame: resq 1 95 | .Rip: resq 1 96 | .SegCs: resq 1 97 | .EFlags: resq 1 98 | .HardwareRsp: resq 1 99 | .HardwareSs: resq 1 100 | endstruc 101 | 102 | struc _KEXCEPTION_FRAME 103 | .P1Home resq 1 104 | .P2Home resq 1 105 | .P3Home resq 1 106 | .P4Home resq 1 107 | .P5Home resq 1 108 | .InitialStack resq 1 109 | .Xmm6: resq 2 110 | .Xmm7: resq 2 111 | .Xmm8: resq 2 112 | .Xmm9: resq 2 113 | .Xmm10: resq 2 114 | .Xmm11: resq 2 115 | .Xmm12: resq 2 116 | .Xmm13: resq 2 117 | .Xmm14: resq 2 118 | .Xmm15: resq 2 119 | .TrapFrame: resq 1 120 | .CallbackBuffer: resq 1 121 | .OutputBuffer: resq 1 122 | .OutputLength: resq 1 123 | .MxCsr: resq 1 124 | .Rbp: resq 1 125 | .Rbx: resq 1 126 | .Rdi: resq 1 127 | .Rsi: resq 1 128 | .R12: resq 1 129 | .R13: resq 1 130 | .R14: resq 1 131 | .R15: resq 1 132 | endstruc 133 | 134 | struc _EXCEPTION_RECORD64 135 | .ExceptionCode: resd 1 136 | .ExceptionFlags: resd 1 137 | .ExceptionRecord: resq 1 138 | .ExceptionAddress: resq 1 139 | .NumberParameters: resd 1 140 | .Padding resd 1 141 | .ExceptionInformation0: resq 1 142 | .ExceptionInformation1: resq 1 143 | .ExceptionInformation2: resq 1 144 | .ExceptionInformations: resq 12 145 | endstruc 146 | 147 | %macro PUBLIC_ROUTINE 1 148 | global %1 149 | %1: 150 | %endmacro 151 | -------------------------------------------------------------------------------- /src/boot/x64/CompilerX64.asm: -------------------------------------------------------------------------------- 1 | ;********************************************************************* 2 | ; created: 6:10:2009 19:36 3 | ; filename: Compiler.asm 4 | ; author: tiamo 5 | ; purpose: compiler stub 6 | ;********************************************************************* 7 | 8 | default rel 9 | [bits 64] 10 | 11 | %include "Common.inc" 12 | 13 | PUBLIC_ROUTINE ?ArchGetSegCs@@YAIXZ 14 | mov ax, cs 15 | retn 16 | 17 | PUBLIC_ROUTINE ?ArchGetIdtRegister@@YAXPEAU_DESCRIPTOR@@@Z 18 | sidt [rcx + _KDESCRIPTOR.Limit] 19 | retn 20 | 21 | PUBLIC_ROUTINE ?ArchSetIdtRegister@@YAXPEAU_DESCRIPTOR@@@Z 22 | lidt [rcx + _KDESCRIPTOR.Limit] 23 | retn 24 | 25 | PUBLIC_ROUTINE ?MmTranslateVirtualAddress@@YAEPEAXPEA_K@Z 26 | mov rax, rcx 27 | mov r11, 0x000ffffffffff000 28 | mov r9, 0x00007fffffffffff 29 | cmp rax, r9 30 | jbe .check_pml4 31 | 32 | mov r9, 0xffff800000000000 33 | cmp rax, r9 34 | jae .check_pml4 35 | jmp .invalid_address 36 | 37 | .check_pml4: 38 | mov r9, cr3 39 | shr rcx, 39 40 | and r9w, 0xf000 41 | and ecx, 0x1ff 42 | mov r9, [r9 + rcx * 8] 43 | test r9, 1 44 | jz .invalid_address 45 | 46 | mov rcx, rax 47 | and r9, r11 48 | shr rcx, 30 49 | and ecx, 0x1ff 50 | mov r9, [r9 + rcx * 8] 51 | test r9, 1 52 | jz .invalid_address 53 | test r9, 0x80 54 | jnz .one_gb_page 55 | 56 | mov ecx, eax 57 | and r9, r11 58 | shr ecx, 21 59 | and ecx, 0x1ff 60 | mov r9, [r9 + rcx * 8] 61 | test r9, 1 62 | jz .invalid_address 63 | test r9, 0x80 64 | jnz .two_mb_page 65 | 66 | mov ecx, eax 67 | and r9, r11 68 | shr ecx, 12 69 | and ecx, 0x1ff 70 | mov r9, [r9 + rcx * 8] 71 | test r9, 1 72 | jz .invalid_address 73 | 74 | mov ecx, eax 75 | and r9, r11 76 | and ecx, 0xfff 77 | add r9, rcx 78 | mov eax, 1 79 | jmp .write_physical_address 80 | 81 | .two_mb_page: 82 | mov ecx, eax 83 | and r9, r11 84 | and ecx, 0x1fffff 85 | add r9, rcx 86 | mov eax, 1 87 | jmp .write_physical_address 88 | 89 | .one_gb_page: 90 | mov ecx, eax 91 | and r9, r11 92 | and ecx, 0x3fffffff 93 | add r9, rcx 94 | mov eax, 1 95 | jmp .write_physical_address 96 | 97 | .invalid_address: 98 | xor eax, eax 99 | xor r9, r9 100 | .write_physical_address: 101 | test rdx, rdx 102 | jz .finished 103 | mov [rdx], r9 104 | 105 | .finished: 106 | retn 107 | 108 | PUBLIC_ROUTINE ?ArchCpuId@@YAXIPEAI000@Z 109 | push rbx 110 | mov eax, ecx 111 | mov r10, rdx 112 | cpuid 113 | mov [r10], eax 114 | mov [r8], ebx 115 | mov rax, [rsp + 0x30] 116 | mov [r9], ecx 117 | mov [rax], rdx 118 | pop rbx 119 | retn 120 | 121 | PUBLIC_ROUTINE ?ArchHardwareRandom@@YA_KXZ 122 | mov edx, 0x0a 123 | 124 | .compute_rand: 125 | db 0x48, 0x0f, 0xc7, 0xf0 126 | jnb .retry 127 | retn 128 | 129 | .retry: 130 | dec edx 131 | pause 132 | jnz .compute_rand 133 | xor eax, eax 134 | retn 135 | 136 | 137 | PUBLIC_ROUTINE ?ArchGetCpuTick@@YA_KXZ 138 | lfence 139 | rdtsc 140 | lfence 141 | shl rdx, 0x20 142 | or rax, rdx 143 | retn 144 | 145 | PUBLIC_ROUTINE __chkstk 146 | retn 147 | 148 | PUBLIC_ROUTINE __C_specific_handler 149 | retn -------------------------------------------------------------------------------- /src/boot/x64/PortRegisterIo.asm: -------------------------------------------------------------------------------- 1 | ;********************************************************************* 2 | ; created: 6:10:2009 16:24 3 | ; filename: PortRegisterIo.asm 4 | ; author: tiamo 5 | ; purpose: io 6 | ;********************************************************************* 7 | 8 | default rel 9 | [bits 64] 10 | 11 | %include "Common.inc" 12 | 13 | PUBLIC_ROUTINE ?ARCH_READ_PORT_UINT8@@YAEPEAE@Z 14 | mov dx, cx 15 | in al, dx 16 | retn 17 | 18 | PUBLIC_ROUTINE ?ARCH_READ_PORT_UINT16@@YAGPEAG@Z 19 | mov dx, cx 20 | in ax, dx 21 | retn 22 | 23 | PUBLIC_ROUTINE ?ARCH_READ_PORT_UINT32@@YAIPEAI@Z 24 | mov dx, cx 25 | in eax, dx 26 | retn 27 | 28 | PUBLIC_ROUTINE ?ARCH_WRITE_PORT_UINT8@@YAXPEAEE@Z 29 | mov al, dl 30 | mov dx, cx 31 | out dx, al 32 | retn 33 | 34 | PUBLIC_ROUTINE ?ARCH_WRITE_PORT_UINT16@@YAXPEAGG@Z 35 | mov ax, dx 36 | mov dx, cx 37 | out dx, ax 38 | retn 39 | 40 | PUBLIC_ROUTINE ?ARCH_WRITE_PORT_UINT32@@YAXPEAII@Z 41 | mov eax, edx 42 | mov dx, cx 43 | out dx, eax 44 | retn 45 | 46 | PUBLIC_ROUTINE ?ARCH_READ_REGISTER_UINT8@@YAEPEAE@Z 47 | mov al, [rcx] 48 | retn 49 | 50 | PUBLIC_ROUTINE ?ARCH_READ_REGISTER_UINT16@@YAGPEAG@Z 51 | mov ax, [rcx] 52 | retn 53 | 54 | PUBLIC_ROUTINE ?ARCH_READ_REGISTER_UINT32@@YAIPEAI@Z 55 | mov eax, [rcx] 56 | retn 57 | 58 | PUBLIC_ROUTINE ?ARCH_WRITE_REGISTER_UINT8@@YAXPEAEE@Z 59 | xor eax, eax 60 | mov [rcx], dl 61 | lock or [rsp], eax 62 | retn 63 | 64 | PUBLIC_ROUTINE ?ARCH_WRITE_REGISTER_UINT16@@YAXPEAGG@Z 65 | xor eax, eax 66 | mov [rcx], dx 67 | lock or [rsp], eax 68 | retn 69 | 70 | PUBLIC_ROUTINE ?ARCH_WRITE_REGISTER_UINT32@@YAXPEAII@Z 71 | xor eax, eax 72 | mov [rcx], rdx 73 | lock or [rsp], eax 74 | retn -------------------------------------------------------------------------------- /src/boot/x64/TransferRoutine.asm: -------------------------------------------------------------------------------- 1 | ;********************************************************************* 2 | ; created: 5:10:2009 15:44 3 | ; filename: TransferRoutine.asm 4 | ; author: tiamo 5 | ; purpose: transfer routine 6 | ;********************************************************************* 7 | 8 | default rel 9 | [bits 64] 10 | 11 | %include "Common.inc" 12 | 13 | PUBLIC_ROUTINE ?ArchTransferRoutineBegin@@YAXXZ 14 | cli 15 | lea rax, [.32bits_code] 16 | mov [.far_jmp_offset], eax 17 | lea rax, [.gdt_null] 18 | mov [.gdtr_offset], rax 19 | lgdt [.gdtr_limit] 20 | mov ax, 10h 21 | mov ds, ax 22 | mov es, ax 23 | mov gs, ax 24 | mov fs, ax 25 | lea rax, [.far_jmp_offset] 26 | jmp dword far [rax] 27 | 28 | [bits 32] 29 | .32bits_code: 30 | mov eax, cr0 31 | btr eax, 31 32 | mov cr0, eax 33 | mov edi, ecx 34 | mov ebx, edx 35 | mov ecx, 0c0000080h 36 | rdmsr 37 | btr eax, 8 38 | wrmsr 39 | jmp .flush 40 | .flush: 41 | mov eax, ebx 42 | jmp edi 43 | hlt 44 | retn 45 | 46 | .far_jmp_offset: dd 0 47 | .far_jmp_selector: dw 8 48 | .gdtr_limit: dw 18h 49 | .gdtr_offset: dq 0 50 | 51 | .gdt_null: dd 0, 0 52 | .gdt_code_32: dd 0ffffh, 0cf9e00h 53 | .gdt_data_32: dd 0ffffh, 0cf9200h 54 | 55 | PUBLIC_ROUTINE ?ArchTransferRoutineEnd@@YAXXZ 56 | hlt 57 | retn 58 | -------------------------------------------------------------------------------- /src/boot/x86/ArchUtilsX86.cpp: -------------------------------------------------------------------------------- 1 | //******************************************************************** 2 | // created: 4:11:2009 10:33 3 | // filename: ArchUtils.cpp 4 | // author: tiamo 5 | // purpose: arch utils 6 | //******************************************************************** 7 | 8 | #include "stdafx.h" 9 | #include "ArchDefine.h" 10 | 11 | // 12 | // init phase 0 13 | // 14 | EFI_STATUS ArchInitialize0() 15 | { 16 | BlSetBootMode(BOOT_MODE_SKIP_BOARD_ID_CHECK, 0); 17 | return EFI_SUCCESS; 18 | } 19 | 20 | // 21 | // check 64bit cpu 22 | // 23 | EFI_STATUS ArchCheck64BitCpu() 24 | { 25 | UINT32 eaxValue = 0; 26 | UINT32 ebxValue = 0; 27 | UINT32 ecxValue = 0; 28 | UINT32 edxValue = 0; 29 | ArchCpuId(0x80000000, &eaxValue, &ebxValue, &ecxValue, &edxValue); 30 | if(eaxValue < 0x80000001) 31 | return EFI_UNSUPPORTED; 32 | 33 | ArchCpuId(0x80000001, &eaxValue, &ebxValue, &ecxValue, &edxValue); 34 | return edxValue & 0x20000000 ? EFI_SUCCESS : EFI_UNSUPPORTED; 35 | } 36 | 37 | // 38 | // cpu id 39 | // 40 | VOID __declspec(naked) ArchCpuId(UINT32 command, UINT32* eaxValue, UINT32* ebxValue, UINT32* ecxValue, UINT32* edxValue) 41 | { 42 | __asm 43 | { 44 | push ebx 45 | push edi 46 | mov eax, [esp + 0x0c] 47 | cpuid 48 | mov edi, [esp + 0x10] 49 | mov [edi], eax 50 | mov edi, [esp + 0x14] 51 | mov [edi], ebx 52 | mov edi, [esp + 0x18] 53 | mov [edi], ecx 54 | mov edi, [esp + 0x1c] 55 | mov [edi], edx 56 | pop edi 57 | pop ebx 58 | retn 59 | } 60 | } 61 | 62 | // 63 | // random 64 | // 65 | UINTN __declspec(naked) ArchHardwareRandom() 66 | { 67 | __asm 68 | { 69 | mov edx, 10 70 | 71 | HARDWARE_RND: 72 | __emit 0x0f 73 | __emit 0xc7 74 | __emit 0xf0 75 | jnb RETRY 76 | 77 | retn 78 | 79 | RETRY: 80 | dec edx 81 | pause 82 | jnz HARDWARE_RND 83 | 84 | xor eax, eax 85 | retn 86 | } 87 | } 88 | 89 | // 90 | // get cpu tick 91 | // 92 | UINT64 __declspec(naked) ArchGetCpuTick() 93 | { 94 | __asm 95 | { 96 | lfence 97 | rdtsc 98 | lfence 99 | retn 100 | } 101 | } 102 | 103 | // 104 | // transfer to kernel 105 | // 106 | VOID __declspec(naked) ArchStartKernel(VOID* kernelEntry, VOID* bootArgs) 107 | { 108 | __asm 109 | { 110 | cli 111 | mov edx, [esp + 4] 112 | mov eax, [esp + 8] 113 | call edx 114 | retn 115 | } 116 | } 117 | 118 | // 119 | // translate address 120 | // 121 | BOOLEAN MmTranslateVirtualAddress(VOID* virtualAddress, UINT64* physicalAddress) 122 | { 123 | if(physicalAddress) 124 | *physicalAddress = ArchConvertPointerToAddress(virtualAddress); 125 | 126 | return TRUE; 127 | } 128 | 129 | // 130 | // get cs 131 | // 132 | UINT32 __declspec(naked) ArchGetSegCs() 133 | { 134 | __asm 135 | { 136 | mov ax,cs 137 | movzx eax,ax 138 | retn 139 | } 140 | } 141 | 142 | // 143 | // get idtr 144 | // 145 | VOID __declspec(naked) ArchGetIdtRegister(KDESCRIPTOR* idtr) 146 | { 147 | __asm 148 | { 149 | mov eax,[esp + 4] 150 | sidt fword ptr[eax + KDESCRIPTOR.Limit] 151 | retn 152 | } 153 | } 154 | 155 | // 156 | // set idtr 157 | // 158 | VOID __declspec(naked) ArchSetIdtRegister(KDESCRIPTOR* idtr) 159 | { 160 | __asm 161 | { 162 | mov eax,[esp + 4] 163 | lidt fword ptr[eax + KDESCRIPTOR.Limit] 164 | retn 165 | } 166 | } 167 | 168 | // 169 | // set idt entry 170 | // 171 | VOID ArchSetIdtEntry(UINT32 base, UINT32 index, UINT32 segCs, VOID* offset,UINT32 access) 172 | { 173 | KIDTENTRY* idtEntry = Add2Ptr(base, index * sizeof(KIDTENTRY), KIDTENTRY*); 174 | idtEntry->Selector = static_cast(segCs); 175 | idtEntry->Access = static_cast(access); 176 | idtEntry->Offset = static_cast(ArchConvertPointerToAddress(offset) & 0xffff); 177 | idtEntry->ExtendedOffset = static_cast(ArchConvertPointerToAddress(offset) >> 16); 178 | } 179 | 180 | // 181 | // sweep instruction cache 182 | // 183 | VOID ArchSweepIcacheRange(VOID* startAddress, UINT32 bytesCount) 184 | { 185 | } 186 | 187 | // 188 | // read port uint8 189 | // 190 | UINT8 __declspec(naked) ARCH_READ_PORT_UINT8(UINT8* port) 191 | { 192 | __asm 193 | { 194 | mov dx, [esp + 4] 195 | in al, dx 196 | retn 197 | } 198 | } 199 | 200 | // 201 | // read port uint16 202 | // 203 | UINT16 __declspec(naked) ARCH_READ_PORT_UINT16(UINT16* port) 204 | { 205 | __asm 206 | { 207 | mov dx, [esp + 4] 208 | in ax, dx 209 | retn 210 | } 211 | } 212 | 213 | // 214 | // read port uint32 215 | // 216 | UINT32 __declspec(naked) ARCH_READ_PORT_UINT32(UINT32* port) 217 | { 218 | __asm 219 | { 220 | mov dx, [esp + 4] 221 | in eax, dx 222 | retn 223 | } 224 | } 225 | 226 | // 227 | // write port uint8 228 | // 229 | VOID __declspec(naked) ARCH_WRITE_PORT_UINT8(UINT8* port, UINT8 value) 230 | { 231 | __asm 232 | { 233 | mov dx, [esp + 4] 234 | mov al, [esp + 8] 235 | out dx, al 236 | retn 237 | } 238 | } 239 | 240 | // 241 | // write port uint16 242 | // 243 | VOID __declspec(naked) ARCH_WRITE_PORT_UINT16(UINT16* port, UINT16 value) 244 | { 245 | __asm 246 | { 247 | mov dx, [esp + 4] 248 | mov ax, [esp + 8] 249 | out dx, ax 250 | retn 251 | } 252 | } 253 | 254 | // 255 | // write port uint32 256 | // 257 | VOID __declspec(naked) ARCH_WRITE_PORT_UINT32(UINT32* port, UINT32 value) 258 | { 259 | __asm 260 | { 261 | mov dx, [esp + 4] 262 | mov eax,[esp + 8] 263 | out dx, eax 264 | retn 265 | } 266 | } 267 | 268 | // 269 | // read register uint8 270 | // 271 | UINT8 __declspec(naked) ARCH_READ_REGISTER_UINT8(UINT8* port) 272 | { 273 | __asm 274 | { 275 | mov edx, [esp + 4] 276 | mov al, [edx] 277 | retn 278 | } 279 | } 280 | 281 | // 282 | // read register uint16 283 | // 284 | UINT16 __declspec(naked) ARCH_READ_REGISTER_UINT16(UINT16* port) 285 | { 286 | __asm 287 | { 288 | mov edx, [esp + 4] 289 | mov ax, [edx] 290 | retn 291 | } 292 | } 293 | 294 | // 295 | // read register uint32 296 | // 297 | UINT32 __declspec(naked) ARCH_READ_REGISTER_UINT32(UINT32* port) 298 | { 299 | __asm 300 | { 301 | mov edx, [esp + 4] 302 | mov eax, [edx] 303 | retn 304 | } 305 | } 306 | 307 | // 308 | // write port uint8 309 | // 310 | VOID __declspec(naked) ARCH_WRITE_REGISTER_UINT8(UINT8* port, UINT8 value) 311 | { 312 | __asm 313 | { 314 | mov edx, [esp + 4] 315 | mov al, [esp + 8] 316 | mov [edx], al 317 | lock or [esp + 4], edx 318 | retn 319 | } 320 | } 321 | 322 | // 323 | // write port uint16 324 | // 325 | VOID __declspec(naked) ARCH_WRITE_REGISTER_UINT16(UINT16* port, UINT16 value) 326 | { 327 | __asm 328 | { 329 | mov edx, [esp + 4] 330 | mov ax, [esp + 8] 331 | mov [edx], ax 332 | lock or [esp + 4], edx 333 | retn 334 | } 335 | } 336 | 337 | // 338 | // write port uint32 339 | // 340 | VOID __declspec(naked) ARCH_WRITE_REGISTER_UINT32(UINT32* port, UINT32 value) 341 | { 342 | __asm 343 | { 344 | mov edx, [esp + 4] 345 | mov eax, [esp + 8] 346 | mov [edx], eax 347 | lock or [esp + 4], edx 348 | retn 349 | } 350 | } -------------------------------------------------------------------------------- /src/boot/x86/ThunkCode32.asm: -------------------------------------------------------------------------------- 1 | ;******************************************************************** 2 | ; created: 25:10:2009 16:53 3 | ; filename: All_X86.asm 4 | ; author: tiamo 5 | ; purpose: all 6 | ;******************************************************************** 7 | 8 | %macro PUBLIC_SYMBOL 1 9 | global %1 10 | %1: 11 | %endmacro 12 | 13 | section .rdata 14 | align 16 15 | PUBLIC_SYMBOL ?ArchThunk64BufferStart@@3PAEA 16 | incbin "ThunkCode64.dat" 17 | PUBLIC_SYMBOL ?ArchThunk64BufferEnd@@3PAEA 18 | -------------------------------------------------------------------------------- /src/common.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | false 7 | $(SolutionDir)..\bin\$(PlatformShortName)\$(Configuration)\ 8 | $(SolutionDir)..\temp\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ 9 | $(SolutionDir)..\sdk\include;$(SolutionDir)..\sdk\include\$(PlatformShortName);$(ProjectDir);$(ProjectDir)$(PlatformShortName);$(SolutionDir);$(IncludePath) 10 | false 11 | 12 | 13 | 14 | ProgramDatabase 15 | Level4 16 | true 17 | WIN32;_UNICODE;UNICODE;EFI_SPECIFICATION_VERSION=0x0001000a;TIANO_RELEASE_VERSION=1;%(PreprocessorDefinitions) 18 | false 19 | Use 20 | true 21 | false 22 | Default 23 | true 24 | 25 | 26 | true 27 | EFI Application 28 | EfiMain 29 | true 30 | true 31 | 32 | 33 | 34 | 35 | false 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/debug.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | _DEBUG;DEBUG;%(PreprocessorDefinitions) 9 | MultiThreadedDebugDLL 10 | Disabled 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/release.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | NDEBUG;%(PreprocessorDefinitions) 8 | MultiThreadedDLL 9 | 10 | 11 | true 12 | true 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/rijndael/aestab.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved. 4 | 5 | LICENSE TERMS 6 | 7 | The redistribution and use of this software (with or without changes) 8 | is allowed without the payment of fees or royalties provided that: 9 | 10 | 1. source code distributions include the above copyright notice, this 11 | list of conditions and the following disclaimer; 12 | 13 | 2. binary distributions include the above copyright notice, this list 14 | of conditions and the following disclaimer in their documentation; 15 | 16 | 3. the name of the copyright holder is not used to endorse products 17 | built using this software without specific written permission. 18 | 19 | DISCLAIMER 20 | 21 | This software is provided 'as is' with no explicit or implied warranties 22 | in respect of its properties, including, but not limited to, correctness 23 | and/or fitness for purpose. 24 | --------------------------------------------------------------------------- 25 | Issue Date: 20/12/2007 26 | 27 | This file contains the code for declaring the tables needed to implement 28 | AES. The file aesopt.h is assumed to be included before this header file. 29 | If there are no global variables, the definitions here can be used to put 30 | the AES tables in a structure so that a pointer can then be added to the 31 | AES context to pass them to the AES routines that need them. If this 32 | facility is used, the calling program has to ensure that this pointer is 33 | managed appropriately. In particular, the value of the t_dec(in,it) item 34 | in the table structure must be set to zero in order to ensure that the 35 | tables are initialised. In practice the three code sequences in aeskey.c 36 | that control the calls to aes_init() and the aes_init() routine itself will 37 | have to be changed for a specific implementation. If global variables are 38 | available it will generally be preferable to use them with the precomputed 39 | FIXED_TABLES option that uses static global tables. 40 | 41 | The following defines can be used to control the way the tables 42 | are defined, initialised and used in embedded environments that 43 | require special features for these purposes 44 | 45 | the 't_dec' construction is used to declare fixed table arrays 46 | the 't_set' construction is used to set fixed table values 47 | the 't_use' construction is used to access fixed table values 48 | 49 | 256 byte tables: 50 | 51 | t_xxx(s,box) => forward S box 52 | t_xxx(i,box) => inverse S box 53 | 54 | 256 32-bit word OR 4 x 256 32-bit word tables: 55 | 56 | t_xxx(f,n) => forward normal round 57 | t_xxx(f,l) => forward last round 58 | t_xxx(i,n) => inverse normal round 59 | t_xxx(i,l) => inverse last round 60 | t_xxx(l,s) => key schedule table 61 | t_xxx(i,m) => key schedule table 62 | 63 | Other variables and tables: 64 | 65 | t_xxx(r,c) => the rcon table 66 | */ 67 | 68 | #if !defined( _AESTAB_H ) 69 | #define _AESTAB_H 70 | 71 | #if defined(__cplusplus) 72 | extern "C" { 73 | #endif 74 | 75 | #define t_dec(m,n) t_##m##n 76 | #define t_set(m,n) t_##m##n 77 | #define t_use(m,n) t_##m##n 78 | 79 | #if defined(FIXED_TABLES) 80 | # if !defined( __GNUC__ ) && (defined( __MSDOS__ ) || defined( __WIN16__ )) 81 | /* make tables far data to avoid using too much DGROUP space (PG) */ 82 | # define CONST const far 83 | # else 84 | # define CONST const 85 | # endif 86 | #else 87 | # define CONST 88 | #endif 89 | 90 | #if defined(DO_TABLES) 91 | # define EXTERN 92 | #else 93 | # define EXTERN extern 94 | #endif 95 | 96 | #if defined(_MSC_VER) && defined(TABLE_ALIGN) 97 | #define ALIGN __declspec(align(TABLE_ALIGN)) 98 | #else 99 | #define ALIGN 100 | #endif 101 | 102 | #if defined( __WATCOMC__ ) && ( __WATCOMC__ >= 1100 ) 103 | # define XP_DIR __cdecl 104 | #else 105 | # define XP_DIR 106 | #endif 107 | 108 | #if defined(DO_TABLES) && defined(FIXED_TABLES) 109 | #define d_1(t,n,b,e) EXTERN ALIGN CONST XP_DIR t n[256] = b(e) 110 | #define d_4(t,n,b,e,f,g,h) EXTERN ALIGN CONST XP_DIR t n[4][256] = { b(e), b(f), b(g), b(h) } 111 | EXTERN ALIGN CONST uint_32t t_dec(r,c)[RC_LENGTH] = rc_data(w0); 112 | #else 113 | #define d_1(t,n,b,e) EXTERN ALIGN CONST XP_DIR t n[256] 114 | #define d_4(t,n,b,e,f,g,h) EXTERN ALIGN CONST XP_DIR t n[4][256] 115 | EXTERN ALIGN CONST uint_32t t_dec(r,c)[RC_LENGTH]; 116 | #endif 117 | 118 | #if defined( SBX_SET ) 119 | d_1(uint_8t, t_dec(s,box), sb_data, h0); 120 | #endif 121 | #if defined( ISB_SET ) 122 | d_1(uint_8t, t_dec(i,box), isb_data, h0); 123 | #endif 124 | 125 | #if defined( FT1_SET ) 126 | d_1(uint_32t, t_dec(f,n), sb_data, u0); 127 | #endif 128 | #if defined( FT4_SET ) 129 | d_4(uint_32t, t_dec(f,n), sb_data, u0, u1, u2, u3); 130 | #endif 131 | 132 | #if defined( FL1_SET ) 133 | d_1(uint_32t, t_dec(f,l), sb_data, w0); 134 | #endif 135 | #if defined( FL4_SET ) 136 | d_4(uint_32t, t_dec(f,l), sb_data, w0, w1, w2, w3); 137 | #endif 138 | 139 | #if defined( IT1_SET ) 140 | d_1(uint_32t, t_dec(i,n), isb_data, v0); 141 | #endif 142 | #if defined( IT4_SET ) 143 | d_4(uint_32t, t_dec(i,n), isb_data, v0, v1, v2, v3); 144 | #endif 145 | 146 | #if defined( IL1_SET ) 147 | d_1(uint_32t, t_dec(i,l), isb_data, w0); 148 | #endif 149 | #if defined( IL4_SET ) 150 | d_4(uint_32t, t_dec(i,l), isb_data, w0, w1, w2, w3); 151 | #endif 152 | 153 | #if defined( LS1_SET ) 154 | #if defined( FL1_SET ) 155 | #undef LS1_SET 156 | #else 157 | d_1(uint_32t, t_dec(l,s), sb_data, w0); 158 | #endif 159 | #endif 160 | 161 | #if defined( LS4_SET ) 162 | #if defined( FL4_SET ) 163 | #undef LS4_SET 164 | #else 165 | d_4(uint_32t, t_dec(l,s), sb_data, w0, w1, w2, w3); 166 | #endif 167 | #endif 168 | 169 | #if defined( IM1_SET ) 170 | d_1(uint_32t, t_dec(i,m), mm_data, v0); 171 | #endif 172 | #if defined( IM4_SET ) 173 | d_4(uint_32t, t_dec(i,m), mm_data, v0, v1, v2, v3); 174 | #endif 175 | 176 | #if defined(__cplusplus) 177 | } 178 | #endif 179 | 180 | #endif 181 | -------------------------------------------------------------------------------- /src/rijndael/aesxts.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 Apple Inc. All Rights Reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* 25 | * aesxts.h 26 | * 27 | * 28 | */ 29 | 30 | #ifndef _AESXTS_H 31 | #define _AESXTS_H 32 | 33 | #if defined(__cplusplus) 34 | extern "C" 35 | { 36 | #endif 37 | 38 | /* 39 | * The context for XTS-AES 40 | */ 41 | 42 | 43 | #define KS_LENGTH 60 44 | 45 | typedef struct { 46 | uint32_t ks[KS_LENGTH]; 47 | uint32_t rn; 48 | } aesedp_encrypt_ctx; 49 | 50 | typedef struct { 51 | uint32_t ks[KS_LENGTH]; 52 | uint32_t rn; 53 | } aesedp_decrypt_ctx; 54 | 55 | typedef struct { 56 | aesedp_decrypt_ctx decrypt; 57 | aesedp_encrypt_ctx encrypt; 58 | } aesedp_ctx; 59 | 60 | // xts mode context 61 | 62 | typedef struct { 63 | aesedp_ctx key1, key2; 64 | uint32_t cipher; // ignore - this is to fit with the library, but in this case we're only using aes 65 | } symmetric_xts; 66 | 67 | 68 | /* 69 | * These are the interfaces required for XTS-AES support 70 | */ 71 | 72 | uint32_t 73 | xts_start(uint32_t cipher, // ignored - we're doing this for xts-aes only 74 | const uint8_t *IV, // ignored 75 | const uint8_t *key1, int keylen, 76 | const uint8_t *key2, int tweaklen, // both keys are the same size for xts 77 | uint32_t num_rounds, // ignored 78 | uint32_t options, // ignored 79 | symmetric_xts *xts); 80 | 81 | int xts_encrypt( 82 | const uint8_t *pt, unsigned long ptlen, 83 | uint8_t *ct, 84 | const uint8_t *tweak, // this can be considered the sector IV for this use 85 | symmetric_xts *xts); 86 | 87 | int xts_decrypt( 88 | const uint8_t *ct, unsigned long ptlen, 89 | uint8_t *pt, 90 | const uint8_t *tweak, // this can be considered the sector IV for this use 91 | symmetric_xts *xts); 92 | 93 | 94 | void xts_done(symmetric_xts *xts); 95 | 96 | #if defined(__cplusplus) 97 | } 98 | #endif 99 | 100 | #endif /* _AESXTS_H */ -------------------------------------------------------------------------------- /src/rijndael/brg_endian.h: -------------------------------------------------------------------------------- 1 | /* 2 | --------------------------------------------------------------------------- 3 | Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved. 4 | 5 | LICENSE TERMS 6 | 7 | The redistribution and use of this software (with or without changes) 8 | is allowed without the payment of fees or royalties provided that: 9 | 10 | 1. source code distributions include the above copyright notice, this 11 | list of conditions and the following disclaimer; 12 | 13 | 2. binary distributions include the above copyright notice, this list 14 | of conditions and the following disclaimer in their documentation; 15 | 16 | 3. the name of the copyright holder is not used to endorse products 17 | built using this software without specific written permission. 18 | 19 | DISCLAIMER 20 | 21 | This software is provided 'as is' with no explicit or implied warranties 22 | in respect of its properties, including, but not limited to, correctness 23 | and/or fitness for purpose. 24 | --------------------------------------------------------------------------- 25 | Issue Date: 20/12/2007 26 | */ 27 | 28 | #ifndef _BRG_ENDIAN_H 29 | #define _BRG_ENDIAN_H 30 | 31 | #define IS_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */ 32 | #define IS_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */ 33 | 34 | /* Include files where endian defines and byteswap functions may reside */ 35 | #if defined( __sun ) 36 | # include 37 | #elif defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __NetBSD__ ) 38 | # include 39 | #elif defined( BSD ) && ( BSD >= 199103 ) || defined( __APPLE__ ) || \ 40 | defined( __CYGWIN32__ ) || defined( __DJGPP__ ) || defined( __osf__ ) 41 | # include 42 | #elif defined( __linux__ ) || defined( __GNUC__ ) || defined( __GNU_LIBRARY__ ) 43 | # if !defined( __MINGW32__ ) && !defined( _AIX ) 44 | # include 45 | # if !defined( __BEOS__ ) 46 | # include 47 | # endif 48 | # endif 49 | #endif 50 | 51 | /* Now attempt to set the define for platform byte order using any */ 52 | /* of the four forms SYMBOL, _SYMBOL, __SYMBOL & __SYMBOL__, which */ 53 | /* seem to encompass most endian symbol definitions */ 54 | 55 | #if defined( BIG_ENDIAN ) && defined( LITTLE_ENDIAN ) 56 | # if defined( BYTE_ORDER ) && BYTE_ORDER == BIG_ENDIAN 57 | # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN 58 | # elif defined( BYTE_ORDER ) && BYTE_ORDER == LITTLE_ENDIAN 59 | # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN 60 | # endif 61 | #elif defined( BIG_ENDIAN ) 62 | # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN 63 | #elif defined( LITTLE_ENDIAN ) 64 | # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN 65 | #endif 66 | 67 | #if defined( _BIG_ENDIAN ) && defined( _LITTLE_ENDIAN ) 68 | # if defined( _BYTE_ORDER ) && _BYTE_ORDER == _BIG_ENDIAN 69 | # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN 70 | # elif defined( _BYTE_ORDER ) && _BYTE_ORDER == _LITTLE_ENDIAN 71 | # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN 72 | # endif 73 | #elif defined( _BIG_ENDIAN ) 74 | # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN 75 | #elif defined( _LITTLE_ENDIAN ) 76 | # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN 77 | #endif 78 | 79 | #if defined( __BIG_ENDIAN ) && defined( __LITTLE_ENDIAN ) 80 | # if defined( __BYTE_ORDER ) && __BYTE_ORDER == __BIG_ENDIAN 81 | # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN 82 | # elif defined( __BYTE_ORDER ) && __BYTE_ORDER == __LITTLE_ENDIAN 83 | # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN 84 | # endif 85 | #elif defined( __BIG_ENDIAN ) 86 | # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN 87 | #elif defined( __LITTLE_ENDIAN ) 88 | # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN 89 | #endif 90 | 91 | #if defined( __BIG_ENDIAN__ ) && defined( __LITTLE_ENDIAN__ ) 92 | # if defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __BIG_ENDIAN__ 93 | # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN 94 | # elif defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __LITTLE_ENDIAN__ 95 | # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN 96 | # endif 97 | #elif defined( __BIG_ENDIAN__ ) 98 | # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN 99 | #elif defined( __LITTLE_ENDIAN__ ) 100 | # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN 101 | #endif 102 | 103 | /* if the platform byte order could not be determined, then try to */ 104 | /* set this define using common machine defines */ 105 | #if !defined(PLATFORM_BYTE_ORDER) 106 | 107 | #if defined( __alpha__ ) || defined( __alpha ) || defined( i386 ) || \ 108 | defined( __i386__ ) || defined( _M_I86 ) || defined( _M_IX86 ) || \ 109 | defined( __OS2__ ) || defined( sun386 ) || defined( __TURBOC__ ) || \ 110 | defined( vax ) || defined( vms ) || defined( VMS ) || \ 111 | defined( __VMS ) || defined( _M_X64 ) 112 | # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN 113 | 114 | #elif defined( AMIGA ) || defined( applec ) || defined( __AS400__ ) || \ 115 | defined( _CRAY ) || defined( __hppa ) || defined( __hp9000 ) || \ 116 | defined( ibm370 ) || defined( mc68000 ) || defined( m68k ) || \ 117 | defined( __MRC__ ) || defined( __MVS__ ) || defined( __MWERKS__ ) || \ 118 | defined( sparc ) || defined( __sparc) || defined( SYMANTEC_C ) || \ 119 | defined( __VOS__ ) || defined( __TIGCC__ ) || defined( __TANDEM ) || \ 120 | defined( THINK_C ) || defined( __VMCMS__ ) || defined( _AIX ) 121 | # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN 122 | 123 | #elif 0 /* **** EDIT HERE IF NECESSARY **** */ 124 | # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN 125 | #elif 0 /* **** EDIT HERE IF NECESSARY **** */ 126 | # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN 127 | #else 128 | # error Please edit lines 126 or 128 in brg_endian.h to set the platform byte order 129 | #endif 130 | 131 | #endif 132 | 133 | #endif 134 | -------------------------------------------------------------------------------- /src/rijndael/rijndael.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {1B43E5F7-D447-4FCF-AC9B-4767AB47DB8B} 23 | rijndael 24 | Win32Proj 25 | 26 | 27 | 28 | true 29 | v120 30 | StaticLibrary 31 | 32 | 33 | true 34 | v120 35 | StaticLibrary 36 | 37 | 38 | false 39 | v120 40 | StaticLibrary 41 | 42 | 43 | false 44 | v120 45 | StaticLibrary 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | NotUsing 74 | 75 | 76 | 77 | 78 | NotUsing 79 | 80 | 81 | 82 | 83 | NotUsing 84 | 85 | 86 | 87 | 88 | NotUsing 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /src/rijndael/rijndael.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | 31 | 32 | Header Files 33 | 34 | 35 | Header Files 36 | 37 | 38 | Header Files 39 | 40 | 41 | Header Files 42 | 43 | 44 | Header Files 45 | 46 | 47 | Header Files 48 | 49 | 50 | Header Files 51 | 52 | 53 | --------------------------------------------------------------------------------