RTEMS Logo

RTEMS 4.6.99.3 On-Line Library


Calling Conventions Parameter Passing

PREV UP NEXT Bookshelf RTEMS Intel i386 Applications Supplement

2.5: Parameter Passing

RTEMS assumes that arguments are placed on the current stack before the directive is invoked via the call 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 push instruction. 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 stack pointer.


PREV UP NEXT Bookshelf RTEMS Intel i386 Applications Supplement

Copyright © 1988-2004 OAR Corporation