Parameter Passing - Intel i960 Jx Developer's Manual

Microprocessor
Table of Contents

Advertisement

PROCEDURE CALLS
# Do a context switch.
# Assume PFP = 0x5000.
flushreg
lda 0x8000,pfp
flushreg
ret
The
flushreg
before the modification is necessary to ensure that the frame of the previous context
(mapped to 0x5000 in the example) is "spilled" to the proper external memory address and
removed from the local register cache. When the
(or implicit frame spill due to an interrupt) after the modification of PFP would cause the
flushreg
frame of the previous context to be written to the wrong location in external memory.
The
flushreg
after the modification ensures that outstanding results are completely written to the
PFP before a subsequent
ret
low-order 4 bits of the PFP to select which
PFP modification allows an i960 implementation to implement a simple mechanism that quickly
selects the
function at the time the
ret
Note the
flushreg
after the modification executes very quickly because the local register cache has
already been flushed by the
processor implementations may provide other mechanisms to ensure PFP synchronization in addition
to
, but a
after a PFP modification is ensured to work on all i960 processors.
flushreg
flushreg
7.3

PARAMETER PASSING

Parameters are passed between procedures in two ways:
value
Parameters are passed directly to the calling procedure as part of the call and
return mechanism. This is the fastest method of passing parameters.
reference
Parameters are stored in an argument list in memory and a pointer to the
argument list is passed in a global register.
When passing parameters by value, the calling procedure stores the parameters to be passed in
global registers. Since the calling procedure and the called procedure share the global registers, the
called procedure has direct access to the parameters after the call.
When a procedure needs to pass more parameters than fits in the global registers, they can be
passed by reference. Here, parameters are placed in an argument list and a pointer to the argument
list is placed in a global register.
7-12
Example 7-1. flushreg
# Flush Frames to correct address.
# Ensure that "ret" gets updated PFP.
flushreg
instruction can be executed. Recall that the
function to perform. Requiring the
ret
instruction is issued and provides a faster return operation.
ret
flushreg
before; only synchronization of the PFP is performed. i960
before the modification was omitted, a
ret
instruction uses the
flushreg
after the

Advertisement

Table of Contents
loading

Table of Contents