RTEMS Logo

RTEMS 4.6.1 On-Line Library


Calling Conventions Register Usage

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

2.4: Register Usage

As discussed above, the bl and blr instructions do not automatically save any registers. RTEMS uses the registers r1, r19 - r26, and r31 as scratch registers. The PA-RISC calling convention specifies that the first four (4) arguments to subroutines are passed in registers r23 - r26. After the arguments have been used, the contents of these registers may be altered. Register r31 is the millicode scratch register. Millicode is the set of routines which support high-level languages on the PA-RISC by providing routines which are either too complex or too long for the compiler to generate inline code when these operations are needed. For example, indirect calls utilize a millicode routine. The scratch registers are not preserved by RTEMS directives therefore, the contents of these registers should not be assumed upon return from any RTEMS directive.

Surprisingly, when using the GNU C compiler at least integer multiplies are performed using the floating point registers. This is an important optimization because the PA-RISC does not have otherwise have hardware for multiplies. This has important ramifications in regards to the PA-RISC port of RTEMS. On most processors, the floating point unit is ignored if the code only performs integer operations. This makes it easy for the application developer to predict whether or not any particular task will require floating point operations. This property is taken advantage of by RTEMS on other architectures to minimize the number of times the floating point context is saved and restored. However, on the PA-RISC architecture, every task is implicitly a floating point task. Additionally the state of the floating point unit must be saved and restored as part of the interrupt processing because for all practical purposes it is impossible to avoid the use of the floating point registers. It is unknown if the HP-UX C compiler shares this property.


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

Copyright © 1988-2004 OAR Corporation