]>
Commit | Line | Data |
---|---|---|
ced216f8 HL |
1 | /** @file\r |
2 | *\r | |
3 | * Copyright (c) 2014, ARM Limited. All rights reserved.\r | |
4 | *\r | |
5 | * This program and the accompanying materials\r | |
6 | * are licensed and made available under the terms and conditions of the BSD License\r | |
7 | * which accompanies this distribution. The full text of the license may be found at\r | |
8 | * http://opensource.org/licenses/bsd-license.php\r | |
9 | *\r | |
10 | * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | *\r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef ELF_LOADER_H\r | |
16 | #define ELF_LOADER_H\r | |
17 | \r | |
18 | /**\r | |
19 | Check that the ELF File Header is valid and Machine type supported.\r | |
20 | \r | |
21 | Not all information is checked in the ELF header, only the stuff that\r | |
22 | matters to us in our simplified ELF loader.\r | |
23 | \r | |
24 | @param[in] ElfImage Address of the ELF file to check.\r | |
25 | \r | |
26 | @retval EFI_SUCCESS on success.\r | |
27 | @retval EFI_INVALID_PARAMETER if the header is invalid.\r | |
28 | @retval EFI_UNSUPPORTED if the file type/platform is not supported.\r | |
29 | **/\r | |
30 | EFI_STATUS\r | |
31 | ElfCheckFile (\r | |
32 | IN CONST VOID *ElfImage\r | |
33 | );\r | |
34 | \r | |
35 | \r | |
36 | /**\r | |
37 | Load a ELF file.\r | |
38 | \r | |
39 | @param[in] ElfImage Address of the ELF file in memory.\r | |
40 | \r | |
41 | @param[out] EntryPoint Will be filled with the ELF entry point address.\r | |
42 | \r | |
43 | @param[out] ImageSize Will be filled with the ELF size in memory. This will\r | |
44 | effectively be equal to the sum of the segments sizes.\r | |
45 | \r | |
46 | This function assumes the header is valid and supported as checked with\r | |
47 | ElfCheckFile().\r | |
48 | \r | |
49 | NOTE:\r | |
50 | - We don't currently take the segment permissions into account (indicated by\r | |
51 | the program headers). It can be used to allocate pages with the right\r | |
52 | read/write/exec permissions.\r | |
53 | \r | |
54 | @retval EFI_SUCCESS on success.\r | |
55 | @retval EFI_INVALID_PARAMETER if the ELF file is invalid.\r | |
56 | **/\r | |
57 | EFI_STATUS\r | |
58 | ElfLoadFile (\r | |
59 | IN CONST VOID *ElfImage,\r | |
60 | OUT VOID **EntryPoint,\r | |
61 | OUT LIST_ENTRY *LoadList\r | |
62 | );\r | |
63 | \r | |
64 | #endif // ELF_LOADER_H\r |