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

Page 177

Advertising
background image

Services — Boot Services

Version 1.10

12/01/02

5-79

Description

The

LoadImage()

function loads an EFI image into memory and returns a handle to the image.

The image is loaded in one of two ways. If

SourceBuffer

is not

NULL

, the function is a

memory-to-memory load in which

SourceBuffer

points to the image to be loaded and

SourceSize

indicates the image’s size in bytes. In this case, the caller has copied the image into

SourceBuffer

and can free the buffer once loading is complete.

If

SourceBuffer

is

NULL

, the function is a file copy operation that uses the

SIMPLE_FILE_SYSTEM

protocol and then the

LOAD_FILE

protocol on the

DeviceHandle

to

access the file referred to by

FilePath

. In this case, the

BootPolicy

flag is passed to the

LOAD_FILE.LoadFile()

function and is used to load the default image responsible for booting

when the

FilePath

only indicates the device. For more information see the discussion of the

Load File Protocol in Chapter 11.

Regardless of the type of load (memory-to-memory or file copy), the function relocates the code in
the image while loading it.

Once the image is loaded, firmware creates and returns an

EFI_HANDLE

that identifies the image

and supports the

EFI_LOADED_IMAGE

protocol. The caller may fill in the image’s “load

options” data, or add additional protocol support to the handle before passing control to the newly
loaded image by calling

StartImage()

. Also, once the image is loaded, the caller either starts it

by calling

StartImage()

or unloads it by calling

UnloadImage()

.

Status Codes Returned

EFI_SUCCESS

Image was loaded into memory correctly.

EFI_NOT_FOUND

The

FilePath

was not found.

EFI_INVALID_PARAMETER

One of the parameters has an invalid value.

EFI_UNSUPPORTED

The image type is not supported, or the device path cannot be
parsed to locate the proper protocol for loading the file.

EFI_OUT_OF_RESOURCES

Image was not loaded due to insufficient resources.

EFI_LOAD_ERROR

Image was not loaded because the image format was corrupt or not
understood.

EFI_DEVICE_ERROR

Image was not loaded because the device returned a read error.

Advertising