RTEMS Logo

RTEMS 4.9.4 On-Line Library


Intel/AMD x86 Specific Information Parameter Passing

PREV UP NEXT Bookshelf RTEMS CPU Architecture Supplement

4.2.4: 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 CPU Architecture Supplement

Copyright © 1988-2008 OAR Corporation