OAR

RTEMS 4.5.1-pre3 On-Line Library


Calling Conventions Processor Background

PREV UP NEXT Bookshelf RTEMS Intel i960 Applications Supplement

2.2: Processor Background

All members of the i960 architecture family support two methods for performing procedure calls: a RISC-style branch-and-link and an integrated call and return mechanism.

On a branch-and-link, the processor branches to the invoked procedure and saves the return address in a register, G14. Typically, the invoked procedure will not invoke another procedure and is referred to as a leaf procedure. Many high-level language compilers for the i960 family recognize leaf procedures and automatically optimize them to utilize the branch-and-link mechanism. Branch-and-link procedures are invoked using the bal and balx instructions and return control via the bx instruction. By convention, G14 is zero when not in a leaf procedure. It is the responsibility of the leaf procedure to clear G14 before returning.

The integrated call and return mechanism also branches to the invoked procedure and saves the return address as did the branch and link mechanism. However, the important difference is that the call, callx, and calls instructions save the local register set (R0 through R15) before transferring control to the invoked procedure. The ret instruction automatically restores the previous local register set. The i960CA provides a register cache which can be configured to retain the last five to sixteen recent register caches. When the register cache is full, the oldest cached register set is written to the stack.


PREV UP NEXT Bookshelf RTEMS Intel i960 Applications Supplement

Copyright © 1988-2000 OAR Corporation