RTEMS Logo

RTEMS 4.8.0 On-Line Library


Motorola M68xxx and Coldfire 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 bsr or jsr 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 CPU Architecture Supplement

Copyright © 1988-2007OAR Corporation