From patchwork Fri Jul 3 09:40:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 50618 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6D58E214B3 for ; Fri, 3 Jul 2015 09:41:12 +0000 (UTC) Received: by laar3 with SMTP id r3sf26844062laa.1 for ; Fri, 03 Jul 2015 02:41:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=Pu/7kQn2gXcizdTtU7COJZU8tU3gIh4zXDd9604vv4M=; b=g0WMbjyIUb3/q5zm5unneR5FcoG9NvdKLM6d+OlfkVyEf3p09uB2IV3zOXfrnT9Lnm bwlC2R4+XgyQnX5Y7RGKePNMueX8D+zJb3X4vkWJq4NLYVkXCkgnM5pkxyMJWk/QM84N /Z3RFYzGi8Xk8afN9BmESYsZ06oB68hAULoswtlXlJnwu3/YuzJ6NBRrmXj4R22eze+p GM1g3NygjG76TLna3qr2essYiv+mf88mGIn1As/m1WEXRoPG64jtuaC2IVvjHMeZB4Lq TUR+7CQclD1Ae+i+TaviOrbbqXrBYnghch6Fz/bjNlEkCPHJ3GtUEETXgeeOW1ZsYKRL kYWg== X-Gm-Message-State: ALoCoQncOAuxbBHKgqeLVLWj4+852ZobVFoAc555wVTDIgywrVtm91DHRUknEUH/Eqh3/U4Uekqj X-Received: by 10.180.182.49 with SMTP id eb17mr20080687wic.2.1435916471393; Fri, 03 Jul 2015 02:41:11 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.199 with SMTP id m7ls468729lam.83.gmail; Fri, 03 Jul 2015 02:41:11 -0700 (PDT) X-Received: by 10.152.7.65 with SMTP id h1mr35000899laa.33.1435916471001; Fri, 03 Jul 2015 02:41:11 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id v7si6784305lbj.27.2015.07.03.02.41.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Jul 2015 02:41:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by laar3 with SMTP id r3so78791752laa.0 for ; Fri, 03 Jul 2015 02:41:10 -0700 (PDT) X-Received: by 10.112.219.70 with SMTP id pm6mr34187569lbc.41.1435916470885; Fri, 03 Jul 2015 02:41:10 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1046501lbb; Fri, 3 Jul 2015 02:41:10 -0700 (PDT) X-Received: by 10.50.18.39 with SMTP id t7mr20531559igd.3.1435916469445; Fri, 03 Jul 2015 02:41:09 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id sb9si4461465igb.22.2015.07.03.02.41.01 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 03 Jul 2015 02:41:09 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1ZAxSn-0005pz-Bo; Fri, 03 Jul 2015 09:40:53 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1ZAxSl-0005pO-LC for edk2-devel@lists.sourceforge.net; Fri, 03 Jul 2015 09:40:51 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.212.180 as permitted sender) client-ip=209.85.212.180; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wi0-f180.google.com; Received: from mail-wi0-f180.google.com ([209.85.212.180]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1ZAxSk-0003hX-RO for edk2-devel@lists.sourceforge.net; Fri, 03 Jul 2015 09:40:51 +0000 Received: by wibdq8 with SMTP id dq8so95387538wib.1 for ; Fri, 03 Jul 2015 02:40:44 -0700 (PDT) X-Received: by 10.194.2.51 with SMTP id 19mr42394347wjr.40.1435916444878; Fri, 03 Jul 2015 02:40:44 -0700 (PDT) Received: from localhost.localdomain ([185.13.106.72]) by mx.google.com with ESMTPSA id fa8sm12986803wib.14.2015.07.03.02.40.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Jul 2015 02:40:44 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, michael.d.kinney@intel.com, Jiewen.Yao@intel.com, liming.gao@intel.com, jordan.l.justen@intel.com Date: Fri, 3 Jul 2015 11:40:07 +0200 Message-Id: <1435916407-29683-7-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435916407-29683-1-git-send-email-ard.biesheuvel@linaro.org> References: <1435916407-29683-1-git-send-email-ard.biesheuvel@linaro.org> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1ZAxSk-0003hX-RO Subject: [edk2] [PATCH 6/6] MdeModulePkg/RuntimeDxe: update to new RelocateImageForRuntime() prototype X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 --- MdeModulePkg/Core/RuntimeDxe/Runtime.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 );