Intel Extensible Firmware Interface Network Router User Manual


  Open as PDF
of 1084
 
Overview
Version 1.10 12/01/02 2-7
2.3 Calling Conventions
Unless 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.
Calling conventions for IA-32 or Itanium-based applications 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 containinga0forFALSE or a 1 for TRUE. Other
values are undefined.
INTN Signed value of native width. (4 bytes on IA-32, 8 bytes on Itanium processor
instructions)
UINTN Unsigned value of native width. (4 bytes on IA-32, 8 bytes on Itanium processor
instructions)
INT8 1-byte signed value.
UINT8 1-byte unsigned value.
INT16 2-byte signed value.
UINT16 2-byte unsigned value.
continued