Changeset 82107 in vbox
- Timestamp:
- Nov 22, 2019 6:32:44 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 134916
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware/UefiCpuPkg/CpuDxe/CpuGdt.c
r81821 r82107 128 128 IA32_DESCRIPTOR gdtPtr; 129 129 130 #ifndef VBOX131 130 // 132 131 // Allocate Runtime Data for the GDT 133 132 // 133 #ifndef VBOX 134 134 gdt = AllocateRuntimePool (sizeof (GdtTemplate) + 8); 135 #else 136 /* 137 * Apples bootloader boot.efi for at least OS X Tiger, Leopard and Snow Leopard 138 * relocates runtime regions which doesn't make sense for the GDT as the GDTR is not 139 * updated and would point to invalid memory. Allocate the memory as reserved to hopefully 140 * keep the bootloaders hands off of it, see also OvmfPkg/PlatformPei/Platform.c 141 * (search for PeiServicesAllocatePages()) for a more detailed explanation of a 142 * related bug in Apples bootloader. 143 */ 144 gdt = AllocateReservedPool (sizeof (GdtTemplate) + 8); 145 #endif 135 146 ASSERT (gdt != NULL); 136 147 gdt = ALIGN_POINTER (gdt, 8); 137 #else138 /*139 * With previous versions of the EDK2 changing AllocateRuntimePool to AllocateReservedPool140 * was enough to get earlier mac OS versions (Tiger up until at least Snow Leopard) not overwriting the GDT141 * when freeing not required EFI memory ranges anymore.142 * With the current version however the memory map (memmap command in EFI shell) returned to boot.efi143 * will have the Runtime flag always cleared no matter what. boot.efi overwrites the memory and144 * the VM triple faults because of the invalid GDT.145 * Using the AllocatePages() method with EfiRuntimeServicesData works around that and the GDT memory146 * has the proper Runtime flag set so boot.efi will leave it alone.147 */148 EFI_STATUS Status;149 EFI_PHYSICAL_ADDRESS PhysicalAddress = SIZE_4GB - 1;150 Status = gBS->AllocatePages(AllocateMaxAddress,151 EfiRuntimeServicesData,152 1,153 &PhysicalAddress);154 ASSERT(!EFI_ERROR(Status));155 gdt = ALIGN_POINTER ((void *)(UINTN)PhysicalAddress, 8);156 #endif157 148 158 149 //
Note:
See TracChangeset
for help on using the changeset viewer.