]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/MemEncryptSevLib: Coding style fixes in prep for SEC library
authorTom Lendacky <thomas.lendacky@amd.com>
Thu, 7 Jan 2021 18:48:20 +0000 (12:48 -0600)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 7 Jan 2021 19:34:39 +0000 (19:34 +0000)
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3108

Creating an SEC version of the library requires renaming an existing file
which will result in the existing code failing ECC. Prior to renaming the
existing file, fix the coding style to avoid the ECC failure.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Message-Id: <f765d867da4a703e0a0db35e26515a911482fd40.1610045305.git.thomas.lendacky@amd.com>

OvmfPkg/Library/BaseMemEncryptSevLib/X64/VirtualMemory.c

index 6422bc53bd5df8fd5e8bdef35952520160d36cfc..3a5bab657bd74458123dc173bce702e925727736 100644 (file)
@@ -192,7 +192,8 @@ Split2MPageTo4K (
 {\r
   PHYSICAL_ADDRESS                  PhysicalAddress4K;\r
   UINTN                             IndexOfPageTableEntries;\r
-  PAGE_TABLE_4K_ENTRY               *PageTableEntry, *PageTableEntry1;\r
+  PAGE_TABLE_4K_ENTRY               *PageTableEntry;\r
+  PAGE_TABLE_4K_ENTRY               *PageTableEntry1;\r
   UINT64                            AddressEncMask;\r
 \r
   PageTableEntry = AllocatePageTableMemory(1);\r
@@ -472,7 +473,7 @@ Split1GPageTo2M (
 /**\r
   Set or Clear the memory encryption bit\r
 \r
-  @param[in]      PagetablePoint        Page table entry pointer (PTE).\r
+  @param[in, out] PageTablePointer      Page table entry pointer (PTE).\r
   @param[in]      Mode                  Set or Clear encryption bit\r
 \r
 **/\r
@@ -562,7 +563,6 @@ EnableReadOnlyPageWriteProtect (
   @retval RETURN_UNSUPPORTED          Setting the memory encyrption attribute\r
                                       is not supported\r
 **/\r
-\r
 STATIC\r
 RETURN_STATUS\r
 EFIAPI\r
@@ -635,7 +635,7 @@ SetMemoryEncDec (
 \r
   Status = EFI_SUCCESS;\r
 \r
-  while (Length)\r
+  while (Length != 0)\r
   {\r
     //\r
     // If Cr3BaseAddress is not specified then read the current CR3\r
@@ -683,7 +683,7 @@ SetMemoryEncDec (
       // Valid 1GB page\r
       // If we have at least 1GB to go, we can just update this entry\r
       //\r
-      if (!(PhysicalAddress & (BIT30 - 1)) && Length >= BIT30) {\r
+      if ((PhysicalAddress & (BIT30 - 1)) == 0 && Length >= BIT30) {\r
         SetOrClearCBit(&PageDirectory1GEntry->Uint64, Mode);\r
         DEBUG ((\r
           DEBUG_VERBOSE,\r
@@ -744,7 +744,7 @@ SetMemoryEncDec (
         // Valid 2MB page\r
         // If we have at least 2MB left to go, we can just update this entry\r
         //\r
-        if (!(PhysicalAddress & (BIT21-1)) && Length >= BIT21) {\r
+        if ((PhysicalAddress & (BIT21-1)) == 0 && Length >= BIT21) {\r
           SetOrClearCBit (&PageDirectory2MEntry->Uint64, Mode);\r
           PhysicalAddress += BIT21;\r
           Length -= BIT21;\r