11 ebc linker, 12 image loader, 13 debug support – Intel Extensible Firmware Interface User Manual

Page 848

Advertising
background image

Extensible Firmware Interface Specification

19-74

12/01/02

Version 1.10

19.12.11 EBC Linker

New constants must be defined for use by the linker in processing EBC images. For EBC images,
the linker must set the machine type in the PE file header accordingly to indicate that the image
contains EBC.

#define IMAGE_FILE_MACHINE_EBC

0x0EBC

In addition, the linker must support EBC images with of the following subsystem types as set in a
PE32+ optional header:

#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12

For EFI EBC images and object files, the following relocation types must be supported:

// No relocations required
#define IMAGE_REL_EBC_ABSOLUTE

0x0000

// 32-bit address w/o image base
#define IMAGE_REL_EBC_ADDR32NB

0x0001

// 32-bit relative address from byte following relocs
#define IMAGE_REL_EBC_REL32

0x0002

// Section table index
#define IMAGE_REL_EBC_SECTION

0x0003

// Offset within section
#define IMAGE_REL_EBC_SECREL

0x0004

The ADDR32NB relocation is used internally to the linker when RVAs are emitted. It also is used
for version resources which probably will not be used. The REL32 relocation is for PC relative
addressing on code. The SECTION and SECREL relocations are used for debug information.

19.12.12 Image Loader

The EFI image loader is responsible for loading an executable image into memory and performing
any fixups prior to execution of the image. For EBC images, the image loader must also invoke the
interpreter protocol to create a thunk for the image entry point and return the address of this thunk.
After loading the image in this manner, the image can be executed in the standard manner. To
implement this functionality, only minor changes will be made to EFI service

LoadImage()

, and

no changes should be made to

StartImage()

.

After the image is unloaded, the EFI image load service must call the EBC

UnloadImage()

service to perform any cleanup to complete unloading of the image. Typically this will include
freeing up any memory allocated for thunks for the image during load and execution.

19.12.13 Debug Support

The interpreter must support debugging in an EFI environment per the EFI debug support protocol.

Advertising