\r
EFI_LOADED_IMAGE_PROTOCOL *mMyLoadedImage;\r
\r
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
+STATIC EFI_GUID mEfiCapsuleHeaderGuid = EFI_CAPSULE_GUID;\r
+#endif\r
//\r
// Worker Functions\r
//\r
IN EFI_MEMORY_DESCRIPTOR *VirtualMap\r
)\r
{\r
+ EFI_STATUS Status;\r
RUNTIME_NOTIFY_EVENT_DATA *RuntimeEvent;\r
RUNTIME_IMAGE_RELOCATION_DATA *RuntimeImage;\r
LIST_ENTRY *Link;\r
UINTN Index1;\r
EFI_DRIVER_OS_HANDOFF_HEADER *DriverOsHandoffHeader;\r
EFI_DRIVER_OS_HANDOFF *DriverOsHandoff;\r
+ EFI_PHYSICAL_ADDRESS VirtImageBase;\r
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
+ EFI_CAPSULE_TABLE *CapsuleTable; \r
+#endif\r
\r
//\r
// Can only switch to virtual addresses once the memory map is locked down,\r
for (Link = mRelocationList.ForwardLink; Link != &mRelocationList; Link = Link->ForwardLink) {\r
RuntimeImage = _CR (Link, RUNTIME_IMAGE_RELOCATION_DATA, Link);\r
if (RuntimeImage->Valid) {\r
- RelocatePeImageForRuntime (RuntimeImage);\r
+\r
+ VirtImageBase = RuntimeImage->ImageBase;\r
+ Status = RuntimeDriverConvertPointer (0, (VOID **) &VirtImageBase);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ PeCoffLoaderRelocateImageForRuntime (\r
+ RuntimeImage->ImageBase,\r
+ VirtImageBase,\r
+ RuntimeImage->ImageSize,\r
+ RuntimeImage->RelocationData\r
+ );\r
+ \r
+ InvalidateInstructionCacheRange ((VOID *)(UINTN)RuntimeImage->ImageBase, (UINTN)RuntimeImage->ImageSize);\r
}\r
}\r
//\r
RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetVariable);\r
RuntimeDriverConvertInternalPointer ((VOID **) &gRT->SetVariable);\r
RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetNextVariableName);\r
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
+ RuntimeDriverConvertInternalPointer ((VOID **) &gRT->QueryVariableInfo);\r
+ RuntimeDriverConvertInternalPointer ((VOID **) &gRT->UpdateCapsule);\r
+ RuntimeDriverConvertInternalPointer ((VOID **) &gRT->QueryCapsuleCapabilities);\r
+#endif\r
RuntimeDriverCalculateEfiHdrCrc (&gRT->Hdr);\r
\r
//\r
\r
RuntimeDriverConvertPointer (EFI_OPTIONAL_POINTER, (VOID **) &(gST->ConfigurationTable[Index].VendorTable));\r
}\r
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
+ if (CompareGuid (&mEfiCapsuleHeaderGuid, &(gST->ConfigurationTable[Index].VendorGuid))) {\r
+ CapsuleTable = gST->ConfigurationTable[Index].VendorTable;\r
+ for (Index1 = 0; Index1 < CapsuleTable->CapsuleArrayNumber; Index1++) {\r
+ RuntimeDriverConvertPointer (EFI_OPTIONAL_POINTER, (VOID **) &CapsuleTable->CapsulePtr[Index1]);\r
+ } \r
+ RuntimeDriverConvertPointer (EFI_OPTIONAL_POINTER, (VOID **) &(gST->ConfigurationTable[Index].VendorTable));\r
+ }\r
+#endif\r
}\r
//\r
// Convert the runtime fields of the EFI System Table and recompute the CRC-32\r