OpenCore
1.0.4
OpenCore Bootloader
|
#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 | |
EFI_STATUS | OcDescToMemoryType (IN CHAR8 *MemoryTypeDesc, OUT EFI_MEMORY_TYPE *MemoryType) |
EFI_MEMORY_DESCRIPTOR * | OcGetCurrentMemoryMap (OUT UINTN *MemoryMapSize, OUT UINTN *DescriptorSize, OUT UINTN *MapKey OPTIONAL, OUT UINT32 *DescriptorVersion OPTIONAL, OUT UINTN *OriginalMemoryMapSize OPTIONAL, IN BOOLEAN IncludeSplitSpace) |
EFI_STATUS | OcGetCurrentMemoryMapAlloc (OUT UINTN *MemoryMapSize, OUT EFI_MEMORY_DESCRIPTOR **MemoryMap, OUT UINTN *MapKey, OUT UINTN *DescriptorSize, OUT UINT32 *DescriptorVersion, IN EFI_GET_MEMORY_MAP GetMemoryMap OPTIONAL, IN OUT EFI_PHYSICAL_ADDRESS *TopMemory OPTIONAL) |
VOID | OcSortMemoryMap (IN UINTN MemoryMapSize, IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, IN UINTN DescriptorSize) |
EFI_STATUS | OcShrinkMemoryMap (IN OUT UINTN *MemoryMapSize, IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, IN UINTN DescriptorSize) |
EFI_STATUS | OcDeduplicateDescriptors (IN OUT UINT32 *EntryCount, IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, IN UINTN DescriptorSize) |
EFI_STATUS | OcUpdateDescriptors (IN UINTN MemoryMapSize, IN EFI_MEMORY_DESCRIPTOR *MemoryMap, IN UINTN DescriptorSize, IN EFI_PHYSICAL_ADDRESS Address, IN EFI_MEMORY_TYPE Type, IN UINT64 SetAttributes, IN UINT64 DropAttributes) |
Variables | |
STATIC OC_MEMORY_TYPE_DESC | OcMemoryTypeString [OC_MEMORY_TYPE_DESC_COUNT] |
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 MemoryMap.c.
EFI_STATUS OcDeduplicateDescriptors | ( | IN OUT UINT32 * | EntryCount, |
IN OUT EFI_MEMORY_DESCRIPTOR * | MemoryMap, | ||
IN UINTN | DescriptorSize ) |
Deduplicate memory descriptors. Requires sorted entry list.
[in,out] | EntryCount | Memory map size in entries, updated on shrink. |
[in,out] | MemoryMap | Memory map to shrink. |
[in] | DescriptorSize | Memory map descriptor size in bytes. |
EFI_SUCCESS | on success. |
EFI_NOT_FOUND | when cannot join anything. |
Definition at line 438 of file MemoryMap.c.
EFI_STATUS OcDescToMemoryType | ( | IN CHAR8 * | MemoryTypeDesc, |
OUT EFI_MEMORY_TYPE * | MemoryType ) |
Return EFI memory type for given type description
[in] | MemoryTypeDesc | Memory type string representation. |
[out] | MemoryType | EFI memory type to return. |
EFI_NOT_FOUND | on unsuccessful lookup. |
EFI_INVALID_PARAMETER | on wrong passed agruments. |
EFI_SUCCESS | on successful lookup. |
Definition at line 90 of file MemoryMap.c.
EFI_MEMORY_DESCRIPTOR * OcGetCurrentMemoryMap | ( | OUT UINTN * | MemoryMapSize, |
OUT UINTN * | DescriptorSize, | ||
OUT UINTN *MapKey | OPTIONAL, | ||
OUT UINT32 *DescriptorVersion | OPTIONAL, | ||
OUT UINTN *OriginalMemoryMapSize | OPTIONAL, | ||
IN BOOLEAN | IncludeSplitSpace ) |
Get current memory map allocated on pool with reserved entries.
[out] | MemoryMapSize | Resulting memory map size in bytes. |
[out] | DescriptorSize | Resulting memory map descriptor size in bytes. |
[out] | MapKey | Memory map key, optional. |
[out] | DescriptorVersion | Memory map descriptor version, optional. |
[out] | OriginalMemoryMapSize | Actual pool allocation memory, optional. |
[out] | IncludeSplitSpace | Allocate memory to permit splitting memory map. |
current | memory map or NULL. |
Definition at line 116 of file MemoryMap.c.
EFI_STATUS OcGetCurrentMemoryMapAlloc | ( | OUT UINTN * | MemoryMapSize, |
OUT EFI_MEMORY_DESCRIPTOR ** | MemoryMap, | ||
OUT UINTN * | MapKey, | ||
OUT UINTN * | DescriptorSize, | ||
OUT UINT32 * | DescriptorVersion, | ||
IN EFI_GET_MEMORY_MAP GetMemoryMap | OPTIONAL, | ||
IN OUT EFI_PHYSICAL_ADDRESS *TopMemory | OPTIONAL ) |
Get current memory map of custom allocation.
[out] | MemoryMapSize | Resulting memory map size in bytes. |
[out] | MemoryMap | Resulting memory map. |
[out] | MapKey | Memory map key. |
[out] | DescriptorSize | Resulting memory map descriptor size in bytes. |
[out] | DescriptorVersion | Memory map descriptor version. |
[in] | GetMemoryMap | Custom GetMemoryMap implementation to use, optional. |
[in,out] | TopMemory | Base top address for OcAllocatePagesFromTop allocation, number of pages after return. |
EFI_SUCCESS | on success. |
Definition at line 201 of file MemoryMap.c.
EFI_STATUS OcShrinkMemoryMap | ( | IN OUT UINTN * | MemoryMapSize, |
IN OUT EFI_MEMORY_DESCRIPTOR * | MemoryMap, | ||
IN UINTN | DescriptorSize ) |
Shrink memory map by joining non-runtime records. Requires sorted memory map.
[in,out] | MemoryMapSize | Memory map size in bytes, updated on shrink. |
[in,out] | MemoryMap | Memory map to shrink. |
[in] | DescriptorSize | Memory map descriptor size in bytes. |
EFI_SUCCESS | on success. |
EFI_NOT_FOUND | when cannot join anything. |
Definition at line 333 of file MemoryMap.c.
VOID OcSortMemoryMap | ( | IN UINTN | MemoryMapSize, |
IN OUT EFI_MEMORY_DESCRIPTOR * | MemoryMap, | ||
IN UINTN | DescriptorSize ) |
Sort memory map entries based upon PhysicalStart, from low to high.
MemoryMapSize | Size, in bytes, of the MemoryMap buffer. |
MemoryMap | A pointer to the buffer in which firmware places the current memory map. |
DescriptorSize | Size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR. |
Definition at line 302 of file MemoryMap.c.
EFI_STATUS OcUpdateDescriptors | ( | IN UINTN | MemoryMapSize, |
IN EFI_MEMORY_DESCRIPTOR * | MemoryMap, | ||
IN UINTN | DescriptorSize, | ||
IN EFI_PHYSICAL_ADDRESS | Address, | ||
IN EFI_MEMORY_TYPE | Type, | ||
IN UINT64 | SetAttributes, | ||
IN UINT64 | DropAttributes ) |
Refresh memory descriptor containing the specified address.
[in] | MemoryMapSize | Memory map size in bytes. |
[in] | MemoryMap | Memory map to refresh. |
[in] | DescriptorSize | Memory map descriptor size in bytes. |
[in] | Address | Address contained in the updated entry. |
[in] | Type | Memory type to assign to the entry. |
[in] | SetAttributes | Attributes to set. |
[in] | DropAttributes | Attributes to remove. |
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 505 of file MemoryMap.c.
STATIC OC_MEMORY_TYPE_DESC OcMemoryTypeString[OC_MEMORY_TYPE_DESC_COUNT] |
Definition at line 26 of file MemoryMap.c.