Extensible Firmware Interface Specification
16 12/12/00 Version 1.02
2.3 Calling ConventionsUnless otherwise stated, all functions defined in the EFI specification are called through pointers in
common, architecturally defined, calling conventions found in C compilers. Pointers to the various
global EFI functions are found in the EFI_RUNTIME_SERVICES and EFI_BOOT_SERVICES
tables that are located via the EFI system table. Pointers to other functions defined in this
specification are located dynamically through device handles. In all cases, all pointers to EFI
functions are cast with the word EFIAPI. This allows the compiler for each architecture to supply
the proper compiler keywords to achieve the needed calling conventions. When passing pointer
arguments to Boot Services, Runtime Services, and Protocol Interfaces, the caller has the following
responsibilities:
1. It is the caller’s responsibility to pass pointer parameters that reference physical memory
locations. If a pointer is passed that does not point to a physical memory location(i.e. a
memory mapped I/O region), the results are unpredictable and the system may halt.
2. It is the caller’s responsibility to pass pointer parameters with correct alignment. If an
unaligned pointer is passed to a function, the results are unpredictable and the system may halt.
3. It is the caller’s responsibility to not pass in a NULL parameter to a function unless it is
explicitly allowed. If a NULL pointer is passed to a function, the results are unpredictable and
the system may hang.
IA-32 and Itanium-based calling conventions are described in more detail below. Any function or
protocol may return any valid return code.
2.3.1 Data Types
Table 2-2 lists the common data types that are used in the interface definitions, and Table 2-3 lists
their modifiers. Unless otherwise specified all data types are naturally aligned. Structures are
aligned on boundaries equal to the largest internal datum of the structure and internal data are
implicitly padded to achieve natural alignment.
Table 2-2. Common EFI Data Types
Mnemonic Description
BOOLEAN Logical boolean. 1 byte value containing a 0 for FALSE or a 1 for TRUE. Other
values are undefined.
INTN Signed value of native width. (4 bytes on IA-32, 8 bytes on Itanium-based
operations)
UINTN Unsigned value of native width. (4 bytes on IA-32, 8 bytes on Itanium-based
operations)
INT8 1 byte signed value.
UINT8 1 byte unsigned value.
INT16 2 byte signed value.
UINT16 2 byte unsigned value.
INT32 4 byte signed value.
UINT32 4 byte unsigned value.
INT64 8 byte signed value.
continued