TianoCore EDK2 master
Loading...
Searching...
No Matches
SetPermissions.c File Reference

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI UpdateMmFoundationPeCoffPermissions (IN CONST PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext, IN EFI_PHYSICAL_ADDRESS ImageBase, IN UINT32 SectionHeaderOffset, IN CONST UINT16 NumberOfSections, IN REGION_PERMISSION_UPDATE_FUNC TextUpdater, IN REGION_PERMISSION_UPDATE_FUNC ReadOnlyUpdater, IN REGION_PERMISSION_UPDATE_FUNC ReadWriteUpdater)
 
EFI_STATUS EFIAPI LocateStandaloneMmCorePeCoffData (IN EFI_FIRMWARE_VOLUME_HEADER *BfvAddress, IN OUT VOID **TeData, IN OUT UINTN *TeDataSize)
 
STATIC EFI_STATUS GetPeCoffSectionInformation (IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext, OUT EFI_PHYSICAL_ADDRESS *ImageBase, OUT UINT32 *SectionHeaderOffset, OUT UINT16 *NumberOfSections)
 
EFI_STATUS EFIAPI GetStandaloneMmCorePeCoffSections (IN VOID *TeData, IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext, OUT EFI_PHYSICAL_ADDRESS *ImageBase, IN OUT UINT32 *SectionHeaderOffset, IN OUT UINT16 *NumberOfSections)
 

Detailed Description

Locate, get and update PE/COFF permissions during Standalone MM Foundation Entry point on ARM platforms.

Copyright (c) 2017 - 2021, Arm Ltd. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file SetPermissions.c.

Function Documentation

◆ GetPeCoffSectionInformation()

STATIC EFI_STATUS GetPeCoffSectionInformation ( IN OUT PE_COFF_LOADER_IMAGE_CONTEXT ImageContext,
OUT EFI_PHYSICAL_ADDRESS ImageBase,
OUT UINT32 *  SectionHeaderOffset,
OUT UINT16 *  NumberOfSections 
)

Returns the PC COFF section information.

Parameters
[in,out]ImageContextPointer to PE/COFF image context
[out]ImageBaseBase of image in memory
[out]SectionHeaderOffsetOffset of PE/COFF image section header
[out]NumberOfSectionsNumber of Sections

Definition at line 232 of file SetPermissions.c.

◆ GetStandaloneMmCorePeCoffSections()

EFI_STATUS EFIAPI GetStandaloneMmCorePeCoffSections ( IN VOID *  TeData,
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT ImageContext,
OUT EFI_PHYSICAL_ADDRESS ImageBase,
IN OUT UINT32 *  SectionHeaderOffset,
IN OUT UINT16 *  NumberOfSections 
)

Privileged firmware assigns RO & Executable attributes to all memory occupied by the Boot Firmware Volume. This function locates the section information of the Standalone MM Core module to be able to change permissions of the individual sections later in the boot process.

Parameters
[in]TeDataPointer to PE/COFF image data
[in,out]ImageContextPointer to PE/COFF image context
[out]ImageBasePointer to ImageBase variable
[in,out]SectionHeaderOffsetOffset of PE/COFF image section header
[in,out]NumberOfSectionsNumber of Sections

Definition at line 347 of file SetPermissions.c.

◆ LocateStandaloneMmCorePeCoffData()

EFI_STATUS EFIAPI LocateStandaloneMmCorePeCoffData ( IN EFI_FIRMWARE_VOLUME_HEADER BfvAddress,
IN OUT VOID **  TeData,
IN OUT UINTN TeDataSize 
)

Privileged firmware assigns RO & Executable attributes to all memory occupied by the Boot Firmware Volume. This function locates the Standalone MM Core module PE/COFF image in the BFV and returns this information.

Parameters
[in]BfvAddressBase Address of Boot Firmware Volume
[in,out]TeDataPointer to address for allocating memory for PE/COFF image data
[in,out]TeDataSizePointer to size of PE/COFF image data

Definition at line 179 of file SetPermissions.c.

◆ UpdateMmFoundationPeCoffPermissions()

EFI_STATUS EFIAPI UpdateMmFoundationPeCoffPermissions ( IN CONST PE_COFF_LOADER_IMAGE_CONTEXT ImageContext,
IN EFI_PHYSICAL_ADDRESS  ImageBase,
IN UINT32  SectionHeaderOffset,
IN CONST UINT16  NumberOfSections,
IN REGION_PERMISSION_UPDATE_FUNC  TextUpdater,
IN REGION_PERMISSION_UPDATE_FUNC  ReadOnlyUpdater,
IN REGION_PERMISSION_UPDATE_FUNC  ReadWriteUpdater 
)

Privileged firmware assigns RO & Executable attributes to all memory occupied by the Boot Firmware Volume. This function sets the correct permissions of sections in the Standalone MM Core module to be able to access RO and RW data and make further progress in the boot process.

Parameters
[in]ImageContextPointer to PE/COFF image context
[in]ImageBaseBase of image in memory
[in]SectionHeaderOffsetOffset of PE/COFF image section header
[in]NumberOfSectionsNumber of Sections
[in]TextUpdaterFunction to change code permissions
[in]ReadOnlyUpdaterFunction to change RO permissions
[in]ReadWriteUpdaterFunction to change RW permissions

Definition at line 44 of file SetPermissions.c.