1 /*++ 2 3 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR> 4 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 EfiLdr.c 14 15 Abstract: 16 17 Revision History: 18 19 --*/ 20 21 #ifndef _DUET_EFI_LOADER_H_ 22 #define _DUET_EFI_LOADER_H_ 23 24 #include "Uefi.h" 25 #include "EfiLdrHandoff.h" 26 27 #include <Protocol/LoadedImage.h> 28 #include <IndustryStandard/PeImage.h> 29 #include <Library/BaseLib.h> 30 #include <Library/BaseMemoryLib.h> 31 #include <Library/PrintLib.h> 32 #include <Library/SerialPortLib.h> 33 34 #define INT15_E820_AddressRangeMemory 1 35 #define INT15_E820_AddressRangeReserved 2 36 #define INT15_E820_AddressRangeACPI 3 37 #define INT15_E820_AddressRangeNVS 4 38 39 #define EFI_FIRMWARE_BASE_ADDRESS 0x00200000 40 41 #define EFI_DECOMPRESSED_BUFFER_ADDRESS 0x00600000 42 43 #define EFI_MAX_MEMORY_DESCRIPTORS 64 44 45 #define LOADED_IMAGE_SIGNATURE SIGNATURE_32('l','d','r','i') 46 47 typedef struct { 48 UINTN Signature; 49 CHAR16 *Name; // Displayable name 50 UINTN Type; 51 52 BOOLEAN Started; // If entrypoint has been called 53 VOID *StartImageContext; 54 55 EFI_IMAGE_ENTRY_POINT EntryPoint; // The image's entry point 56 EFI_LOADED_IMAGE_PROTOCOL Info; // loaded image protocol 57 58 // 59 EFI_PHYSICAL_ADDRESS ImageBasePage; // Location in memory 60 UINTN NoPages; // Number of pages 61 UINT8 *ImageBase; // As a char pointer 62 UINT8 *ImageEof; // End of memory image 63 64 // relocate info 65 UINT8 *ImageAdjust; // Bias for reloc calculations 66 UINTN StackAddress; 67 UINT8 *FixupData; // Original fixup data 68 } EFILDR_LOADED_IMAGE; 69 70 #pragma pack(4) 71 typedef struct { 72 UINT64 BaseAddress; 73 UINT64 Length; 74 UINT32 Type; 75 } BIOS_MEMORY_MAP_ENTRY; 76 #pragma pack() 77 78 typedef struct { 79 UINT32 MemoryMapSize; 80 BIOS_MEMORY_MAP_ENTRY MemoryMapEntry[1]; 81 } BIOS_MEMORY_MAP; 82 83 typedef 84 VOID 85 (EFIAPI * EFI_MAIN_ENTRYPOINT) ( 86 IN EFILDRHANDOFF *Handoff 87 ); 88 89 #endif //_DUET_EFI_LOADER_H_ 90