public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools: Update GenFw to correct DebugEntry Offset when convert XIP image
@ 2018-02-26  5:51 Liming Gao
  2018-02-26  7:41 ` Zhu, Yonghong
  0 siblings, 1 reply; 2+ messages in thread
From: Liming Gao @ 2018-02-26  5:51 UTC (permalink / raw)
  To: edk2-devel

DebugEntry FileOffset is required to be updated to the virtual address if
the input image is converted to XIP image.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Source/C/GenFw/GenFw.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c
index 33ba917..00c9ff3 100644
--- a/BaseTools/Source/C/GenFw/GenFw.c
+++ b/BaseTools/Source/C/GenFw/GenFw.c
@@ -92,6 +92,7 @@ CHAR8  *mInImageName;
 UINT32 mImageTimeStamp = 0;
 UINT32 mImageSize = 0;
 UINT32 mOutImageType = FW_DUMMY_IMAGE;
+BOOLEAN mIsConvertXip = FALSE;
 
 
 STATIC
@@ -665,6 +666,8 @@ PeCoffConvertImageToXip (
   free (*FileBuffer);
   *FileLength = XipLength;
   *FileBuffer = XipFile;
+
+  mIsConvertXip = TRUE;
 }
 
 UINT8 *
@@ -2897,6 +2900,9 @@ Returns:
     Index = 0;
     for (Index=0; Index < DebugDirectoryEntrySize / sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY); Index ++, DebugEntry ++) {
       DebugEntry->TimeDateStamp = 0;
+      if (mIsConvertXip) {
+        DebugEntry->FileOffset = DebugEntry->RVA;
+      }
       if (ZeroDebugFlag || DebugEntry->Type != EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
         memset (FileBuffer + DebugEntry->FileOffset, 0, DebugEntry->SizeOfData);
         memset (DebugEntry, 0, sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY));
-- 
2.8.0.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] BaseTools: Update GenFw to correct DebugEntry Offset when convert XIP image
  2018-02-26  5:51 [Patch] BaseTools: Update GenFw to correct DebugEntry Offset when convert XIP image Liming Gao
@ 2018-02-26  7:41 ` Zhu, Yonghong
  0 siblings, 0 replies; 2+ messages in thread
From: Zhu, Yonghong @ 2018-02-26  7:41 UTC (permalink / raw)
  To: Gao, Liming, edk2-devel@lists.01.org

Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> 

Best Regards,
Zhu Yonghong


-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Liming Gao
Sent: Monday, February 26, 2018 1:52 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch] BaseTools: Update GenFw to correct DebugEntry Offset when convert XIP image

DebugEntry FileOffset is required to be updated to the virtual address if the input image is converted to XIP image.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Source/C/GenFw/GenFw.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c
index 33ba917..00c9ff3 100644
--- a/BaseTools/Source/C/GenFw/GenFw.c
+++ b/BaseTools/Source/C/GenFw/GenFw.c
@@ -92,6 +92,7 @@ CHAR8  *mInImageName;
 UINT32 mImageTimeStamp = 0;
 UINT32 mImageSize = 0;
 UINT32 mOutImageType = FW_DUMMY_IMAGE;
+BOOLEAN mIsConvertXip = FALSE;
 
 
 STATIC
@@ -665,6 +666,8 @@ PeCoffConvertImageToXip (
   free (*FileBuffer);
   *FileLength = XipLength;
   *FileBuffer = XipFile;
+
+  mIsConvertXip = TRUE;
 }
 
 UINT8 *
@@ -2897,6 +2900,9 @@ Returns:
     Index = 0;
     for (Index=0; Index < DebugDirectoryEntrySize / sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY); Index ++, DebugEntry ++) {
       DebugEntry->TimeDateStamp = 0;
+      if (mIsConvertXip) {
+        DebugEntry->FileOffset = DebugEntry->RVA;
+      }
       if (ZeroDebugFlag || DebugEntry->Type != EFI_IMAGE_DEBUG_TYPE_CODEVIEW) {
         memset (FileBuffer + DebugEntry->FileOffset, 0, DebugEntry->SizeOfData);
         memset (DebugEntry, 0, sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY));
--
2.8.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-26  7:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-26  5:51 [Patch] BaseTools: Update GenFw to correct DebugEntry Offset when convert XIP image Liming Gao
2018-02-26  7:41 ` Zhu, Yonghong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox