public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH] IntelFsp2Pkg/Tools: Let PatchFv support to get Image Base.
@ 2024-03-18  9:08 Zhiguang Liu
  2024-03-18  9:08 ` [edk2-devel] [PATCH] IntelFsp2Pkg/Tools: Updated iterator usage for Python 3 compatibility Zhiguang Liu
  2024-03-24 10:01 ` [edk2-devel] [PATCH] IntelFsp2Pkg/Tools: Let PatchFv support to get Image Base Ashraf Ali S
  0 siblings, 2 replies; 4+ messages in thread
From: Zhiguang Liu @ 2024-03-18  9:08 UTC (permalink / raw)
  To: devel
  Cc: Zhiguang Liu, Chasel Chiu, Nate DeSimone, Duggapu Chinni B,
	Star Zeng, Ted Kuo, Ashraf Ali S, Susovan Mohapatra

Now, the value params of PatchFv support below value getting from map
file:
  ModuleName:FunctionName
  ModuleName:GlobalVariableName
  ModuleGuid:Offset
This patch add a new type ModuleName:KeyWord
KeyWord now supports "BASE", indicating the address of the Image base.
For example, ModuleName:BASE will be the address of the Image base.
This will simplify the flow when user want to patch the Image base in
the binary.

In the future, we can let the KeyWord support more based on future
usage.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Duggapu Chinni B <chinni.b.duggapu@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ted Kuo <ted.kuo@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Cc: Susovan Mohapatra <susovan.mohapatra@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
---
 IntelFsp2Pkg/Tools/PatchFv.py                       | 1 +
 IntelFsp2Pkg/Tools/UserManuals/PatchFvUserManual.md | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py
index 73ab877c71..0cab73255d 100644
--- a/IntelFsp2Pkg/Tools/PatchFv.py
+++ b/IntelFsp2Pkg/Tools/PatchFv.py
@@ -384,6 +384,7 @@ class Symbols:
                     if len(modName) == 36:
                        modName = self.dictGuidNameXref[modName.upper()]
                     self.dictModBase['%s:BASE'  % modName] = int (match.group(2), 16)
+                    self.dictSymbolAddress['%s:BASE'  % modName] = match.group(2)
                     self.dictModBase['%s:ENTRY' % modName] = int (match.group(3), 16)
                 #(GUID=86D70125-BAA3-4296-A62F-602BEBBB9081 .textbaseaddress=0x00fffb4398 .databaseaddress=0x00fffb4178)
                 match = re.match("\(GUID=([A-Z0-9\-]+)\s+\.textbaseaddress=(0x[0-9a-fA-F]+)\s+\.databaseaddress=(0x[0-9a-fA-F]+)\)", rptLine)
diff --git a/IntelFsp2Pkg/Tools/UserManuals/PatchFvUserManual.md b/IntelFsp2Pkg/Tools/UserManuals/PatchFvUserManual.md
index 205ad57773..b59e82c872 100644
--- a/IntelFsp2Pkg/Tools/UserManuals/PatchFvUserManual.md
+++ b/IntelFsp2Pkg/Tools/UserManuals/PatchFvUserManual.md
@@ -89,9 +89,10 @@ The entire argument includes the quote marks like in the example argument below:
 | 0x000000BC       | 0xFFFFFFA2       | 188                  | -94                  |
 
 ```
-ModuleName:FunctionName | ModuleName:GlobalVariableName
+ModuleName:FunctionName | ModuleName:GlobalVariableName | ModuleName:KeyWord
 ModuleGuid:Offset
 ```
+Note: KeyWord only supports "BASE" now, indicating the address of the PE Image base.
 
 ### Operators:
 
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116835): https://edk2.groups.io/g/devel/message/116835
Mute This Topic: https://groups.io/mt/104999188/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

* [edk2-devel] [PATCH] IntelFsp2Pkg/Tools: Updated iterator usage for Python 3 compatibility
  2024-03-18  9:08 [edk2-devel] [PATCH] IntelFsp2Pkg/Tools: Let PatchFv support to get Image Base Zhiguang Liu
@ 2024-03-18  9:08 ` Zhiguang Liu
  2024-03-24  6:33   ` Ashraf Ali S
  2024-03-24 10:01 ` [edk2-devel] [PATCH] IntelFsp2Pkg/Tools: Let PatchFv support to get Image Base Ashraf Ali S
  1 sibling, 1 reply; 4+ messages in thread
From: Zhiguang Liu @ 2024-03-18  9:08 UTC (permalink / raw)
  To: devel
  Cc: Zhiguang Liu, Chasel Chiu, Nate DeSimone, Duggapu Chinni B,
	Star Zeng, Ted Kuo, Ashraf Ali S, Susovan Mohapatra

Updated iterator usage for Python 3 compatibility
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Duggapu Chinni B <chinni.b.duggapu@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ted Kuo <ted.kuo@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Cc: Susovan Mohapatra <susovan.mohapatra@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
---
 IntelFsp2Pkg/Tools/PatchFv.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py
index 0cab73255d..fd7476d576 100644
--- a/IntelFsp2Pkg/Tools/PatchFv.py
+++ b/IntelFsp2Pkg/Tools/PatchFv.py
@@ -720,7 +720,7 @@ class Symbols:
     def getModGuid(self, var):
         guid = (guid for guid,name in self.dictGuidNameXref.items() if name==var)
         try:
-            value = guid.next()
+            value = next(guid)
         except Exception:
             raise Exception("Unknown module name %s !" % var)
         return value
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116836): https://edk2.groups.io/g/devel/message/116836
Mute This Topic: https://groups.io/mt/104999189/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [edk2-devel] [PATCH] IntelFsp2Pkg/Tools: Updated iterator usage for Python 3 compatibility
  2024-03-18  9:08 ` [edk2-devel] [PATCH] IntelFsp2Pkg/Tools: Updated iterator usage for Python 3 compatibility Zhiguang Liu
@ 2024-03-24  6:33   ` Ashraf Ali S
  0 siblings, 0 replies; 4+ messages in thread
From: Ashraf Ali S @ 2024-03-24  6:33 UTC (permalink / raw)
  To: Liu, Zhiguang, devel@edk2.groups.io
  Cc: Chiu, Chasel, Desimone, Nathaniel L, Duggapu, Chinni B,
	Zeng, Star, Kuo, Ted, Mohapatra, Susovan

Reviewed-by: S, Ashraf Ali <ashraf.ali.s@intel.com>

Thanks.,
S, Ashraf Ali

-----Original Message-----
From: Liu, Zhiguang <zhiguang.liu@intel.com> 
Sent: Monday, March 18, 2024 2:39 PM
To: devel@edk2.groups.io
Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Duggapu, Chinni B <chinni.b.duggapu@intel.com>; Zeng, Star <star.zeng@intel.com>; Kuo, Ted <ted.kuo@intel.com>; S, Ashraf Ali <ashraf.ali.s@intel.com>; Mohapatra, Susovan <susovan.mohapatra@intel.com>
Subject: [PATCH] IntelFsp2Pkg/Tools: Updated iterator usage for Python 3 compatibility

Updated iterator usage for Python 3 compatibility
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Duggapu Chinni B <chinni.b.duggapu@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ted Kuo <ted.kuo@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Cc: Susovan Mohapatra <susovan.mohapatra@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
---
 IntelFsp2Pkg/Tools/PatchFv.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py index 0cab73255d..fd7476d576 100644
--- a/IntelFsp2Pkg/Tools/PatchFv.py
+++ b/IntelFsp2Pkg/Tools/PatchFv.py
@@ -720,7 +720,7 @@ class Symbols:
     def getModGuid(self, var):
         guid = (guid for guid,name in self.dictGuidNameXref.items() if name==var)
         try:
-            value = guid.next()
+            value = next(guid)
         except Exception:
             raise Exception("Unknown module name %s !" % var)
         return value
--
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117069): https://edk2.groups.io/g/devel/message/117069
Mute This Topic: https://groups.io/mt/104999189/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [edk2-devel] [PATCH] IntelFsp2Pkg/Tools: Let PatchFv support to get Image Base.
  2024-03-18  9:08 [edk2-devel] [PATCH] IntelFsp2Pkg/Tools: Let PatchFv support to get Image Base Zhiguang Liu
  2024-03-18  9:08 ` [edk2-devel] [PATCH] IntelFsp2Pkg/Tools: Updated iterator usage for Python 3 compatibility Zhiguang Liu
@ 2024-03-24 10:01 ` Ashraf Ali S
  1 sibling, 0 replies; 4+ messages in thread
From: Ashraf Ali S @ 2024-03-24 10:01 UTC (permalink / raw)
  To: Liu, Zhiguang, devel@edk2.groups.io
  Cc: Chiu, Chasel, Desimone, Nathaniel L, Duggapu, Chinni B,
	Zeng, Star, Kuo, Ted, Mohapatra, Susovan

Reviewed-by: S, Ashraf Ali <ashraf.ali.s@intel.com>

Thanks.,
S, Ashraf Ali

-----Original Message-----
From: Liu, Zhiguang <zhiguang.liu@intel.com> 
Sent: Monday, March 18, 2024 2:39 PM
To: devel@edk2.groups.io
Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Duggapu, Chinni B <chinni.b.duggapu@intel.com>; Zeng, Star <star.zeng@intel.com>; Kuo, Ted <ted.kuo@intel.com>; S, Ashraf Ali <ashraf.ali.s@intel.com>; Mohapatra, Susovan <susovan.mohapatra@intel.com>
Subject: [PATCH] IntelFsp2Pkg/Tools: Let PatchFv support to get Image Base.

Now, the value params of PatchFv support below value getting from map
file:
  ModuleName:FunctionName
  ModuleName:GlobalVariableName
  ModuleGuid:Offset
This patch add a new type ModuleName:KeyWord KeyWord now supports "BASE", indicating the address of the Image base.
For example, ModuleName:BASE will be the address of the Image base.
This will simplify the flow when user want to patch the Image base in the binary.

In the future, we can let the KeyWord support more based on future usage.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Duggapu Chinni B <chinni.b.duggapu@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ted Kuo <ted.kuo@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Cc: Susovan Mohapatra <susovan.mohapatra@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
---
 IntelFsp2Pkg/Tools/PatchFv.py                       | 1 +
 IntelFsp2Pkg/Tools/UserManuals/PatchFvUserManual.md | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py index 73ab877c71..0cab73255d 100644
--- a/IntelFsp2Pkg/Tools/PatchFv.py
+++ b/IntelFsp2Pkg/Tools/PatchFv.py
@@ -384,6 +384,7 @@ class Symbols:
                     if len(modName) == 36:
                        modName = self.dictGuidNameXref[modName.upper()]
                     self.dictModBase['%s:BASE'  % modName] = int (match.group(2), 16)
+                    self.dictSymbolAddress['%s:BASE'  % modName] = 
+ match.group(2)
                     self.dictModBase['%s:ENTRY' % modName] = int (match.group(3), 16)
                 #(GUID=86D70125-BAA3-4296-A62F-602BEBBB9081 .textbaseaddress=0x00fffb4398 .databaseaddress=0x00fffb4178)
                 match = re.match("\(GUID=([A-Z0-9\-]+)\s+\.textbaseaddress=(0x[0-9a-fA-F]+)\s+\.databaseaddress=(0x[0-9a-fA-F]+)\)", rptLine) diff --git a/IntelFsp2Pkg/Tools/UserManuals/PatchFvUserManual.md b/IntelFsp2Pkg/Tools/UserManuals/PatchFvUserManual.md
index 205ad57773..b59e82c872 100644
--- a/IntelFsp2Pkg/Tools/UserManuals/PatchFvUserManual.md
+++ b/IntelFsp2Pkg/Tools/UserManuals/PatchFvUserManual.md
@@ -89,9 +89,10 @@ The entire argument includes the quote marks like in the example argument below:
 | 0x000000BC       | 0xFFFFFFA2       | 188                  | -94                  |
 
 ```
-ModuleName:FunctionName | ModuleName:GlobalVariableName
+ModuleName:FunctionName | ModuleName:GlobalVariableName | 
+ModuleName:KeyWord
 ModuleGuid:Offset
 ```
+Note: KeyWord only supports "BASE" now, indicating the address of the PE Image base.
 
 ### Operators:
 
--
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117070): https://edk2.groups.io/g/devel/message/117070
Mute This Topic: https://groups.io/mt/104999188/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

end of thread, other threads:[~2024-03-24 10:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-18  9:08 [edk2-devel] [PATCH] IntelFsp2Pkg/Tools: Let PatchFv support to get Image Base Zhiguang Liu
2024-03-18  9:08 ` [edk2-devel] [PATCH] IntelFsp2Pkg/Tools: Updated iterator usage for Python 3 compatibility Zhiguang Liu
2024-03-24  6:33   ` Ashraf Ali S
2024-03-24 10:01 ` [edk2-devel] [PATCH] IntelFsp2Pkg/Tools: Let PatchFv support to get Image Base Ashraf Ali S

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