public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nate DeSimone" <nathaniel.l.desimone@intel.com>
To: "Ma, Maurice" <maurice.ma@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Ma, Maurice" <maurice.ma@intel.com>,
	"Chiu, Chasel" <chasel.chiu@intel.com>,
	"Zeng, Star" <star.zeng@intel.com>
Subject: Re: [PATCH] IntelFsp2Pkg: Fix FSP binary rebasing issue for PE32+ image
Date: Sat, 14 Nov 2020 23:52:57 +0000	[thread overview]
Message-ID: <MWHPR1101MB21603A82EA5F37E89D97433ECDE50@MWHPR1101MB2160.namprd11.prod.outlook.com> (raw)
In-Reply-To: <6799c7ce4aff0db1d5d0c6afe2901fb10bc939a9.1605139779.git.maurice.ma@intel.com>

Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

> -----Original Message-----
> From: Maurice Ma <maurice.ma@intel.com>
> Sent: Wednesday, November 11, 2020 4:11 PM
> To: devel@edk2.groups.io
> Cc: Ma, Maurice <maurice.ma@intel.com>; Chiu, Chasel
> <chasel.chiu@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; Zeng, Star <star.zeng@intel.com>
> Subject: [PATCH] IntelFsp2Pkg: Fix FSP binary rebasing issue for PE32+ image
> 
> Current FSP rebasing script SplitFspBin.py has support for both
> PE32 and PE32+ image formats. However, while updating the ImageBase field
> in the image header, it always assumed the ImageBase field is 32bit long.
> Since PE32+ image format defined ImageBase as 64bit, the current script will
> only update the lower 32bit value and leave the upper 32bit untouched. It
> does not work well for PE32+ image that requires update in the upper 32bit
> ImageBase field. The expected behavior is to update the full 64bit field. This
> patch implemented this fix.
> 
> Signed-off-by: Maurice Ma <maurice.ma@intel.com>
> 
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> ---
>  IntelFsp2Pkg/Tools/SplitFspBin.py | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/IntelFsp2Pkg/Tools/SplitFspBin.py
> b/IntelFsp2Pkg/Tools/SplitFspBin.py
> index 3c0d5af1b6..24272e82af 100644
> --- a/IntelFsp2Pkg/Tools/SplitFspBin.py
> +++ b/IntelFsp2Pkg/Tools/SplitFspBin.py
> @@ -677,8 +677,12 @@ class PeTeImage:
>          else:             offset  = self.Offset + self.DosHdr.e_lfanew             offset +=
> EFI_IMAGE_NT_HEADERS32.OptionalHeader.offset-            offset +=
> EFI_IMAGE_OPTIONAL_HEADER32.ImageBase.offset-            size    =
> EFI_IMAGE_OPTIONAL_HEADER32.ImageBase.size+            if
> self.PeHdr.OptionalHeader.PePlusOptHdr.Magic == 0x20b: # PE32+ image+
> offset += EFI_IMAGE_OPTIONAL_HEADER32_PLUS.ImageBase.offset+
> size    = EFI_IMAGE_OPTIONAL_HEADER32_PLUS.ImageBase.size+
> else:+                offset +=
> EFI_IMAGE_OPTIONAL_HEADER32.ImageBase.offset+                size    =
> EFI_IMAGE_OPTIONAL_HEADER32.ImageBase.size          value  =
> Bytes2Val(fdbin[offset:offset+size]) + delta         fdbin[offset:offset+size] =
> Val2Bytes(value, size)--
> 2.29.2.windows.1


  parent reply	other threads:[~2020-11-14 23:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12  0:10 [PATCH] IntelFsp2Pkg: Fix FSP binary rebasing issue for PE32+ image Ma, Maurice
2020-11-12  0:37 ` Chiu, Chasel
2020-11-12  4:12 ` Zeng, Star
2020-11-14 23:52 ` Nate DeSimone [this message]
2020-11-15  0:18 ` Nate DeSimone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MWHPR1101MB21603A82EA5F37E89D97433ECDE50@MWHPR1101MB2160.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox