| 91 | } |
| 92 | |
| 93 | VOID |
| 94 | Usage ( |
| 95 | void |
| 96 | ) |
| 97 | { |
| 98 | printf ("Usage: GenPage.exe [options] EfiLoaderImageName \n\n\ |
| 99 | Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.\n\n\ |
| 100 | Utility to generate the EfiLoader image containing a page table.\n\n\ |
| 101 | optional arguments:\n\ |
| 102 | -h, --help Show this help message and exit\n\ |
| 103 | --version Show program's version number and exit\n\ |
| 104 | -d [DEBUG], --debug [DEBUG]\n\ |
| 105 | Output DEBUG statements, where DEBUG_LEVEL is 0 (min)\n\ |
| 106 | - 9 (max)\n\ |
| 107 | -v, --verbose Print informational statements\n\ |
| 108 | -q, --quiet Returns the exit code, error messages will be\n\ |
| 109 | displayed\n\ |
| 110 | -s, --silent Returns only the exit code; informational and error\n\ |
| 111 | messages are not displayed\n\ |
| 112 | -o OUTPUT_FILENAME, --output OUTPUT_FILENAME\n\ |
| 113 | Output file contain both the non-page table part and\n\ |
| 114 | the page table\n\ |
| 115 | -b BASE_ADDRESS, --baseaddr BASE_ADDRESS\n\ |
| 116 | The page table location\n\ |
| 117 | -f OFFSET, --offset OFFSET\n\ |
| 118 | The position that the page table will appear in the\n\ |
| 119 | output file\n\ |
| 120 | --sfo Reserved for future use\n"); |
| 121 | |
| 122 | } |
| 123 | |
| 124 | void * |
| 125 | CreateIdentityMappingPageTables ( |
| 126 | void |
| 127 | ) |
| 128 | /*++ |
| 129 | |
| 130 | Routine Description: |
| 131 | To create 4G PAE 2M pagetable |
| 132 | |
| 133 | Return: |
| 134 | void * - buffer containing created pagetable |
| 135 | |
| 136 | --*/ |
| 137 | { |
| 138 | UINT64 PageAddress; |
| 139 | UINT8 *PageTable; |
| 140 | UINT8 *PageTablePtr; |
| 141 | int PML4Index; |
| 142 | int PDPTEIndex; |
| 143 | int PDEIndex; |
| 144 | X64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *PageMapLevel4Entry; |
| 145 | X64_PAGE_MAP_AND_DIRECTORY_POINTER_2MB_4K *PageDirectoryPointerEntry; |
| 146 | X64_PAGE_TABLE_ENTRY_2M *PageDirectoryEntry2MB; |
| 147 | |
| 148 | PageTable = (void *)malloc (EFI_PAGE_NUMBER * EFI_SIZE_OF_PAGE); |
| 149 | if (PageTable == NULL) { |
| 150 | Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!"); |
no test coverage detected