RTEMS Logo

RTEMS 4.6.1 On-Line Library


Calling Conventions Parameter Passing

PREV UP NEXT Bookshelf RTEMS MIPS Applications Supplement

2.5: Parameter Passing

RTEMS assumes that arguments are placed on the current stack before the directive is invoked via the XXX or XXX instruction. The first argument is assumed to be closest to the return address on the stack. This means that the first argument of the C calling sequence is pushed last. The following pseudo-code illustrates the typical sequence used to call a RTEMS directive with three (3) arguments:

push third argument
push second argument
push first argument
invoke directive
remove arguments from the stack

The arguments to RTEMS are typically pushed onto the stack using a move instruction with a pre-decremented stack pointer as the destination. These arguments must be removed from the stack after control is returned to the caller. This removal is typically accomplished by adding the size of the argument list in bytes to the current stack pointer.


PREV UP NEXT Bookshelf RTEMS MIPS Applications Supplement

Copyright © 1988-2004 OAR Corporation