X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EdkModulePkg%2FUniversal%2FRuntime%2FRuntimeDxe%2FRuntime.c;h=61dbd9c1fc6c842338c7ff4b30a0fbcaa859669d;hp=5a21d4961ef35fbf431af5623b036393b8b9b5d3;hb=92ea7f231b3948395e6348ab6e38e3467eff7a3d;hpb=878ddf1fc3540a715f63594ed22b6929e881afb4 diff --git a/EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.c b/EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.c index 5a21d4961e..61dbd9c1fc 100644 --- a/EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.c +++ b/EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.c @@ -92,6 +92,9 @@ UINTN mVirtualMapMaxIndex; EFI_LOADED_IMAGE_PROTOCOL *mMyLoadedImage; +#if (EFI_SPECIFICATION_VERSION >= 0x00020000) +STATIC EFI_GUID mEfiCapsuleHeaderGuid = EFI_CAPSULE_GUID; +#endif // // Worker Functions // @@ -349,6 +352,7 @@ RuntimeDriverSetVirtualAddressMap ( IN EFI_MEMORY_DESCRIPTOR *VirtualMap ) { + EFI_STATUS Status; RUNTIME_NOTIFY_EVENT_DATA *RuntimeEvent; RUNTIME_IMAGE_RELOCATION_DATA *RuntimeImage; LIST_ENTRY *Link; @@ -356,6 +360,10 @@ RuntimeDriverSetVirtualAddressMap ( UINTN Index1; EFI_DRIVER_OS_HANDOFF_HEADER *DriverOsHandoffHeader; EFI_DRIVER_OS_HANDOFF *DriverOsHandoff; + EFI_PHYSICAL_ADDRESS VirtImageBase; +#if (EFI_SPECIFICATION_VERSION >= 0x00020000) + EFI_CAPSULE_TABLE *CapsuleTable; +#endif // // Can only switch to virtual addresses once the memory map is locked down, @@ -448,7 +456,19 @@ RuntimeDriverSetVirtualAddressMap ( for (Link = mRelocationList.ForwardLink; Link != &mRelocationList; Link = Link->ForwardLink) { RuntimeImage = _CR (Link, RUNTIME_IMAGE_RELOCATION_DATA, Link); if (RuntimeImage->Valid) { - RelocatePeImageForRuntime (RuntimeImage); + + VirtImageBase = RuntimeImage->ImageBase; + Status = RuntimeDriverConvertPointer (0, (VOID **) &VirtImageBase); + ASSERT_EFI_ERROR (Status); + + PeCoffLoaderRelocateImageForRuntime ( + RuntimeImage->ImageBase, + VirtImageBase, + RuntimeImage->ImageSize, + RuntimeImage->RelocationData + ); + + InvalidateInstructionCacheRange ((VOID *)(UINTN)RuntimeImage->ImageBase, (UINTN)RuntimeImage->ImageSize); } } // @@ -464,6 +484,11 @@ RuntimeDriverSetVirtualAddressMap ( RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetVariable); RuntimeDriverConvertInternalPointer ((VOID **) &gRT->SetVariable); RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetNextVariableName); +#if (EFI_SPECIFICATION_VERSION >= 0x00020000) + RuntimeDriverConvertInternalPointer ((VOID **) &gRT->QueryVariableInfo); + RuntimeDriverConvertInternalPointer ((VOID **) &gRT->UpdateCapsule); + RuntimeDriverConvertInternalPointer ((VOID **) &gRT->QueryCapsuleCapabilities); +#endif RuntimeDriverCalculateEfiHdrCrc (&gRT->Hdr); // @@ -486,6 +511,15 @@ RuntimeDriverSetVirtualAddressMap ( RuntimeDriverConvertPointer (EFI_OPTIONAL_POINTER, (VOID **) &(gST->ConfigurationTable[Index].VendorTable)); } +#if (EFI_SPECIFICATION_VERSION >= 0x00020000) + if (CompareGuid (&mEfiCapsuleHeaderGuid, &(gST->ConfigurationTable[Index].VendorGuid))) { + CapsuleTable = gST->ConfigurationTable[Index].VendorTable; + for (Index1 = 0; Index1 < CapsuleTable->CapsuleArrayNumber; Index1++) { + RuntimeDriverConvertPointer (EFI_OPTIONAL_POINTER, (VOID **) &CapsuleTable->CapsulePtr[Index1]); + } + RuntimeDriverConvertPointer (EFI_OPTIONAL_POINTER, (VOID **) &(gST->ConfigurationTable[Index].VendorTable)); + } +#endif } // // Convert the runtime fields of the EFI System Table and recompute the CRC-32