Intel i960 Jx Developer's Manual page 247

Microprocessor
Table of Contents

Advertisement

The argument list can be stored anywhere in memory; however, a convenient place to store an
argument list is in the stack for a calling procedure. Space for the argument list is created by incre-
menting the SP register value. When the argument list is stored in the current stack, the argument
list is automatically deallocated when no longer needed.
A procedure receives parameters from — and returns values to — other calling procedures. To do
this successfully and consistently, all procedures must agree on the use of the global registers.
Parameter registers pass values into a function. Up to 12 parameters can be passed by value using
the global registers. When the number of parameters exceeds 12, additional parameters are passed
using the calling procedure's stack; a pointer to the argument list is passed in a pre-designated
register. Similarly, several registers are set aside for return arguments and a return argument block
pointer is defined to point to additional parameters. When the number of return arguments exceeds
the available number of return argument registers, the calling procedure passes a pointer to an
argument list on its stack where the remaining return values are placed.
parameter passing by value and by reference.
Local registers are automatically saved when a call is made. Because of the local register cache,
they are saved quickly and with no external bus traffic. The efficiency of the local register
mechanism plays an important role in two cases when calls are made:
1.
When a procedure is called which contains other calls, global parameter registers should be
moved to working local registers at the beginning of the procedure. In this way, parameter
registers are freed and nested calls are easily managed. The register move instruction
necessary to perform this action is very fast; the working parameters — now in local
registers — are saved efficiently when nested calls are made.
2.
When other procedures are nested within an interrupt or fault procedure, the procedure must
preserve all normally non-preserved parameter registers, such as the global registers. This is
necessary because the interrupt or fault occurs at any point in the user's program and a return
from an interrupt or fault must restore the exact processor state. The interrupt or fault
procedure can move non-preserved global registers to local registers before the nested call.
PROCEDURE CALLS
Example 7-2
illustrates
7-13
7

Advertisement

Table of Contents
loading

Table of Contents