@@ -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
);
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(-)