Specifications

A Minimal PowerPCª Boot Sequence for
7
Executing Compiled C Programs
PowerPC EABI Compliance
Part III PowerPC EABI Compliance
The PowerPC EABI speciÞes the system interface for compiled programs. The EABI is based on the
System
V Application Binary Interface
and the
PowerPC Processor Supplement
. For general ABI documentation,
refer to these documents, as well as the
PowerPC Embedded Application Binary Interface
. This document
only includes aspects of the EABI that apply directly to preparing to jump into a compiled C program.
For running compiled programs, the EABI-speciÞed register conventions must be followed. The EABI
deÞnes how the processorÕs registers are to be used by a conforming application. Table 5 lists the register
conventions for the PowerPC EABI.
The symbols _SDA_BASE and _SDA2_BASE are deÞned during linking. They specify the locations of the
small data areas. A program must load these values into GPR13 and GPR2, respectively, before accessing
program data.
The small data areas contain part of the data of the executable. They hold a number of variables that can be
accessed within a 16-bit signed offset of _SDA_BASE or _SDA2_BASE. References to these variables are
performed through references to GPR13 and GPR2 by the user program. Typically, the small data areas
contain program variables that are less than or equal to 8 bytes in size, although this differs by compiler. The
variables in SDA2 are read-only.
Before executing user code, the startup code must also set up the stack pointer in GPR1. This pointer must
be 8-byte aligned for the EABI (as opposed to 16-byte aligned for the PowerPC ABI) and should point to
the lowest allocated valid stack frame. The stack grows toward lower addresses, so its location should be
selected so that it does not grow into data or bss areas.
Table 5. PowerPC EABI Registers
Register Contents
GPR1 Stack Frame Pointer
GPR2 _SDA2_BASE
GPR13 _SDA_BASE
GPR31 Local variables or environment pointer
GPR0 VolatileÑmay be modiÞed during linkage
GPR3, GPR4 VolatileÑused for parameter passing and return values
GPR5ÐGPR10 Used for parameter passing
GPR11ÐGPR12 VolatileÑmay be modiÞed during linkage
GPR14ÐGPR30 Used for local variables
FPR0 Volatile register
FPR1 VolatileÑused for parameter passing and return values
FPR2ÐFPR8 VolatileÑused for parameter passing
FPR9ÐFPR13 Volatile registers
FPR14ÐFPR31 Used for local variables