Position Independence
and Reentrancy
9-1
9
This chapter describes reentrancy and position-independence. Use it for
writing i960 processor applications that require position-independent or
reentrant programs. Position independence enables relocation of both the
.text and .data sections. The following sections describe position
independence, position-independent addressing modes, and reentrancy.
Position-independent Code and Data
Position independence refers to an application that can be relocated when
loaded. The application can be loaded at various addresses, but the code
and data do not move during execution. This feature enables creation of
programs for specific EPROMs used in a system.
The ic960 driver’s
G option with its arguments pc, pd and pr, or the
gcc960 driver’s
mpic, mpid and mpid-safe options, control generation of
position-independent code and data. For more information about
command-line options, see Chapters 2 (gcc960) and 3 (ic960).
Position-independent Data
When the position-independent data option is specified, references to
variables in the program are made relative to
g12. Initialization code for a
program must supply a data address bias in the position-independent data
bias register (
g12). For all accesses to statically allocated variables, the
value in
g12 is used to calculate the effective address. Register g12 must
be read-only for the entire program.