beautypg.com

Allocatepool() – Intel Extensible Firmware Interface User Manual

Page 127

background image

Services — Boot Services

Version 1.10

12/01/02

5-29

AllocatePool()

Summary

Allocates pool memory.

Prototype

EFI_STATUS
AllocatePool (

IN EFI_MEMORY_TYPE

PoolType,

IN UINTN

Size,

OUT VOID

**Buffer

);

Parameters

PoolType

The type of pool to allocate. Type

EFI_MEMORY_TYPE

is defined in

the

AllocatePages()

function description.

PoolType

values in

the range 0x80000000..0xFFFFFFFF are reserved for use by EFI OS
loaders that are provided by operating system vendors. The only illegal
memory type values are those in the range

EfiMaxMemoryType

..0x7FFFFFFF.

Size

The number of bytes to allocate from the pool.

Buffer

A pointer to a pointer to the allocated buffer if the call succeeds;
undefined otherwise.

Description

The

AllocatePool()

function allocates a memory region of

Size

bytes from memory of type

PoolType

and returns the address of the allocated memory in the location referenced by

Buffer

.

This function allocates pages from

EfiConventionalMemory

as needed to grow the requested

pool type. All allocations are eight-byte aligned.

The allocated pool memory is returned to the available pool with the

FreePool()

function.

Status Codes Returned

EFI_SUCCESS

The requested number of bytes was allocated.

EFI_OUT_OF_RESOURCES

The pool requested could not be allocated.

EFI_INVALID_PARAMETER

PoolType

was invalid.