|
TianoCore EDK2 master
|
#include <PiDxe.h>#include <Library/BaseLib.h>#include <Library/BaseMemoryLib.h>#include <Library/MemoryAllocationLib.h>#include <Library/UefiBootServicesTableLib.h>#include <Library/SmmServicesTableLib.h>#include <Library/DebugLib.h>#include <Library/PcdLib.h>#include <Library/ImagePropertiesRecordLib.h>#include <Library/PeCoffLib.h>#include <Library/PeCoffGetEntryPointLib.h>#include <Guid/PiSmmMemoryAttributesTable.h>#include "PiSmmCore.h"Go to the source code of this file.
Data Structures | |
| struct | IMAGE_PROPERTIES_PRIVATE_DATA |
Macros | |
| #define | PREVIOUS_MEMORY_DESCRIPTOR(MemoryDescriptor, Size) ((EFI_MEMORY_DESCRIPTOR *)((UINT8 *)(MemoryDescriptor) - (Size))) |
| #define | IMAGE_PROPERTIES_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('I','P','P','D') |
| #define | EFI_MEMORY_ATTRIBUTES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA BIT0 |
Functions | |
| STATIC VOID | MergeMemoryMap (IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, IN OUT UINTN *MemoryMapSize, IN UINTN DescriptorSize) |
| STATIC VOID | EnforceMemoryMapAttribute (IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, IN UINTN MemoryMapSize, IN UINTN DescriptorSize) |
| STATIC EFI_STATUS EFIAPI | SmmCoreGetMemoryMapMemoryAttributesTable (IN OUT UINTN *MemoryMapSize, IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, OUT UINTN *MapKey, OUT UINTN *DescriptorSize, OUT UINT32 *DescriptorVersion) |
| VOID | SmmInsertImageRecord (IN EFI_SMM_DRIVER_ENTRY *DriverEntry) |
| VOID | PublishMemoryAttributesTable (VOID) |
| VOID | SmmInstallImageRecord (VOID) |
| EFI_STATUS EFIAPI | SmmInstallMemoryAttributesTable (IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle) |
| VOID EFIAPI | SmmCoreInitializeMemoryAttributesTable (VOID) |
Variables | |
| IMAGE_PROPERTIES_PRIVATE_DATA | mImagePropertiesPrivateData |
| UINT64 | mMemoryProtectionAttribute = EFI_MEMORY_ATTRIBUTES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA |
PI SMM MemoryAttributes support
Copyright (c) 2016, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file MemoryAttributesTable.c.
| #define EFI_MEMORY_ATTRIBUTES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA BIT0 |
Definition at line 45 of file MemoryAttributesTable.c.
| #define IMAGE_PROPERTIES_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('I','P','P','D') |
Definition at line 29 of file MemoryAttributesTable.c.
| #define PREVIOUS_MEMORY_DESCRIPTOR | ( | MemoryDescriptor, | |
| Size | |||
| ) | ((EFI_MEMORY_DESCRIPTOR *)((UINT8 *)(MemoryDescriptor) - (Size))) |
Definition at line 26 of file MemoryAttributesTable.c.
| STATIC VOID EnforceMemoryMapAttribute | ( | IN OUT EFI_MEMORY_DESCRIPTOR * | MemoryMap, |
| IN UINTN | MemoryMapSize, | ||
| IN UINTN | DescriptorSize | ||
| ) |
Enforce memory map attributes. This function will set EfiRuntimeServicesData/EfiMemoryMappedIO/EfiMemoryMappedIOPortSpace to be EFI_MEMORY_XP.
| [in,out] | MemoryMap | A pointer to the buffer in which firmware places the current memory map. |
| [in] | MemoryMapSize | Size, in bytes, of the MemoryMap buffer. |
| [in] | DescriptorSize | Size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR. |
Definition at line 125 of file MemoryAttributesTable.c.
| STATIC VOID MergeMemoryMap | ( | IN OUT EFI_MEMORY_DESCRIPTOR * | MemoryMap, |
| IN OUT UINTN * | MemoryMapSize, | ||
| IN UINTN | DescriptorSize | ||
| ) |
Merge continuous memory map entries whose have same attributes.
| [in,out] | MemoryMap | A pointer to the buffer in which firmware places the current memory map. |
| [in,out] | MemoryMapSize | A pointer to the size, in bytes, of the MemoryMap buffer. On input, this is the size of the current memory map. On output, it is the size of new memory map after merge. |
| [in] | DescriptorSize | Size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR. |
Definition at line 66 of file MemoryAttributesTable.c.
Publish MemoryAttributesTable to SMM configuration table.
Definition at line 343 of file MemoryAttributesTable.c.
| STATIC EFI_STATUS EFIAPI SmmCoreGetMemoryMapMemoryAttributesTable | ( | IN OUT UINTN * | MemoryMapSize, |
| IN OUT EFI_MEMORY_DESCRIPTOR * | MemoryMap, | ||
| OUT UINTN * | MapKey, | ||
| OUT UINTN * | DescriptorSize, | ||
| OUT UINT32 * | DescriptorVersion | ||
| ) |
This function for GetMemoryMap() with memory attributes table.
It calls original GetMemoryMap() to get the original memory map information. Then plus the additional memory map entries for PE Code/Data separation.
| [in,out] | MemoryMapSize | A pointer to the size, in bytes, of the MemoryMap buffer. On input, this is the size of the buffer allocated by the caller. On output, it is the size of the buffer returned by the firmware if the buffer was large enough, or the size of the buffer needed to contain the map if the buffer was too small. |
| [in,out] | MemoryMap | A pointer to the buffer in which firmware places the current memory map. |
| [out] | MapKey | A pointer to the location in which firmware returns the key for the current memory map. |
| [out] | DescriptorSize | A pointer to the location in which firmware returns the size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR. |
| [out] | DescriptorVersion | A pointer to the location in which firmware returns the version number associated with the EFI_MEMORY_DESCRIPTOR. |
| EFI_SUCCESS | The memory map was returned in the MemoryMap buffer. |
| EFI_BUFFER_TOO_SMALL | The MemoryMap buffer was too small. The current buffer size needed to hold the memory map is returned in MemoryMapSize. |
| EFI_INVALID_PARAMETER | One of the parameters has an invalid value. |
Definition at line 192 of file MemoryAttributesTable.c.
Initialize MemoryAttributesTable support.
Definition at line 520 of file MemoryAttributesTable.c.
| VOID SmmInsertImageRecord | ( | IN EFI_SMM_DRIVER_ENTRY * | DriverEntry | ) |
Insert image record.
| [in] | DriverEntry | Driver information |
Definition at line 260 of file MemoryAttributesTable.c.
This function installs all SMM image record information.
Definition at line 425 of file MemoryAttributesTable.c.
| EFI_STATUS EFIAPI SmmInstallMemoryAttributesTable | ( | IN CONST EFI_GUID * | Protocol, |
| IN VOID * | Interface, | ||
| IN EFI_HANDLE | Handle | ||
| ) |
Install MemoryAttributesTable.
| [in] | Protocol | Points to the protocol's unique identifier. |
| [in] | Interface | Points to the interface instance. |
| [in] | Handle | The handle on which the interface was installed. |
| EFI_SUCCESS | Notification runs successfully. |
Definition at line 488 of file MemoryAttributesTable.c.
| IMAGE_PROPERTIES_PRIVATE_DATA mImagePropertiesPrivateData |
Definition at line 38 of file MemoryAttributesTable.c.
| UINT64 mMemoryProtectionAttribute = EFI_MEMORY_ATTRIBUTES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA |
Definition at line 47 of file MemoryAttributesTable.c.