#include <Uefi.h>
#include <Guid/MemoryAttributesTable.h>
#include <Library/BaseMemoryLib.h>
#include <Library/BaseOverflowLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OcMemoryLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
Go to the source code of this file.
Functions | |
STATIC UINT32 | OcRealMemoryType (IN EFI_MEMORY_DESCRIPTOR *MemoryAttribte) |
STATIC EFI_STATUS | OcSplitMemoryEntryByAttribute (IN OUT EFI_MEMORY_DESCRIPTOR **RetMemoryMapEntry, IN OUT UINTN *CurrentEntryIndex, IN OUT UINTN *CurrentEntryCount, IN UINTN TotalEntryCount, IN EFI_MEMORY_DESCRIPTOR *MemoryAttribute, IN UINTN DescriptorSize) |
STATIC EFI_STATUS | OcExpandAttributeWrite (IN OUT EFI_MEMORY_ATTRIBUTES_TABLE *MemoryAttributesTable, IN OUT EFI_MEMORY_DESCRIPTOR *MemoryAttributesEntry OPTIONAL, IN UINTN MaxDescriptors, IN EFI_MEMORY_DESCRIPTOR *MemoryMapEntry, IN EFI_PHYSICAL_ADDRESS CurrentMapAddress) |
STATIC EFI_STATUS | OcExpandAttributesByMap (IN OUT EFI_MEMORY_ATTRIBUTES_TABLE *MemoryAttributesTable, IN OUT EFI_MEMORY_DESCRIPTOR *MemoryAttributesEntry, IN UINTN MaxDescriptors, IN UINTN MemoryMapDescriptors, IN EFI_MEMORY_DESCRIPTOR *MemoryMap, IN UINTN DescriptorSize) |
EFI_MEMORY_ATTRIBUTES_TABLE * | OcGetMemoryAttributes (OUT EFI_MEMORY_DESCRIPTOR **MemoryAttributesEntry OPTIONAL) |
EFI_STATUS | OcRebuildAttributes (IN EFI_PHYSICAL_ADDRESS Address, IN EFI_GET_MEMORY_MAP GetMemoryMap OPTIONAL) |
UINTN | OcCountSplitDescriptors (VOID) |
EFI_STATUS | OcSplitMemoryMapByAttributes (IN UINTN MaxMemoryMapSize, IN OUT UINTN *MemoryMapSize, IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, IN UINTN DescriptorSize) |
Copyright (C) 2019, vit9696. All rights reserved.
All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Definition in file MemoryAttributes.c.
UINTN OcCountSplitDescriptors | ( | VOID | ) |
Count upper bound of split runtime descriptors.
amount | of runtime descriptors. |
Definition at line 541 of file MemoryAttributes.c.
STATIC EFI_STATUS OcExpandAttributesByMap | ( | IN OUT EFI_MEMORY_ATTRIBUTES_TABLE * | MemoryAttributesTable, |
IN OUT EFI_MEMORY_DESCRIPTOR * | MemoryAttributesEntry, | ||
IN UINTN | MaxDescriptors, | ||
IN UINTN | MemoryMapDescriptors, | ||
IN EFI_MEMORY_DESCRIPTOR * | MemoryMap, | ||
IN UINTN | DescriptorSize ) |
Expand attributes table by adding memory map runtime entries into it. Requires sorted memory map.
[in,out] | MemoryAttributesTable | Memory attributes table. |
[in,out] | MemoryAttributesEntry | Memory attributes descriptor. |
[in] | MaxDescriptors | Maximum amount of descriptors in the attributes table. |
[in] | MemoryMapDescriptors | Memory map descriptor count. |
[in] | MemoryMap | Memory map. |
[in] | DescriptorSize | Memory map descriptor size. |
EFI_SUCCESS | on success. |
EFI_NOT_FOUND | nothing to do. |
Definition at line 261 of file MemoryAttributes.c.
STATIC EFI_STATUS OcExpandAttributeWrite | ( | IN OUT EFI_MEMORY_ATTRIBUTES_TABLE * | MemoryAttributesTable, |
IN OUT EFI_MEMORY_DESCRIPTOR *MemoryAttributesEntry | OPTIONAL, | ||
IN UINTN | MaxDescriptors, | ||
IN EFI_MEMORY_DESCRIPTOR * | MemoryMapEntry, | ||
IN EFI_PHYSICAL_ADDRESS | CurrentMapAddress ) |
Definition at line 169 of file MemoryAttributes.c.
EFI_MEMORY_ATTRIBUTES_TABLE * OcGetMemoryAttributes | ( | OUT EFI_MEMORY_DESCRIPTOR **MemoryAttributesEntry | OPTIONAL | ) |
Obtain memory attributes table.
[out] | MemoryAttributesEntry | memory descriptor pointer, optional. |
pointer | to memory attributes table. |
NULL | if memory attributes table is unsupported. |
Definition at line 409 of file MemoryAttributes.c.
STATIC UINT32 OcRealMemoryType | ( | IN EFI_MEMORY_DESCRIPTOR * | MemoryAttribte | ) |
Determine actual memory type from the attribute.
[in] | MemoryAttribute | Attribute to inspect. |
Definition at line 33 of file MemoryAttributes.c.
EFI_STATUS OcRebuildAttributes | ( | IN EFI_PHYSICAL_ADDRESS | Address, |
IN EFI_GET_MEMORY_MAP GetMemoryMap | OPTIONAL ) |
Refresh memory attributes entry containing the specified address.
[in] | Address | Address contained in the updated entry. |
[in] | GetMemoryMap |
EFI_SUCCESS | on success. |
EFI_NOT_FOUND | no entry contains the specified address. |
EFI_UNSUPPORTED | memory attributes are not supported by the platform. |
Definition at line 431 of file MemoryAttributes.c.
STATIC EFI_STATUS OcSplitMemoryEntryByAttribute | ( | IN OUT EFI_MEMORY_DESCRIPTOR ** | RetMemoryMapEntry, |
IN OUT UINTN * | CurrentEntryIndex, | ||
IN OUT UINTN * | CurrentEntryCount, | ||
IN UINTN | TotalEntryCount, | ||
IN EFI_MEMORY_DESCRIPTOR * | MemoryAttribute, | ||
IN UINTN | DescriptorSize ) |
Split memory map descriptor by attribute.
[in,out] | RetMemoryMapEntry | Pointer to descriptor in the memory map, updated to next proccessed. |
[in,out] | CurrentEntryIndex | Current index of the descriptor in the memory map, updated on increase. |
[in,out] | CurrentEntryCount | Number of descriptors in the memory map, updated on increase. |
[in] | TotalEntryCount | Max number of descriptors in the memory map. |
[in] | MemoryAttribute | Memory attribute used for splitting. |
[in] | DescriptorSize | Memory map descriptor size. |
EFI_SUCCESS | on success. |
EFI_OUT_OF_RESOURCES | when there are not enough free descriptor slots. |
Definition at line 77 of file MemoryAttributes.c.
EFI_STATUS OcSplitMemoryMapByAttributes | ( | IN UINTN | MaxMemoryMapSize, |
IN OUT UINTN * | MemoryMapSize, | ||
IN OUT EFI_MEMORY_DESCRIPTOR * | MemoryMap, | ||
IN UINTN | DescriptorSize ) |
Split memory map by memory attributes if available. Requires sorted memory map!
[in] | MaxMemoryMapSize | Upper memory map size bound for growth. |
[in,out] | MemoryMapSize | Current memory map size, updated on return. |
[in,out] | MemoryMap | Memory map to split. |
[in] | DescriptorSize | Memory map descriptor size. |
Note, the function is guaranteed to return valid memory map, though not necessarily split.
EFI_SUCCESS | on success. |
EFI_UNSUPPORTED | memory attributes are not supported by the platform. |
EFI_OUT_OF_RESOURCES | new memory map did not fit. |
Definition at line 573 of file MemoryAttributes.c.