public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "Kuo, Ted" <ted.kuo@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "De, Debkumar" <debkumar.de@intel.com>,
	"Han, Harry" <harry.han@intel.com>,
	"West, Catharine" <catharine.west@intel.com>
Subject: Re: [edk2-devel][PATCH] UefiCpuPkg: Support FFS3 GUID in SearchForBfvBase.asm
Date: Thu, 10 Mar 2022 04:15:13 +0000	[thread overview]
Message-ID: <MWHPR11MB163119A323C59A419B3433D58C0B9@MWHPR11MB1631.namprd11.prod.outlook.com> (raw)
In-Reply-To: <5a3a880ffa4a521565192ca5eda35d0b93625067.1646664121.git.ted.kuo@intel.com>

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.

 
 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?

 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?

     ;
     ; 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


  reply	other threads:[~2022-03-10  4:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 14:43 [edk2-devel][PATCH] UefiCpuPkg: Support FFS3 GUID in SearchForBfvBase.asm Kuo, Ted
2022-03-10  4:15 ` Ni, Ray [this message]
2022-03-10 11:44   ` Kuo, Ted

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=MWHPR11MB163119A323C59A419B3433D58C0B9@MWHPR11MB1631.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