RTEMS Logo

RTEMS 4.6.0 On-Line Library


Calling Conventions Parameters Passed in Registers

PREV UP NEXT Bookshelf RTEMS TI C3x/C4x Applications Supplement

2.5.2: Parameters Passed in Registers

When passing parameters via registers, the calling convention assumes that the arguments are placed in particular registers based upon their position and data type before the subroutine is invoked via the XXX instruction.

The following pseudo-code illustrates the typical sequence used to call a subroutine with three (3) arguments:

move third argument to XXX
move second argument to XXX
move first argument to XXX
invoke subroutine

With the GNU Compiler Suite, parameter passing via registers is selected by invoking the compiler with the -mregparm XXX argument. This argument must be included when linking the application in order to ensure that support libraries also compiled assuming parameter passing via the stack are used. The default parameter passing mechanism is XXX.

When this parameter passing mecahanism is selected, the XXX symbol is predefined by the C and C++ compilers and the XXX symbol is predefined by the assembler. This behavior is the same for the GNU and Texas Instruments toolsets. RTEMS uses these predefines to determine how parameters are passed in to those C3x/C4x specific routines that were written in assembly language.


PREV UP NEXT Bookshelf RTEMS TI C3x/C4x Applications Supplement

Copyright © 1988-2004 OAR Corporation