RTEMS Logo

RTEMS 4.6.1 On-Line Library


Calling Conventions Processor Background

PREV UP NEXT Bookshelf RTEMS Hewlett Packard PA-RISC Applications Supplement

2.2: Processor Background

The PA-RISC architecture supports a simple yet effective call and return mechanism for subroutine calls where the caller and callee are both in the same address space. The compiler will not automatically generate subroutine calls which cross address spaces. A subroutine is invoked via the branch and link (bl) or the branch and link register (blr). These instructions save the return address in a caller specified register. By convention, the return address is saved in r2. The callee is responsible for maintaining the return address so it can return to the correct address. The branch vectored (bv) instruction is used to branch to the return address and thus return from the subroutine to the caller. It is is important to note that the PA-RISC subroutine call and return mechanism does not automatically save or restore any registers. It is the responsibility of the high-level language compiler to define the register preservation and usage convention.


PREV UP NEXT Bookshelf RTEMS Hewlett Packard PA-RISC Applications Supplement

Copyright © 1988-2004 OAR Corporation