Extensible Firmware Interface Specification
110 12/12/00 Version 1.02
4.3 EFI Applications
Applications are loaded by the boot manager in the EFI firmware, or by other applications. To load
an application the firmware allocates enough memory to hold the image, copies the sections within
the application to the allocated memory and applies the relocation fix-ups needed. Once done, the
allocated memory is set to be the proper type for code and data for the image. Control is then
transferred to the applications entry point. When the application returns from its entry point, or
when it calls Exit(), the application is unloaded from memory and control is returned to the shell
that loaded the application.
When the boot manager loads an application, the image handle may be used to locate the load
options for the application. The load options are those options that were stored in the
LoadOptions field of the EFI_LOADED_IMAGE information for the application.
4.4 EFI OS Loaders
An EFI OS loader is a type of EFI application that normally takes over control of the system from
the EFI firmware. When loaded, the OS loader behaves like any other EFI application in that it
must only use memory it has allocated from the firmware and can only use EFI device handles for
access to devices that the firmware exposes. If the Loader includes any boot service style driver
functions, it must use the proper EFI interfaces to obtain access to the bus specific-resources. That
is, I/O and memory-mapped device registers must be accessed through the proper DEVICE_IO
calls like those that an EFI driver would perform.
If the OS loader experiences a problem and cannot load its operating system correctly, it can release
all allocated resources and return control back to the firmware via the Exit() call with an error
code and an ExitData that contains OS loader-specific data, including a Unicode string.
Once the OS loader successfully loads its operating system, it can take control of the system by
using ExitBootServices(). After calling ExitBootServices(), all boot services in the
system are terminated, including memory management, and the OS loader is responsible for the
continued operation of the system.
4.5 EFI Drivers
Drivers are loaded by the boot manager in the EFI firmware or by other applications. To load a
driver, the firmware allocates enough memory to hold the image, copies the sections within the
driver to the allocated memory and applies the relocation fix-ups that are needed. Once done, the
allocated memory is set to be the proper type for code and data for the image. Control is then
transferred to the drivers entry point. If the driver returns from its entry point, or when it calls
Exit() with an error code, the driver is unloaded from memory and control is returned to the shell
that loaded the driver. If the driver returns EFI_SUCCESS from its entry point, it continues to
reside in memory. If the driver is an EFIImageBootServiceDriver, the memory that the
driver is loaded into is of type EfiBootServicesCode and EfiBootServicesData. Such
memory regions revert back to normal memory when an OS loader exits boot services.