[edk2,6/6] MdeModulePkg/RuntimeDxe: update to new RelocateImageForRuntime() prototype

Message ID 1435916407-29683-7-git-send-email-ard.biesheuvel@linaro.org
State New
Headers show

Commit Message

Ard Biesheuvel July 3, 2015, 9:40 a.m.
When reapplying PE/COFF relocations for the switch to virtual mode, we
should not assume that the virtual memory image is identical to the
PE/COFF file image, since PE/COFF sections may no longer be adjacent in
virtual memory.

The prototype and implementation of PeCoffLoaderRelocateImageForRuntime
have been updated to account for this, so update the call site as well.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 MdeModulePkg/Core/RuntimeDxe/Runtime.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/MdeModulePkg/Core/RuntimeDxe/Runtime.c b/MdeModulePkg/Core/RuntimeDxe/Runtime.c
index c61301cf80d8..e660138f1189 100644
--- a/MdeModulePkg/Core/RuntimeDxe/Runtime.c
+++ b/MdeModulePkg/Core/RuntimeDxe/Runtime.c
@@ -212,6 +212,16 @@  RuntimeDriverConvertInternalPointer (
   return RuntimeDriverConvertPointer (0x0, ConvertAddress);
 }
 
+STATIC
+RETURN_STATUS
+EFIAPI
+RuntimeDriverConvertPecoffPointer (
+  IN OUT VOID                       **Address
+  )
+{
+  return (RETURN_STATUS) RuntimeDriverConvertPointer (0x0, Address);
+}
+
 /**
 
   Changes the runtime addressing mode of EFI firmware from physical to virtual.
@@ -314,7 +324,7 @@  RuntimeDriverSetVirtualAddressMap (
 
       PeCoffLoaderRelocateImageForRuntime (
         (EFI_PHYSICAL_ADDRESS) (UINTN) RuntimeImage->ImageBase,
-        VirtImageBase,
+        RuntimeDriverConvertPecoffPointer,
         (UINTN) RuntimeImage->ImageSize,
         RuntimeImage->RelocationData
         );