]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/Runtime/RuntimeDxe/Runtime.c
Updated the Runtime Driver to use the MDE libs for cache flush and removed local...
[mirror_edk2.git] / EdkModulePkg / Universal / Runtime / RuntimeDxe / Runtime.c
index d2428ea1b61060fb3c11407401c498c75bf4cc22..61dbd9c1fc6c842338c7ff4b30a0fbcaa859669d 100644 (file)
@@ -352,6 +352,7 @@ RuntimeDriverSetVirtualAddressMap (
   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
@@ -359,6 +360,7 @@ RuntimeDriverSetVirtualAddressMap (
   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
@@ -454,7 +456,19 @@ RuntimeDriverSetVirtualAddressMap (
   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