[edk2-devel][PATCH] UefiCpuPkg: Support FFS3 GUID in SearchForBfvBase.asm

Kuo, Ted ted.kuo at intel.com
Thu Mar 10 11:44:01 UTC 2022


Hi Ray,

Please find my inline comments with [Ted].

Thanks,
Ted

-----Original Message-----
From: Ni, Ray <ray.ni at intel.com> 
Sent: Thursday, March 10, 2022 12:15 PM
To: Kuo, Ted <ted.kuo at intel.com>; devel at edk2.groups.io
Cc: De, Debkumar <debkumar.de at intel.com>; Han, Harry <harry.han at intel.com>; West, Catharine <catharine.west at intel.com>
Subject: RE: [edk2-devel][PATCH] UefiCpuPkg: Support FFS3 GUID in SearchForBfvBase.asm

3 comments starting with "[Ray]".

 ;#define EFI_FIRMWARE_FILE_SYSTEM2_GUID \  ;  { 0x8c8ce578, 0x8a3d, 0x4f1c, { 0x99, 0x35, 0x89, 0x61, 0x85, 0xc3, 0x2d, 0xd3 } } -%define FFS_GUID_DWORD0 0x8c8ce578 -%define FFS_GUID_DWORD1 0x4f1c8a3d -%define FFS_GUID_DWORD2 0x61893599 -%define FFS_GUID_DWORD3 0xd32dc385
+%define FFS2_GUID_DWORD0 0x8c8ce578
+%define FFS2_GUID_DWORD1 0x4f1c8a3d
+%define FFS2_GUID_DWORD2 0x61893599
+%define FFS2_GUID_DWORD3 0xd32dc385
+
+;#define EFI_FIRMWARE_FILE_SYSTEM3_GUID \ ;  { 0x8c8ce578, 0x3dcb, 
+0x4dca, { 0xbd, 0x6f, 0x1e, 0x96, 0x89, 0xe7, 0x34, 0x9a } } %define 
+FFS3_GUID_DWORD0 0x5473c07a %define FFS3_GUID_DWORD1 0x4dca3dcb %define 
+FFS3_GUID_DWORD2 0x961e6fbd %define FFS3_GUID_DWORD3 0x9a34e789

[Ray] 1. I am not sure if it's the best representation of GUID in NASM? I am not the NASM expert. If there is no recommendation, I am ok with this.
[Ted] Somehow the diff doesn't reflect the actual representation in my editor. I'll check and update the patch.
 
 BITS    32
 
@@ -25,6 +32,7 @@ BITS    32
 Flat32SearchForBfvBase:
 
     xor     eax, eax
+    mov     ecx, 2 ; 2: FFS3 GUID, 1: FFS2 GUID, 0: Not Found

[Ray] 2. Can you map ECX 2 to FFS2 GUID, ECX 3 to FFS3 GUID?
[Ted] Yes, will update in next patch.

 searchingForBfvHeaderLoop:
     ;
     ; We check for a firmware volume at every 4KB address in the top 16MB @@ -32,20 +40,37 @@ searchingForBfvHeaderLoop:
     ;
     sub     eax, 0x1000
     cmp     eax, 0xff000000
-    jb      searchedForBfvHeaderButNotFound
+    jb      searchingForBfvWithOtherFfsGuid
+    cmp     ecx, 2
+    jne     searchingForFfs2Guid
 
     ;
-    ; Check FFS GUID
+    ; Check FFS3 GUID
     ;
-    cmp     dword [eax + 0x10], FFS_GUID_DWORD0
+    cmp     dword [eax + 0x10], FFS3_GUID_DWORD0
     jne     searchingForBfvHeaderLoop
-    cmp     dword [eax + 0x14], FFS_GUID_DWORD1
+    cmp     dword [eax + 0x14], FFS3_GUID_DWORD1
     jne     searchingForBfvHeaderLoop
-    cmp     dword [eax + 0x18], FFS_GUID_DWORD2
+    cmp     dword [eax + 0x18], FFS3_GUID_DWORD2
     jne     searchingForBfvHeaderLoop
-    cmp     dword [eax + 0x1c], FFS_GUID_DWORD3
+    cmp     dword [eax + 0x1c], FFS3_GUID_DWORD3
     jne     searchingForBfvHeaderLoop
+    jmp     checkingFvLength
 
+searchingForFfs2Guid:
+    ;
+    ; Check FFS2 GUID
+    ;
+    cmp     dword [eax + 0x10], FFS2_GUID_DWORD0
+    jne     searchingForBfvHeaderLoop
+    cmp     dword [eax + 0x14], FFS2_GUID_DWORD1
+    jne     searchingForBfvHeaderLoop
+    cmp     dword [eax + 0x18], FFS2_GUID_DWORD2
+    jne     searchingForBfvHeaderLoop
+    cmp     dword [eax + 0x1c], FFS2_GUID_DWORD3
+    jne     searchingForBfvHeaderLoop
+
+checkingFvLength:

[Ray] 3. Why is this label added?
[Ted] You meant searchingForBfvWithOtherFfsGuid? This is used to restart a new search with a new target guid before reaching the end of the supported ffs guid list.

     ;
     ; Check FV Length
     ;
@@ -57,6 +82,12 @@ searchingForBfvHeaderLoop:
 
     jmp     searchedForBfvHeaderAndItWasFound
 
+searchingForBfvWithOtherFfsGuid:
+    xor     eax, eax
+    dec     ecx
+    cmp     ecx, 0
+    jne     searchingForBfvHeaderLoop
+
 searchedForBfvHeaderButNotFound:
     ;
     ; Hang if the SEC entry point was not found
--
2.16.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87405): https://edk2.groups.io/g/devel/message/87405
Mute This Topic: https://groups.io/mt/89613429/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list