Description, Status codes returned – Intel Extensible Firmware Interface User Manual
Page 126

Extensible Firmware Interface Specification
5-28
12/01/02
Version 1.10
Description
The
GetMemoryMap()
function returns a copy of the current memory map. The map is an array
of memory descriptors, each of which describes a contiguous block of memory. The map describes
all of memory, no matter how it is being used. That is, it includes blocks allocated by
and
, as well as blocks that the firmware is using for its
own purposes. The memory map is only used to describe memory that is present in the system.
Memory descriptors are never used to describe holes in the system memory map.
Until
is called, the memory map is owned by the firmware and the
currently executing EFI Image should only use memory pages it has explicitly allocated.
If the
MemoryMap
buffer is too small, the
EFI_BUFFER_TOO_SMALL
error code is returned and
the
MemoryMapSize
value contains the size of the buffer needed to contain the current
memory map.
On success a
MapKey
is returned that identifies the current memory map. The firmware’s key is
changed every time something in the memory map changes. In order to successfully invoke
ExitBootServices()
the caller must provide the current memory map key.
The
function also returns the size and revision number of the
EFI_MEMORY_DESCRIPTOR
. The
DescriptorSize
represents the size in bytes of an
EFI_MEMORY_DESCRIPTOR
array element returned in
MemoryMap
. The size is returned to
allow for future expansion of the
EFI_MEMORY_DESCRIPTOR
in response to hardware
innovation. The structure of the
EFI_MEMORY_DESCRIPTOR
may be extended in the future but
it will remain backwards compatible with the current definition. Thus OS software must use the
DescriptorSize
to find the start of each
EFI_MEMORY_DESCRIPTOR
in the
MemoryMap
array.
Status Codes Returned
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.