RTEMS Logo

RTEMS 4.6.1 On-Line Library


Calling Conventions Parameter Passing

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

2.5: Parameter Passing

RTEMS assumes that the first four (4) arguments are placed in the appropriate registers (r26, r25, r24, and r23) and, if needed, additional are placed on the current stack before the directive is invoked via the bl or blr instruction. The first argument is placed in r26, the second is placed in r25, and so forth. The following pseudo-code illustrates the typical sequence used to call a RTEMS directive with three (3) arguments:

set r24 to the third argument
set r25 to the second argument
set r26 to the first argument
invoke directive

The stack on the PA-RISC grows upward -- i.e. "pushing" onto the stack results in the address in the stack pointer becoming numerically larger. By convention, r27 is used as the stack pointer. The standard stack frame consists of a minimum of sixty-four (64) bytes and is the responsibility of the callee to maintain.


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

Copyright © 1988-2004 OAR Corporation