├── .gitignore ├── LICENSE.MD ├── Prebuilt ├── boot.efi └── boot_grey.efi ├── README.md ├── TODO.md ├── appveyor.yml ├── donate_button.gif ├── sdk ├── .svn │ ├── all-wcprops │ └── entries └── 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 ├── .svn ├── all-wcprops ├── entries └── text-base │ ├── boot.sln.svn-base │ ├── common.props.svn-base │ ├── debug.props.svn-base │ └── release.props.svn-base ├── boot.sln ├── boot ├── .svn │ ├── all-wcprops │ ├── entries │ └── text-base │ │ ├── AcpiUtils.cpp.svn-base │ │ ├── AcpiUtils.h.svn-base │ │ ├── ArchUtils.h.svn-base │ │ ├── Base64.cpp.svn-base │ │ ├── Base64.h.svn-base │ │ ├── BootArgs.cpp.svn-base │ │ ├── BootArgs.h.svn-base │ │ ├── BootDebugger.cpp.svn-base │ │ ├── BootDebugger.h.svn-base │ │ ├── BootDebuggerPrivate.h.svn-base │ │ ├── Config.cpp.svn-base │ │ ├── Config.h.svn-base │ │ ├── Console.cpp.svn-base │ │ ├── Console.h.svn-base │ │ ├── Crc32.cpp.svn-base │ │ ├── Crc32.h.svn-base │ │ ├── Debug1394.cpp.svn-base │ │ ├── Debug1394.h.svn-base │ │ ├── DebugUsb.cpp.svn-base │ │ ├── DebugUsb.h.svn-base │ │ ├── DevicePath.cpp.svn-base │ │ ├── DevicePath.h.svn-base │ │ ├── DeviceTree.cpp.svn-base │ │ ├── DeviceTree.h.svn-base │ │ ├── FileIo.cpp.svn-base │ │ ├── FileIo.h.svn-base │ │ ├── FileVault.cpp.svn-base │ │ ├── FileVault.h.svn-base │ │ ├── GuidDefine.cpp.svn-base │ │ ├── GuidDefine.h.svn-base │ │ ├── Hibernate.cpp.svn-base │ │ ├── Hibernate.h.svn-base │ │ ├── LoadDrivers.cpp.svn-base │ │ ├── LoadDrivers.h.svn-base │ │ ├── LoadKernel.cpp.svn-base │ │ ├── LoadKernel.h.svn-base │ │ ├── MD5.cpp.svn-base │ │ ├── MD5.h.svn-base │ │ ├── MachO.cpp.svn-base │ │ ├── MachO.h.svn-base │ │ ├── Main.cpp.svn-base │ │ ├── Memory.cpp.svn-base │ │ ├── Memory.h.svn-base │ │ ├── MemoryMap.cpp.svn-base │ │ ├── MemoryMap.h.svn-base │ │ ├── MiscUtils.cpp.svn-base │ │ ├── MiscUtils.h.svn-base │ │ ├── NetBoot.cpp.svn-base │ │ ├── NetBoot.h.svn-base │ │ ├── Options.cpp.svn-base │ │ ├── Options.h.svn-base │ │ ├── PanicDialog.cpp.svn-base │ │ ├── PanicDialog.h.svn-base │ │ ├── PeImage.cpp.svn-base │ │ ├── PeImage.h.svn-base │ │ ├── PictData.h.svn-base │ │ ├── PlatformExpert.cpp.svn-base │ │ ├── PlatformExpert.h.svn-base │ │ ├── RuntimeLib.cpp.svn-base │ │ ├── RuntimeLib.h.svn-base │ │ ├── SHA256.cpp.svn-base │ │ ├── SHA256.h.svn-base │ │ ├── StdAfx.cpp.svn-base │ │ ├── StdAfx.h.svn-base │ │ ├── boot.vcxproj.filters.svn-base │ │ └── boot.vcxproj.svn-base ├── AcpiUtils.cpp ├── AcpiUtils.h ├── AppleLogoData.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 ├── NetBootImages.h ├── Options.cpp ├── Options.h ├── PanicDialog.cpp ├── PanicDialog.h ├── PanicDialogData.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 │ ├── .svn │ │ ├── all-wcprops │ │ ├── entries │ │ └── text-base │ │ │ ├── ArchDefine.h.svn-base │ │ │ ├── ArchUtilsX64.cpp.svn-base │ │ │ ├── Common.inc.svn-base │ │ │ ├── CompilerX64.asm.svn-base │ │ │ ├── DebugTrap.asm.svn-base │ │ │ ├── DebuggerUtilsX64.cpp.svn-base │ │ │ ├── PortRegisterIo.asm.svn-base │ │ │ └── TransferRoutine.asm.svn-base │ ├── ArchDefine.h │ ├── ArchUtilsX64.cpp │ ├── Common.inc │ ├── CompilerX64.asm │ ├── DebugTrap.asm │ ├── DebuggerUtilsX64.cpp │ ├── PortRegisterIo.asm │ └── TransferRoutine.asm └── x86 │ ├── .svn │ ├── all-wcprops │ ├── entries │ └── text-base │ │ ├── ArchDefine.h.svn-base │ │ ├── ArchUtilsX86.cpp.svn-base │ │ ├── CompilerX86.cpp.svn-base │ │ ├── DebuggerUtilsX86.cpp.svn-base │ │ ├── Thunk64.cpp.svn-base │ │ ├── ThunkCode32.asm.svn-base │ │ └── ThunkCode64.asm.svn-base │ ├── ArchDefine.h │ ├── ArchUtilsX86.cpp │ ├── CompilerX86.cpp │ ├── DebuggerUtilsX86.cpp │ ├── Thunk64.cpp │ ├── ThunkCode32.asm │ └── ThunkCode64.asm ├── common.props ├── debug.props ├── release.props └── rijndael ├── .svn ├── all-wcprops ├── entries └── text-base │ ├── aes.h.svn-base │ ├── aes_modes.c.svn-base │ ├── aes_via_ace.h.svn-base │ ├── aescrypt.c.svn-base │ ├── aeskey.c.svn-base │ ├── aesopt.h.svn-base │ ├── aestab.c.svn-base │ ├── aestab.h.svn-base │ ├── aesxts.c.svn-base │ ├── aesxts.h.svn-base │ ├── brg_endian.h.svn-base │ ├── brg_types.h.svn-base │ ├── rijndael.vcxproj.filters.svn-base │ └── rijndael.vcxproj.svn-base ├── 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 /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .git 3 | 4 | 5 | -------------------------------------------------------------------------------- /Prebuilt/boot.efi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piker-Alpha/macosxbootloader/1abba11e3b792dd29c2a08c410c122efd1d19e98/Prebuilt/boot.efi -------------------------------------------------------------------------------- /Prebuilt/boot_grey.efi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piker-Alpha/macosxbootloader/1abba11e3b792dd29c2a08c410c122efd1d19e98/Prebuilt/boot_grey.efi -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Introduction 2 | ------------ 3 | 4 | This Github project is a new and updated branch of the [Yosemite tree](https://github.com/Piker-Alpha/macosxbootloader/tree/master) and is now targetted at OS X 10.11 El Capitan. 5 | 6 | 7 | Goals 8 | ----- 9 | 10 | This project aims to add support for El Capitan (OS X 10.11) for unsupported Mac hardware with a 32-bit only EFI implementation. Like for example the first and second generation Mac Pro models. Though it should work well with any other model with a 32-bit EFI implementation. 11 | 12 | 13 | Current State 14 | ------------- 15 | 16 | The current state of this project is: Phase 1, 2 and 3 completed (OS X 10.11 El Capitan is now fully supported). 17 | 18 | Note: For more information about the development phases, please visit the [TODO list](https://github.com/Piker-Alpha/macosxbootloader/blob/El-Capitan/TODO.md). 19 | 20 | 21 | Download 22 | -------- 23 | 24 | Prebuilt copies of boot.efi can be downloaded from the [project download page](http://piker-alpha.github.io/macosxbootloader/). 25 | 26 | 27 | Compilation 28 | ----------- 29 | 30 | Don't want a prebuilt copy of boot.efi then compile the source code yourself, with either Microsoft Visual Studio 2013 or 2015. The latter requires you to update the solution files, but that should be done automatically in the MS Visual Studio IDE. 31 | 32 | Note: See also [Compiling-Instructions](https://github.com/Piker-Alpha/macosxbootloader/wiki/Compiling-Instructions) 33 | 34 | 35 | Thanks To 36 | --------- 37 | 38 | This project would not have been possible without the help of Peter Holbrook and Mike Boss. Peter did all compiling and Mike ran dozens of test builds that Peter pushed out over at forums.macrumors.com Awesome work guys. Job well done! 39 | 40 | 41 | Donations 42 | --------- 43 | 44 | If you like to support my work then you may want to consider to [make a donation](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JXFBXK7J97RAE) 45 | 46 | 47 | Help 48 | ---- 49 | 50 | If you need help with the setup then please visit [this macrumor thread](http://forums.macrumors.com/threads/2006-2007-mac-pro-1-1-2-1-and-os-x-el-capitan.1890435/) 51 | 52 | Note: Sorry. I can't help you. I don't have unsupported hardware with 32-bit EFI. 53 | 54 | 55 | Bugs 56 | ---- 57 | 58 | Bugs can be reported [here](https://github.com/Piker-Alpha/macosxbootloader/issues) 59 | 60 | Note: Please provide a clear step by step way to reproduce the bug. 61 | 62 | 63 | License 64 | ------- 65 | 66 | My work is licensed under [the Creative Commons Attribution-NonCommercial 3.0 Unported License](http://creativecommons.org/licenses/by-nc/3.0/) and as such you must add a link to this license. Even if you only use a download link. Also note the term "NonCommercial" because I don't want to see my work end up anywhere else but here. 67 | 68 | Note: "Tiamo" released his work under a [BSD-3-Clause license](http://opensource.org/licenses/BSD-3-Clause) 69 | 70 | 71 | Disclaimer 72 | ---------- 73 | 74 | Copyright (c) 2014-2015, by Pike R. Alpha – All right reserved. 75 | 76 | Macosxbootloader is maintained by Pike R. Alpha. 77 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | 2 | OS X 10.11 El Capitan TODO list: 3 | -------------------------------- 4 | 5 | Phase 1: Status - Completed (in 2015) 6 | 7 | ``` 8 | 1.) Load the prelinkedkernel for safe boot mode i.e. when -x is used (status: Done). 9 | 10 | 2.) Fix IODeviceTree:/chosen/boot-file property value. Examples: (status: Done). 11 | - "\System\Library\Kernels\kernel" for booting in safe mode. 12 | - "\com.apple.recovery.boot\prelinkedkernel" for booting from the Recovery HD. 13 | - "\System\Library\Prelinkedkernels\prelinkedkernel" for regular bootups. 14 | 15 | 3.) Implement SIP support (status: Done). 16 | - Previously csrutil disable/enable failed from the Recovery HD. 17 | 18 | 4.) Fix Beach Ball of Death (BBOD) issue after clearing NVRAM (status: Done). 19 | - Booting from the Recovery HD is fine. 20 | - This issue was fixed by setting IODeviceTREE:efi/platform/system-id to the SMBIOS UUID. 21 | 22 | 5.) Add missing booter info properties, like: "booter-name", "booter-version" and "booter-build-time" (status: Done). 23 | ``` 24 | 25 | Phase 2: Status - Completed (on 27 September 2015) 26 | 27 | ``` 28 | 1.) Back port Clang changes (status: Done). 29 | 30 | 2.) Add OS X support for (pre)Mavericks, Yosemite and El Capitan (status: Done). 31 | 32 | 3.) Mask csr-active-config so that csrutil never reports 0x80 (status: Done). 33 | 34 | 4.) Include image data for mavericks and older versions of OS X (status: Done). 35 | 36 | 5.) Disable debug output (status: Done). 37 | 38 | 6.) Select normal boot – no more verbose boots (status: Done). 39 | ``` 40 | 41 | Phase 3: Status - Completed (on 16 October 2015) 42 | 43 | ``` 44 | 1.) Fix flush cache i.e. when -f is used (status: Done). 45 | - Have patch ready. Waiting for a confirmation of my previous commit. 46 | 47 | 2.) Add Installer detection (status: Done). 48 | - This feature enables you to use one file for boot.efi and bootbase.efi 49 | 50 | 3.) Add board-id replacement (status: Done). 51 | - This feature enables you to download El Capitan from the App Store and install OS X form the Application folder without the need to mod the DMGs. 52 | 53 | ``` 54 | 55 | OS X 10.10 Yosemite TODO list: 56 | ------------------------------ 57 | 58 | Phase 1: Status - Completed (in 2014) 59 | 60 | ``` 61 | 1.) None. All issues related to full Yosemite compatibility have been completed. 62 | ``` 63 | 64 | Phase 2: Status - Completed (in 2014) 65 | 66 | ``` 67 | 1.) Fix Recovery HD boot support for Yosemite (status: Done). 68 | 69 | 2.) Add missing Panic Dialog data for black mode (status: Done). 70 | 71 | 3.) Convert all Panic Dialog data from LZSS to LZVN (status: Done). 72 | ``` 73 | 74 | Phase 3: Status - TBD 75 | 76 | ``` 77 | 1.) Add Xcode compiler support. 78 | - It compiles without errors/warnings but you cannot boot with it. 79 | ``` 80 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 3.2_testing_{build} 2 | branches: 3 | only: 4 | - El-Capitan 5 | os: Visual Studio 2015 6 | configuration: 7 | - Release (Grey) 8 | - Release (Black) 9 | environment: 10 | PATH: '%PATH%;C:\Program Files (x86)\nasm' 11 | install: 12 | - cmd: >- 13 | curl -L -o nasminst.exe http://www.nasm.us/pub/nasm/releasebuilds/2.11.08/win32/nasm-2.11.08-installer.exe 14 | 15 | start /wait nasminst.exe /S 16 | before_build: 17 | - cmd: if not %APPVEYOR_REPO_NAME%==Piker-Alpha/macosxbootloader ( cd /d C:\projects\macosxbootloader && git remote add upstream https://github.com/Piker-Alpha/macosxbootloader.git && git fetch upstream ) 18 | build: 19 | project: src\boot.sln 20 | verbosity: normal 21 | after_build: 22 | - cmd: >- 23 | cd "%APPVEYOR_BUILD_FOLDER%\bin\x86" 24 | 25 | CertUtil -hashfile "%CONFIGURATION%\boot.efi" MD5 > "%CONFIGURATION%\md5.txt" 26 | 27 | if "%CONFIGURATION%"=="Release (Grey)" (set CONFIG=grey) 28 | 29 | if "%CONFIGURATION%"=="Release (Black)" (set CONFIG=black) 30 | 31 | 7z a "%APPVEYOR_PROJECT_NAME%_%CONFIG%_%APPVEYOR_BUILD_ID%.zip" "%CONFIGURATION%\boot.efi" 32 | 33 | 7z a "%APPVEYOR_PROJECT_NAME%_%CONFIG%_%APPVEYOR_BUILD_ID%.zip" "%CONFIGURATION%\md5.txt" 34 | 35 | appveyor PushArtifact "macosxbootloader_%CONFIG%_%APPVEYOR_BUILD_ID%.zip" -------------------------------------------------------------------------------- /donate_button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Piker-Alpha/macosxbootloader/1abba11e3b792dd29c2a08c410c122efd1d19e98/donate_button.gif -------------------------------------------------------------------------------- /sdk/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 19 4 | /svn/!svn/ver/1/sdk 5 | END 6 | -------------------------------------------------------------------------------- /sdk/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 1 5 | https://macosxbootloader.googlecode.com/svn/sdk 6 | https://macosxbootloader.googlecode.com/svn 7 | 8 | 9 | 10 | 2013-11-23T07:22:04.508330Z 11 | 1 12 | tiamo@live.com 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 77e3e3b4-2d2d-10aa-ff73-3d8148760a43 28 | 29 | include 30 | dir 31 | 32 | -------------------------------------------------------------------------------- /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/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 { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } 30 | 31 | #define EFI_ACPI_20_TABLE_GUID { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} } 32 | 33 | #define EFI_ACPI_30_TABLE_GUID EFI_ACPI_20_TABLE_GUID 34 | 35 | extern EFI_GUID gEfiAcpiTableGuid; 36 | extern EFI_GUID gEfiAcpi20TableGuid; 37 | extern EFI_GUID gEfiAcpi30TableGuid; 38 | #endif 39 | -------------------------------------------------------------------------------- /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 { 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } 30 | 31 | extern EFI_GUID gEfiSmbiosTableGuid; 32 | 33 | // 34 | // Smbios Table Entry Point Structure 35 | // 36 | #pragma pack(1) 37 | typedef struct { 38 | UINT8 AnchorString[4]; 39 | UINT8 EntryPointStructureChecksum; 40 | UINT8 EntryPointLength; 41 | UINT8 MajorVersion; 42 | UINT8 MinorVersion; 43 | UINT16 MaxStructureSize; 44 | UINT8 EntryPointRevision; 45 | UINT8 FormattedArea[5]; 46 | UINT8 IntermediateAnchorString[5]; 47 | UINT8 IntermediateChecksum; 48 | UINT16 TableLength; 49 | UINT32 TableAddress; 50 | UINT16 NumberOfSmbiosStructures; 51 | UINT8 SmbiosBcdRevision; 52 | } SMBIOS_TABLE_ENTRY_POINT; 53 | #pragma pack() 54 | // 55 | // The Smbios structure header 56 | // 57 | #pragma pack(1) 58 | typedef struct { 59 | 60 | UINT8 Type; 61 | UINT8 Length; 62 | UINT16 Handle; 63 | 64 | } SMBIOS_STRUCTURE; 65 | #pragma pack() 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /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 | typedef EFI_STATUS (EFIAPI* CONNECT_DISPLAY)(); 14 | typedef EFI_STATUS (EFIAPI* CONNECT_ALL)(); 15 | 16 | typedef struct _APPLE_DEVICE_CONTROL_PROTOCOL 17 | { 18 | UINTN Unknown0; 19 | CONNECT_DISPLAY ConnectDisplay; 20 | UINTN Unknown2; 21 | CONNECT_ALL ConnectAll; 22 | }APPLE_DEVICE_CONTROL_PROTOCOL; 23 | 24 | extern EFI_GUID gAppleDeviceControlProtocolGuid; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /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 | struct _APPLE_DEVICE_PROPERTY_PROTOCOL { 18 | UINT64 Signature; 19 | UINTN Unknown[3]; 20 | GET_DEVICE_PROPERTY GetDeviceProperty; 21 | }; 22 | 23 | extern EFI_GUID gAppleDevicePropertyProtocolGuid; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /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 | struct _APPLE_DISK_IO_PROTOCOL 19 | { 20 | APPLE_DISK_READ ReadDisk; 21 | APPLE_DISK_FLUSH Flush; 22 | }; 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 | struct _APPLE_FIRMWARE_PASSWORD_PROTOCOL 18 | { 19 | UINT64 Signature; 20 | UINTN Unknown[3]; 21 | CHECK Check; 22 | }; 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 | struct _APPLE_GRAPH_CONFIG_PROTOCOL 18 | { 19 | UINTN Unknown0; 20 | RESTORE_CONFIG RestoreConfig; 21 | }; 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 | struct _APPLE_GRAPH_INFO_PROTOCOL 18 | { 19 | GET_INFO GetInfo; 20 | }; 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 | typedef EFI_STATUS (EFIAPI* RECOGNIZE_IMAGE_DATA)(VOID* ImageBuffer, UINTN ImageSize); 14 | typedef EFI_STATUS (EFIAPI* GET_IMAGE_DIMS)(VOID* ImageBuffer, UINTN ImageSize, UINTN* ImageWidth, UINTN* ImageHeight); 15 | typedef EFI_STATUS (EFIAPI* DECODE_IMAGE_DATA)(VOID* ImageBuffer, UINTN ImageSize, EFI_UGA_PIXEL** RawImageData, UINTN* RawImageDataSize); 16 | 17 | typedef struct _APPLE_IMAGE_CODEC_PROTOCOL 18 | { 19 | UINT64 Version; 20 | UINTN FileExt; 21 | RECOGNIZE_IMAGE_DATA RecognizeImageData; 22 | GET_IMAGE_DIMS GetImageDims; 23 | DECODE_IMAGE_DATA DecodeImageData; 24 | } APPLE_IMAGE_CODEC_PROTOCOL; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /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 | struct _APPLE_NET_BOOT_PROTOCOL 19 | { 20 | GET_DHCP_RESPONSE GetDhcpResponse; 21 | GET_BSDP_RESPONSE GetBsdpResponse; 22 | }; 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 | struct _APPLE_SMC_PROTOCOL 18 | { 19 | UINT64 Signature; 20 | APPLE_SMC_READ_DATA ReadData; 21 | }; 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/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 { 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } 34 | 35 | #pragma pack(push, 1) 36 | 37 | typedef struct { 38 | UINT8 Type; 39 | UINT8 SubType; 40 | UINT8 Length[2]; 41 | } EFI_DEVICE_PATH_PROTOCOL; 42 | 43 | #pragma pack(pop) 44 | 45 | #define EFI_END_ENTIRE_DEVICE_PATH 0xff 46 | #define EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff 47 | #define EFI_END_INSTANCE_DEVICE_PATH 0x01 48 | #define EFI_END_DEVICE_PATH_LENGTH (sizeof (EFI_DEVICE_PATH_PROTOCOL)) 49 | 50 | #define EfiDevicePathNodeLength(a) (((a)->Length[0]) | ((a)->Length[1] << 8)) 51 | #define EfiNextDevicePathNode(a) ((EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) (a)) + EfiDevicePathNodeLength (a))) 52 | 53 | #define EfiDevicePathType(a) (((a)->Type) & 0x7f) 54 | #define EfiIsDevicePathEndType(a) (EfiDevicePathType (a) == 0x7f) 55 | 56 | #define EfiIsDevicePathEndSubType(a) ((a)->SubType == EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE) 57 | #define EfiIsDevicePathEndInstanceSubType(a) ((a)->SubType == EFI_END_INSTANCE_DEVICE_PATH) 58 | 59 | #define EfiIsDevicePathEnd(a) (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndSubType (a)) 60 | #define EfiIsDevicePathEndInstance(a) (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndInstanceSubType (a)) 61 | 62 | extern EFI_GUID gEfiDevicePathProtocolGuid; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /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 { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } 32 | 33 | typedef struct { 34 | UINT64 Size; 35 | UINT64 FileSize; 36 | UINT64 PhysicalSize; 37 | EFI_TIME CreateTime; 38 | EFI_TIME LastAccessTime; 39 | EFI_TIME ModificationTime; 40 | UINT64 Attribute; 41 | CHAR16 FileName[1]; 42 | } EFI_FILE_INFO; 43 | 44 | // 45 | // The FileName field of the EFI_FILE_INFO data structure is variable length. 46 | // Whenever code needs to know the size of the EFI_FILE_INFO data structure, it needs to 47 | // be the size of the data structure without the FileName field. The following macro 48 | // computes this size correctly no matter how big the FileName array is declared. 49 | // This is required to make the EFI_FILE_INFO data structure ANSI compilant. 50 | // 51 | #define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET (EFI_FILE_INFO, FileName) 52 | 53 | extern EFI_GUID gEfiFileInfoGuid; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /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 { 0x7aa35a69, 0x506c, 0x444f, {0xa7, 0xaf, 0x69, 0x4b, 0xf5, 0x6f, 0x71, 0xc8} } 30 | 31 | 32 | extern EFI_GUID gEfiFirmwareVolumeDispatchProtocolGuid; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /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 { 0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} } 32 | 33 | EFI_FORWARD_DECLARATION (EFI_LOAD_FILE_PROTOCOL); 34 | 35 | typedef 36 | EFI_STATUS 37 | (EFIAPI *EFI_LOAD_FILE) ( 38 | IN EFI_LOAD_FILE_PROTOCOL * This, 39 | IN EFI_DEVICE_PATH_PROTOCOL * FilePath, 40 | IN BOOLEAN BootPolicy, 41 | IN OUT UINTN *BufferSize, 42 | IN VOID *Buffer OPTIONAL 43 | ) 44 | /*++ 45 | 46 | Routine Description: 47 | Causes the driver to load a specified file. 48 | 49 | Arguments: 50 | This - Protocol instance pointer. 51 | FilePath - The device specific path of the file to load. 52 | BootPolicy - If TRUE, indicates that the request originates from the 53 | boot manager is attempting to load FilePath as a boot 54 | selection. If FALSE, then FilePath must match as exact file 55 | to be loaded. 56 | BufferSize - On input the size of Buffer in bytes. On output with a return 57 | code of EFI_SUCCESS, the amount of data transferred to 58 | Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL, 59 | the size of Buffer required to retrieve the requested file. 60 | Buffer - The memory buffer to transfer the file to. IF Buffer is NULL, 61 | then no the size of the requested file is returned in 62 | BufferSize. 63 | 64 | Returns: 65 | EFI_SUCCESS - The file was loaded. 66 | EFI_UNSUPPORTED - The device does not support the provided BootPolicy 67 | EFI_INVALID_PARAMETER - FilePath is not a valid device path, or 68 | BufferSize is NULL. 69 | EFI_NO_MEDIA - No medium was present to load the file. 70 | EFI_DEVICE_ERROR - The file was not loaded due to a device error. 71 | EFI_NO_RESPONSE - The remote system did not respond. 72 | EFI_NOT_FOUND - The file was not found 73 | EFI_ABORTED - The file load process was manually cancelled. 74 | 75 | --*/ 76 | ; 77 | 78 | typedef struct _EFI_LOAD_FILE_PROTOCOL { 79 | EFI_LOAD_FILE LoadFile; 80 | } EFI_LOAD_FILE_PROTOCOL; 81 | 82 | extern EFI_GUID gEfiLoadFileProtocolGuid; 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /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 { 0x5B1B31A1, 0x9562, 0x11d2,{0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} } 29 | 30 | // 31 | // EFI_SYSTEM_TABLE & EFI_IMAGE_UNLOAD are defined in EfiApi.h 32 | // 33 | #define EFI_LOADED_IMAGE_INFORMATION_REVISION 0x1000 34 | 35 | typedef struct { 36 | UINT32 Revision; 37 | EFI_HANDLE ParentHandle; 38 | EFI_SYSTEM_TABLE *SystemTable; 39 | 40 | // 41 | // Source location of image 42 | // 43 | EFI_HANDLE DeviceHandle; 44 | EFI_DEVICE_PATH_PROTOCOL *FilePath; 45 | VOID *Reserved; 46 | 47 | // 48 | // Images load options 49 | // 50 | UINT32 LoadOptionsSize; 51 | VOID *LoadOptions; 52 | 53 | // 54 | // Location of where image was loaded 55 | // 56 | VOID *ImageBase; 57 | UINT64 ImageSize; 58 | EFI_MEMORY_TYPE ImageCodeType; 59 | EFI_MEMORY_TYPE ImageDataType; 60 | 61 | // 62 | // If the driver image supports a dynamic unload request 63 | // 64 | EFI_IMAGE_UNLOAD Unload; 65 | 66 | } EFI_LOADED_IMAGE_PROTOCOL; 67 | 68 | extern EFI_GUID gEfiLoadedImageProtocolGuid; 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /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 { 0x31878c87, 0xb75, 0x11d5, {0x9a, 0x4f, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } 28 | 29 | EFI_FORWARD_DECLARATION (EFI_SIMPLE_POINTER_PROTOCOL); 30 | 31 | // 32 | // Data structures 33 | // 34 | typedef struct { 35 | INT32 RelativeMovementX; 36 | INT32 RelativeMovementY; 37 | INT32 RelativeMovementZ; 38 | BOOLEAN LeftButton; 39 | BOOLEAN RightButton; 40 | } EFI_SIMPLE_POINTER_STATE; 41 | 42 | typedef struct { 43 | UINT64 ResolutionX; 44 | UINT64 ResolutionY; 45 | UINT64 ResolutionZ; 46 | BOOLEAN LeftButton; 47 | BOOLEAN RightButton; 48 | } EFI_SIMPLE_POINTER_MODE; 49 | 50 | typedef 51 | EFI_STATUS 52 | (EFIAPI *EFI_SIMPLE_POINTER_RESET) ( 53 | IN EFI_SIMPLE_POINTER_PROTOCOL * This, 54 | IN BOOLEAN ExtendedVerification 55 | ); 56 | 57 | typedef 58 | EFI_STATUS 59 | (EFIAPI *EFI_SIMPLE_POINTER_GET_STATE) ( 60 | IN EFI_SIMPLE_POINTER_PROTOCOL * This, 61 | IN OUT EFI_SIMPLE_POINTER_STATE * State 62 | ); 63 | 64 | typedef struct _EFI_SIMPLE_POINTER_PROTOCOL { 65 | EFI_SIMPLE_POINTER_RESET Reset; 66 | EFI_SIMPLE_POINTER_GET_STATE GetState; 67 | EFI_EVENT WaitForInput; 68 | EFI_SIMPLE_POINTER_MODE *Mode; 69 | } EFI_SIMPLE_POINTER_PROTOCOL; 70 | 71 | extern EFI_GUID gEfiSimplePointerProtocolGuid; 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /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/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 19 4 | /svn/!svn/ver/1/src 5 | END 6 | release.props 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 33 10 | /svn/!svn/ver/1/src/release.props 11 | END 12 | debug.props 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 31 16 | /svn/!svn/ver/1/src/debug.props 17 | END 18 | common.props 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 32 22 | /svn/!svn/ver/1/src/common.props 23 | END 24 | boot.sln 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 28 28 | /svn/!svn/ver/1/src/boot.sln 29 | END 30 | -------------------------------------------------------------------------------- /src/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 1 5 | https://macosxbootloader.googlecode.com/svn/src 6 | https://macosxbootloader.googlecode.com/svn 7 | 8 | 9 | 10 | 2013-11-23T07:22:04.508330Z 11 | 1 12 | tiamo@live.com 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 77e3e3b4-2d2d-10aa-ff73-3d8148760a43 28 | 29 | release.props 30 | file 31 | 32 | 33 | 34 | 35 | 2014-09-30T16:03:33.000000Z 36 | eb279e1138286854fcc91b98ce7109fa 37 | 2013-11-23T07:22:04.508330Z 38 | 1 39 | tiamo@live.com 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 593 62 | 63 | boot 64 | dir 65 | 66 | rijndael 67 | dir 68 | 69 | debug.props 70 | file 71 | 72 | 73 | 74 | 75 | 2014-09-30T16:03:33.000000Z 76 | 9e67a21ef6e1678ab9e90ad46058751a 77 | 2013-11-23T07:22:04.508330Z 78 | 1 79 | tiamo@live.com 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 537 102 | 103 | common.props 104 | file 105 | 106 | 107 | 108 | 109 | 2014-09-30T16:03:33.000000Z 110 | 779299396b2f8248fa132a5be62e7ca3 111 | 2013-11-23T07:22:04.508330Z 112 | 1 113 | tiamo@live.com 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 1987 136 | 137 | boot.sln 138 | file 139 | 140 | 141 | 142 | 143 | 2014-09-30T16:03:33.000000Z 144 | d089d7afe0ee6643677d9f5e0e733720 145 | 2013-11-23T07:22:04.508330Z 146 | 1 147 | tiamo@live.com 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 2539 170 | 171 | -------------------------------------------------------------------------------- /src/.svn/text-base/boot.sln.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/common.props.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/debug.props.svn-base: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | _DEBUG;DEBUG;%(PreprocessorDefinitions) 9 | MultiThreadedDebugDLL 10 | Disabled 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/.svn/text-base/release.props.svn-base: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | NDEBUG;%(PreprocessorDefinitions) 8 | MultiThreadedDLL 9 | 10 | 11 | true 12 | true 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/boot/.svn/text-base/AcpiUtils.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/ArchUtils.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/Base64.cpp.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/Base64.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/BootDebugger.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/Config.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/Console.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/Crc32.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/Debug1394.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/DebugUsb.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/DevicePath.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/DeviceTree.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/FileIo.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/FileVault.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/GuidDefine.cpp.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/Hibernate.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/LoadDrivers.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/LoadKernel.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/MD5.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/MachO.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/Memory.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/MemoryMap.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/MiscUtils.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/NetBoot.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/Options.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/PanicDialog.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/PeImage.cpp.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/PeImage.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/PlatformExpert.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/RuntimeLib.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/SHA256.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/StdAfx.cpp.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/StdAfx.h.svn-base: -------------------------------------------------------------------------------- 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/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); 34 | 35 | // 36 | // checksum8 from AppleSMBIOS.kext 37 | // 38 | UINT8 Checksum8(VOID * start, unsigned int length); -------------------------------------------------------------------------------- /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/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 | 10 | EFI_GUID EfiDataHubProtocolGuid = EFI_DATA_HUB_PROTOCOL_GUID; 11 | EFI_GUID EfiAcpi20TableGuid = EFI_ACPI_20_TABLE_GUID; 12 | EFI_GUID EfiAcpiTableGuid = EFI_ACPI_TABLE_GUID; 13 | EFI_GUID EfiLoadedImageProtocolGuid = EFI_LOADED_IMAGE_PROTOCOL_GUID; 14 | EFI_GUID EfiPciIoProtocolGuid = EFI_PCI_IO_PROTOCOL_GUID; 15 | EFI_GUID EfiSmbiosTableGuid = EFI_SMBIOS_TABLE_GUID; 16 | EFI_GUID EfiConsoleControlProtocolGuid = EFI_CONSOLE_CONTROL_PROTOCOL_GUID; 17 | EFI_GUID EfiSimpleFileSystemProtocolGuid = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID; 18 | EFI_GUID EfiDevicePathProtocolGuid = EFI_DEVICE_PATH_PROTOCOL_GUID; 19 | EFI_GUID EfiBlockIoProtocolGuid = EFI_BLOCK_IO_PROTOCOL_GUID; 20 | EFI_GUID EfiDiskIoProtocolGuid = EFI_DISK_IO_PROTOCOL_GUID; 21 | EFI_GUID EfiGraphicsOutputProtocolGuid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; 22 | EFI_GUID EfiUgaDrawProtocolGuid = EFI_UGA_DRAW_PROTOCOL_GUID; 23 | EFI_GUID EfiFileInfoGuid = EFI_FILE_INFO_ID; 24 | EFI_GUID EfiLoadFileProtocolGuid = LOAD_FILE_PROTOCOL_GUID; 25 | EFI_GUID EfiFirmwareVolumeProtocolGuid = EFI_FIRMWARE_VOLUME_PROTOCOL_GUID; 26 | EFI_GUID EfiFirmwareVolumeDispatchProtocolGuid = EFI_FIRMWARE_VOLUME_DISPATCH_PROTOCOL_GUID; 27 | EFI_GUID EfiDevicePathMessagingSASGuid = DEVICE_PATH_MESSAGING_SAS; 28 | EFI_GUID EfiSimplePointerProtocolGuid = EFI_SIMPLE_POINTER_PROTOCOL_GUID; 29 | EFI_GUID AppleKeyStateProtocolGuid = APPLE_KEY_STATE_PROTOCOL_GUID; 30 | EFI_GUID AppleNVRAMVariableGuid = APPLE_NVRAM_VARIABLE_GUID; 31 | EFI_GUID AppleFirmwareVariableGuid = APPLE_FIRMWARE_VARIABLE_GUID; 32 | EFI_GUID AppleAcpiVariableGuid = APPLE_ACPI_VARIABLE_GUID; 33 | EFI_GUID AppleSystemInfoProducerNameGuid = APPLE_SYSTEM_INFO_PRODUCER_NAME_GUID; 34 | EFI_GUID AppleDevicePropertyProtocolGuid = APPLE_DEVICE_PROPERTY_PROTOCOL_GUID; 35 | EFI_GUID AppleNetBootProtocolGuid = APPLE_NET_BOOT_PROTOCOL_GUID; 36 | EFI_GUID ApplePasswordUIEfiFileNameGuid = APPLE_PASSWORD_UI_EFI_FILE_NAME_GUID; 37 | EFI_GUID AppleFirmwarePasswordProtocolGuid = APPLE_FIRMWARE_PASSWORD_PROTOCOL_GUID; 38 | EFI_GUID AppleDeviceControlProtocolGuid = APPLE_DEVICE_CONTROL_PROTOCOL_GUID; 39 | EFI_GUID AppleGraphConfigProtocolGuid = APPLE_GRAPH_CONFIG_PROTOCOL_GUID; 40 | EFI_GUID AppleGraphInfoProtocolGuid = APPLE_GRAPH_INFO_PROTOCOL_GUID; 41 | EFI_GUID AppleRamDmgDevicePathGuid = APPLE_RAM_DMG_DEVICE_PATH_GUID; 42 | EFI_GUID AppleImageCodecProtocolGuid = APPLE_IMAGE_CODEC_PROTOCOL_GUID; 43 | EFI_GUID AppleDiskIoProtocolGuid = APPLE_DISK_IO_PROTOCOL_GUID; 44 | EFI_GUID AppleSMCProtocolGuid = APPLE_SMC_PROTOCOL_GUID; 45 | EFI_GUID AppleFileVaultVariableGuid = APPLE_FILE_VAULT_VARIABLE_GUID; 46 | 47 | EFI_SYSTEM_TABLE* EfiSystemTable = nullptr; 48 | EFI_BOOT_SERVICES* EfiBootServices = nullptr; 49 | EFI_RUNTIME_SERVICES* EfiRuntimeServices = nullptr; 50 | EFI_HANDLE EfiImageHandle = nullptr; 51 | 52 | // 53 | // Check for NULL guid. 54 | // 55 | 56 | BOOLEAN isEfiNullGuid(EFI_GUID* aGuid) 57 | { 58 | UINT32 *guid = (UINT32 *) aGuid; 59 | 60 | if ((guid[0] == 0) && (guid[1] == 0) && (guid[2] == 0) && (guid[3] == 0)) 61 | { 62 | return TRUE; 63 | } 64 | 65 | return FALSE; 66 | } 67 | -------------------------------------------------------------------------------- /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 | // __TEXT segment size. 22 | // 23 | UINT64 TextSegmentFileSize; 24 | 25 | // 26 | // Image base virtual address. 27 | // 28 | UINT64 ImageBaseVirtualAddress; 29 | 30 | // 31 | // Miniman physical address. 32 | // 33 | UINT64 MinPhysicalAddress; 34 | 35 | // 36 | // Maximum physical address. 37 | // 38 | UINT64 MaxPhysicalAddress; 39 | 40 | // 41 | // Entry point physical address. 42 | // 43 | UINT64 EntryPointPhysicalAddress; 44 | 45 | // 46 | // Minimum virtual address. 47 | // 48 | UINT64 MinVirtualAddress; 49 | 50 | // 51 | // Max virtual address. 52 | // 53 | UINT64 MaxVirtualAddress; 54 | 55 | // 56 | // Entry point virtual address. 57 | // 58 | UINT64 EntryPointVirtualAddress; 59 | 60 | // 61 | // Arch type. 62 | // 63 | UINT32 ArchType; 64 | 65 | // 66 | // 67 | // 68 | UINT64 IdlePML4VirtualAddress; 69 | }MACH_O_LOADED_INFO; 70 | 71 | // 72 | // get thin fat info 73 | // 74 | EFI_STATUS MachLoadThinFatFile(IO_FILE_HANDLE* fileHandle, UINT64* offsetInFile, UINTN* dataSize); 75 | 76 | // 77 | // load mach-o 78 | // 79 | EFI_STATUS MachLoadMachO(IO_FILE_HANDLE* fileHandle, MACH_O_LOADED_INFO* loadedInfo); 80 | 81 | // 82 | // get symbol virtual address by name 83 | // 84 | 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/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 | #define BOOT_MODE_FLUSH_CACHES 0x020000 30 | #define BOOT_MODE_IS_INSTALLER 0x040000 31 | 32 | // 33 | // detect hot key 34 | // 35 | EFI_STATUS BlDetectHotKey(); 36 | 37 | // 38 | // process option 39 | // 40 | EFI_STATUS BlProcessOptions(CHAR8 CONST* bootCommandLine, CHAR8** kernelCommandLine, EFI_DEVICE_PATH_PROTOCOL* bootDevicePath, EFI_DEVICE_PATH_PROTOCOL* bootFilePath); 41 | 42 | // 43 | // test boot mode 44 | // 45 | UINT32 BlTestBootMode(UINT32 bootMode); 46 | 47 | // 48 | // set boot mode 49 | // 50 | VOID BlSetBootMode(UINT32 setValue, UINT32 clearValue); 51 | 52 | // 53 | // setup kernel command line 54 | // 55 | 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/x64/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 28 4 | /svn/!svn/ver/1/src/boot/x64 5 | END 6 | PortRegisterIo.asm 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 47 10 | /svn/!svn/ver/1/src/boot/x64/PortRegisterIo.asm 11 | END 12 | Common.inc 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 39 16 | /svn/!svn/ver/1/src/boot/x64/Common.inc 17 | END 18 | ArchUtilsX64.cpp 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 45 22 | /svn/!svn/ver/1/src/boot/x64/ArchUtilsX64.cpp 23 | END 24 | DebuggerUtilsX64.cpp 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 49 28 | /svn/!svn/ver/1/src/boot/x64/DebuggerUtilsX64.cpp 29 | END 30 | TransferRoutine.asm 31 | K 25 32 | svn:wc:ra_dav:version-url 33 | V 48 34 | /svn/!svn/ver/1/src/boot/x64/TransferRoutine.asm 35 | END 36 | CompilerX64.asm 37 | K 25 38 | svn:wc:ra_dav:version-url 39 | V 44 40 | /svn/!svn/ver/1/src/boot/x64/CompilerX64.asm 41 | END 42 | DebugTrap.asm 43 | K 25 44 | svn:wc:ra_dav:version-url 45 | V 42 46 | /svn/!svn/ver/1/src/boot/x64/DebugTrap.asm 47 | END 48 | ArchDefine.h 49 | K 25 50 | svn:wc:ra_dav:version-url 51 | V 41 52 | /svn/!svn/ver/1/src/boot/x64/ArchDefine.h 53 | END 54 | -------------------------------------------------------------------------------- /src/boot/x64/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 1 5 | https://macosxbootloader.googlecode.com/svn/src/boot/x64 6 | https://macosxbootloader.googlecode.com/svn 7 | 8 | 9 | 10 | 2013-11-23T07:22:04.508330Z 11 | 1 12 | tiamo@live.com 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 77e3e3b4-2d2d-10aa-ff73-3d8148760a43 28 | 29 | PortRegisterIo.asm 30 | file 31 | 32 | 33 | 34 | 35 | 2014-09-30T16:03:33.000000Z 36 | c8e5d8ca54cb78e65866aa75376ee307 37 | 2013-11-23T07:22:04.508330Z 38 | 1 39 | tiamo@live.com 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 1863 62 | 63 | Common.inc 64 | file 65 | 66 | 67 | 68 | 69 | 2014-09-30T16:03:33.000000Z 70 | 0e8d2e97ab9773c0f31883d78b8ab79a 71 | 2013-11-23T07:22:04.508330Z 72 | 1 73 | tiamo@live.com 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 3654 96 | 97 | ArchUtilsX64.cpp 98 | file 99 | 100 | 101 | 102 | 103 | 2014-09-30T16:03:33.000000Z 104 | 7a69a8d3f775994973ab98b255dea580 105 | 2013-11-23T07:22:04.508330Z 106 | 1 107 | tiamo@live.com 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 2579 130 | 131 | DebuggerUtilsX64.cpp 132 | file 133 | 134 | 135 | 136 | 137 | 2014-09-30T16:03:33.000000Z 138 | 00320150078f23d734caa9c0d7545305 139 | 2013-11-23T07:22:04.508330Z 140 | 1 141 | tiamo@live.com 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 13589 164 | 165 | TransferRoutine.asm 166 | file 167 | 168 | 169 | 170 | 171 | 2014-09-30T16:03:33.000000Z 172 | 1dfc031eb71168757ce54d50929a4553 173 | 2013-11-23T07:22:04.508330Z 174 | 1 175 | tiamo@live.com 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 1471 198 | 199 | CompilerX64.asm 200 | file 201 | 202 | 203 | 204 | 205 | 2014-09-30T16:03:33.000000Z 206 | ed9e57de43a26c1fd29c6fda2c0ede72 207 | 2013-11-23T07:22:04.508330Z 208 | 1 209 | tiamo@live.com 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 3605 232 | 233 | DebugTrap.asm 234 | file 235 | 236 | 237 | 238 | 239 | 2014-09-30T16:03:33.000000Z 240 | b7a5904a65a58ea290af9eacf5277405 241 | 2013-11-23T07:22:04.508330Z 242 | 1 243 | tiamo@live.com 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 8105 266 | 267 | ArchDefine.h 268 | file 269 | 270 | 271 | 272 | 273 | 2014-09-30T16:03:33.000000Z 274 | f347814d40b8f180bbd8f523199c3cca 275 | 2013-11-23T07:22:04.508330Z 276 | 1 277 | tiamo@live.com 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 19268 300 | 301 | -------------------------------------------------------------------------------- /src/boot/x64/.svn/text-base/ArchUtilsX64.cpp.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/PortRegisterIo.asm.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/TransferRoutine.asm.svn-base: -------------------------------------------------------------------------------- 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/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/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/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 28 4 | /svn/!svn/ver/1/src/boot/x86 5 | END 6 | CompilerX86.cpp 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 44 10 | /svn/!svn/ver/1/src/boot/x86/CompilerX86.cpp 11 | END 12 | Thunk64.cpp 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 40 16 | /svn/!svn/ver/1/src/boot/x86/Thunk64.cpp 17 | END 18 | ArchUtilsX86.cpp 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 45 22 | /svn/!svn/ver/1/src/boot/x86/ArchUtilsX86.cpp 23 | END 24 | ThunkCode32.asm 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 44 28 | /svn/!svn/ver/1/src/boot/x86/ThunkCode32.asm 29 | END 30 | DebuggerUtilsX86.cpp 31 | K 25 32 | svn:wc:ra_dav:version-url 33 | V 49 34 | /svn/!svn/ver/1/src/boot/x86/DebuggerUtilsX86.cpp 35 | END 36 | ThunkCode64.asm 37 | K 25 38 | svn:wc:ra_dav:version-url 39 | V 44 40 | /svn/!svn/ver/1/src/boot/x86/ThunkCode64.asm 41 | END 42 | ArchDefine.h 43 | K 25 44 | svn:wc:ra_dav:version-url 45 | V 41 46 | /svn/!svn/ver/1/src/boot/x86/ArchDefine.h 47 | END 48 | -------------------------------------------------------------------------------- /src/boot/x86/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 1 5 | https://macosxbootloader.googlecode.com/svn/src/boot/x86 6 | https://macosxbootloader.googlecode.com/svn 7 | 8 | 9 | 10 | 2013-11-23T07:22:04.508330Z 11 | 1 12 | tiamo@live.com 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 77e3e3b4-2d2d-10aa-ff73-3d8148760a43 28 | 29 | CompilerX86.cpp 30 | file 31 | 32 | 33 | 34 | 35 | 2014-09-30T16:03:33.000000Z 36 | 5f280f45f65da8f6b7002b1b63995c8c 37 | 2013-11-23T07:22:04.508330Z 38 | 1 39 | tiamo@live.com 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 11559 62 | 63 | Thunk64.cpp 64 | file 65 | 66 | 67 | 68 | 69 | 2014-09-30T16:03:33.000000Z 70 | 748e1c48e31ac92ae96d278559e36799 71 | 2013-11-23T07:22:04.508330Z 72 | 1 73 | tiamo@live.com 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 10492 96 | 97 | ArchUtilsX86.cpp 98 | file 99 | 100 | 101 | 102 | 103 | 2014-09-30T16:03:33.000000Z 104 | d44b167004d24892cbc8b42c4fcf5384 105 | 2013-11-23T07:22:04.508330Z 106 | 1 107 | tiamo@live.com 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 5648 130 | 131 | ThunkCode32.asm 132 | file 133 | 134 | 135 | 136 | 137 | 2014-09-30T16:03:33.000000Z 138 | 670fde60f26e7681b1bfa54efc3097cd 139 | 2013-11-23T07:22:04.508330Z 140 | 1 141 | tiamo@live.com 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 472 164 | 165 | DebuggerUtilsX86.cpp 166 | file 167 | 168 | 169 | 170 | 171 | 2014-09-30T16:03:33.000000Z 172 | f1dd619ba41d3156d6bb033d4c558b8c 173 | 2013-11-23T07:22:04.508330Z 174 | 1 175 | tiamo@live.com 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 21771 198 | 199 | ThunkCode64.asm 200 | file 201 | 202 | 203 | 204 | 205 | 2014-09-30T16:03:33.000000Z 206 | 51aede9ee3b8a182657193ea17a9205f 207 | 2013-11-23T07:22:04.508330Z 208 | 1 209 | tiamo@live.com 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 11217 232 | 233 | ArchDefine.h 234 | file 235 | 236 | 237 | 238 | 239 | 2014-09-30T16:03:33.000000Z 240 | 177bcb9469cc37dbb06de84578744315 241 | 2013-11-23T07:22:04.508330Z 242 | 1 243 | tiamo@live.com 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 13172 266 | 267 | -------------------------------------------------------------------------------- /src/boot/x86/.svn/text-base/ThunkCode32.asm.svn-base: -------------------------------------------------------------------------------- 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/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/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 28 4 | /svn/!svn/ver/1/src/rijndael 5 | END 6 | aestab.c 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 37 10 | /svn/!svn/ver/1/src/rijndael/aestab.c 11 | END 12 | aes_modes.c 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 40 16 | /svn/!svn/ver/1/src/rijndael/aes_modes.c 17 | END 18 | aesopt.h 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 37 22 | /svn/!svn/ver/1/src/rijndael/aesopt.h 23 | END 24 | aeskey.c 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 37 28 | /svn/!svn/ver/1/src/rijndael/aeskey.c 29 | END 30 | rijndael.vcxproj 31 | K 25 32 | svn:wc:ra_dav:version-url 33 | V 45 34 | /svn/!svn/ver/1/src/rijndael/rijndael.vcxproj 35 | END 36 | brg_types.h 37 | K 25 38 | svn:wc:ra_dav:version-url 39 | V 40 40 | /svn/!svn/ver/1/src/rijndael/brg_types.h 41 | END 42 | aestab.h 43 | K 25 44 | svn:wc:ra_dav:version-url 45 | V 37 46 | /svn/!svn/ver/1/src/rijndael/aestab.h 47 | END 48 | aes_via_ace.h 49 | K 25 50 | svn:wc:ra_dav:version-url 51 | V 42 52 | /svn/!svn/ver/1/src/rijndael/aes_via_ace.h 53 | END 54 | aesxts.c 55 | K 25 56 | svn:wc:ra_dav:version-url 57 | V 37 58 | /svn/!svn/ver/1/src/rijndael/aesxts.c 59 | END 60 | rijndael.vcxproj.filters 61 | K 25 62 | svn:wc:ra_dav:version-url 63 | V 53 64 | /svn/!svn/ver/1/src/rijndael/rijndael.vcxproj.filters 65 | END 66 | aescrypt.c 67 | K 25 68 | svn:wc:ra_dav:version-url 69 | V 39 70 | /svn/!svn/ver/1/src/rijndael/aescrypt.c 71 | END 72 | aesxts.h 73 | K 25 74 | svn:wc:ra_dav:version-url 75 | V 37 76 | /svn/!svn/ver/1/src/rijndael/aesxts.h 77 | END 78 | aes.h 79 | K 25 80 | svn:wc:ra_dav:version-url 81 | V 34 82 | /svn/!svn/ver/1/src/rijndael/aes.h 83 | END 84 | brg_endian.h 85 | K 25 86 | svn:wc:ra_dav:version-url 87 | V 41 88 | /svn/!svn/ver/1/src/rijndael/brg_endian.h 89 | END 90 | -------------------------------------------------------------------------------- /src/rijndael/.svn/text-base/aesxts.h.svn-base: -------------------------------------------------------------------------------- 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/.svn/text-base/rijndael.vcxproj.filters.svn-base: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /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/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 | --------------------------------------------------------------------------------