Call And Return Mechanism; Local Registers And The Procedure Stack - Intel i960 Jx Developer's Manual

Microprocessor
Table of Contents

Advertisement

PROCEDURE CALLS
The processor performs two call actions:
local
When a local call is made, execution mode remains unchanged and the stack
frame for the called procedure is placed on the local stack. The local stack refers
to the stack of the calling procedure.
supervisor
When a supervisor call is made from user mode, execution mode is switched to
supervisor and the stack frame for the called procedure is placed on the
supervisor stack.
When a supervisor call is issued from supervisor mode, the call degenerates into
a local call (i.e., no mode nor stack switch).
Explicit procedure calls can be made using several instructions. Local call instructions
perform a local call action. With
callx
operand in the instruction.
A system call is made with
processor obtains the called procedure's IP from the system procedure table. A system call, when
executed, is directed to perform either the local or supervisor call action. These calls are referred to
as system-local and system-supervisor calls, respectively. A system-supervisor call is also referred
to as a supervisor call.
7.1

CALL AND RETURN MECHANISM

At any point in a program, the i960 processor has access to the global registers, a local register set
and the procedure stack. A subset of the stack allocated to the procedure is called the stack frame.
When a call executes, a new stack frame is allocated for the called procedure. The processor
also saves the current local register set, freeing these registers for use by the newly called
procedure. In this way, every procedure has a unique stack and a unique set of local registers.
When a return executes, the current local register set and current stack frame are deallocated.
The previous local register set and previous stack frame are restored.
7.1.1

Local Registers and the Procedure Stack

The processor automatically allocates a set of 16 local registers for each procedure. Since local registers
are on-chip, they provide fast access storage for local variables. Of the 16 local registers, 13 are
available for general use; r0, r1 and r2 are reserved for linkage information to tie procedures together.
The processor does not always clear or initialize the set of local registers assigned to a new
procedure. Therefore, initial register contents are unpredictable. Also, because the processor does
not initialize the local register save area in the newly created stack frame for the procedure, its
contents are equally unpredictable.
7-2
and
, the called procedure's IP is included as an
call
callx
calls
. This instruction is similar to
call
call
and
callx
, except that the
and

Advertisement

Table of Contents
loading

Table of Contents