Skip to content

Commit

Permalink
Fixed compilation of all packages tracked by CI after rebasing upon e…
Browse files Browse the repository at this point in the history
…dk2-stable202405 tag.
  • Loading branch information
Mikhail Krichanov committed Jun 27, 2024
1 parent 9ad5ffd commit f6ee384
Show file tree
Hide file tree
Showing 25 changed files with 81 additions and 497 deletions.
2 changes: 2 additions & 0 deletions CryptoPkg/Library/IntrinsicLib/CopyMem.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Base.h>
#include <Library/BaseMemoryLib.h>

#if !defined (__arm__)
#if defined (__clang__) && !defined (__APPLE__)

/* Copies bytes between buffers */
Expand Down Expand Up @@ -53,3 +54,4 @@ __bzero (
ZeroMem (src, count);
}
#endif
#endif
8 changes: 2 additions & 6 deletions MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,7 @@ InsertImageRecord (
DEBUG ((DEBUG_WARN, "!!!!!!!! Image - %a !!!!!!!!\n", PdbPointer));
}

Status = EFI_ABORTED;
goto Finish;
return;
}

ImageRecord = UefiImageLoaderGetImageRecord (ImageContext);
Expand All @@ -686,9 +685,6 @@ InsertImageRecord (
//

InsertSortImageRecord (ImageRecord);

Finish:
return;
}

/**
Expand Down Expand Up @@ -728,7 +724,7 @@ FindImageRecord (
}
}

return;
return NULL;
}

/**
Expand Down
35 changes: 21 additions & 14 deletions MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,45 +115,52 @@ SetUefiImageProtectionAttributes (
}

/**
Return the section alignment requirement for the PE image section type.
Return if the PE image section is aligned.
@param[in] MemoryType PE/COFF image memory type
@retval The required section alignment for this memory type
@param[in] SectionAlignment PE/COFF section alignment
@param[in] MemoryType PE/COFF image memory type
@retval TRUE The PE image section is aligned.
@retval FALSE The PE image section is not aligned.
**/
STATIC
UINT32
GetMemoryProtectionSectionAlignment (
BOOLEAN
IsMemoryProtectionSectionAligned (
IN UINT32 SectionAlignment,
IN EFI_MEMORY_TYPE MemoryType
)
{
UINT32 SectionAlignment;
UINT32 PageAlignment;

switch (MemoryType) {
case EfiRuntimeServicesCode:
case EfiACPIMemoryNVS:
case EfiReservedMemoryType:
SectionAlignment = RUNTIME_PAGE_ALLOCATION_GRANULARITY;
PageAlignment = RUNTIME_PAGE_ALLOCATION_GRANULARITY;
break;
case EfiRuntimeServicesData:
case EfiACPIReclaimMemory:
ASSERT (FALSE);
SectionAlignment = RUNTIME_PAGE_ALLOCATION_GRANULARITY;
PageAlignment = RUNTIME_PAGE_ALLOCATION_GRANULARITY;
break;
case EfiBootServicesCode:
case EfiLoaderCode:
SectionAlignment = EFI_PAGE_SIZE;
case EfiReservedMemoryType:
PageAlignment = EFI_PAGE_SIZE;
break;
case EfiACPIReclaimMemory:
default:
ASSERT (FALSE);
SectionAlignment = EFI_PAGE_SIZE;
PageAlignment = EFI_PAGE_SIZE;
break;
}

return SectionAlignment;
if ((SectionAlignment & (PageAlignment - 1)) != 0) {
return FALSE;
} else {
return TRUE;
}
}

// FIXME: Deduplicate
/**
Protect UEFI PE/COFF image.
Expand Down
11 changes: 2 additions & 9 deletions MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,28 +392,21 @@ SmmInsertImageRecord (
DEBUG ((DEBUG_WARN, "SMM !!!!!!!! Image - %a !!!!!!!!\n", PdbPointer));
}

goto Finish;
return;
}

//
// The image headers are not recorded among the sections, allocate one more.
//
ImageRecord = UefiImageLoaderGetImageRecord (ImageContext);
if (ImageRecord == NULL) {
return ;
return;
}

UefiImageDebugPrintSegments (ImageContext);
UefiImageDebugPrintImageRecord (ImageRecord);

InsertSortImageRecord (ImageRecord);

Finish:
if (EFI_ERROR (Status) && (ImageRecord != NULL)) {
DeleteImagePropertiesRecord (ImageRecord);
}

return;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#ifndef IMAGE_PROPERTIES_RECORD_SUPPORT_LIB_H_
#define IMAGE_PROPERTIES_RECORD_SUPPORT_LIB_H_

#include <Library/UefiImageLib.h>

/**
Split the original memory map and add more entries to describe PE code
and data sections for each image in the input ImageRecordList.
Expand Down Expand Up @@ -72,7 +74,7 @@ SplitTable (
VOID
EFIAPI
DeleteImagePropertiesRecord (
IN IMAGE_PROPERTIES_RECORD *ImageRecord
IN UEFI_IMAGE_RECORD *ImageRecord
);

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PeCoffGetEntryPointLib.h>
#include <Library/ImagePropertiesRecordLib.h>

#define PREVIOUS_MEMORY_DESCRIPTOR(MemoryDescriptor, Size) \
Expand Down Expand Up @@ -327,15 +326,15 @@ SplitRecord (
//
// Update PhysicalStart to exclude the portion before the image buffer
//
if (TempRecord.PhysicalStart < ImageRecord->ImageBase) {
if (TempRecord.PhysicalStart < ImageRecord->StartAddress) {
NewRecord->Type = TempRecord.Type;
NewRecord->PhysicalStart = TempRecord.PhysicalStart;
NewRecord->VirtualStart = 0;
NewRecord->NumberOfPages = EfiSizeToPages (ImageRecord->ImageBase - TempRecord.PhysicalStart);
NewRecord->NumberOfPages = EfiSizeToPages (ImageRecord->StartAddress - TempRecord.PhysicalStart);
NewRecord->Attribute = TempRecord.Attribute;
TotalNewRecordCount++;

PhysicalStart = ImageRecord->ImageBase;
PhysicalStart = ImageRecord->StartAddress;
TempRecord.PhysicalStart = PhysicalStart;
TempRecord.NumberOfPages = EfiSizeToPages (PhysicalEnd - PhysicalStart);

Expand Down Expand Up @@ -490,7 +489,7 @@ SplitTable (
VOID
EFIAPI
DeleteImagePropertiesRecord (
IN IMAGE_PROPERTIES_RECORD *ImageRecord
IN UEFI_IMAGE_RECORD *ImageRecord
)
{
if (!IsListEmpty (&ImageRecord->Link)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
BaseMemoryLib
DebugLib
MemoryAllocationLib
PeCoffGetEntryPointLib
UefiImageLib

[Packages]
MdePkg/MdePkg.dec
Expand Down
6 changes: 6 additions & 0 deletions MdeModulePkg/MdeModulePkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@
SpiHcPlatformLib|MdeModulePkg/Library/BaseSpiHcPlatformLibNull/BaseSpiHcPlatformLibNull.inf
IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf

[LibraryClasses.IA32]
AmdSvsmLib|UefiCpuPkg/Library/AmdSvsmLibNull/AmdSvsmLibNull.inf

[LibraryClasses.X64]
AmdSvsmLib|OvmfPkg/Library/AmdSvsmLib/AmdSvsmLib.inf

[LibraryClasses.EBC.PEIM]
IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf

Expand Down
2 changes: 1 addition & 1 deletion MdePkg/Include/Library/DebugLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ UnitTestDebugAssert (
#define DEBUG(Expression) \
do { \
if (FALSE) { \
_DEBUG (Expression); \
_DEBUGLIB_DEBUG (Expression); \
} \
} while (FALSE)
#endif
Expand Down
2 changes: 1 addition & 1 deletion NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ Dhcp6AppendETOption (
return EFI_INVALID_PARAMETER;
}

if ((Elapsed == NULL)) {
if (Elapsed == NULL) {
return EFI_INVALID_PARAMETER;
}

Expand Down
Loading

0 comments on commit f6ee384

Please sign in to comment.