Function Calls

For external functions, it is necessary to:

  1. Set up the arguments for the function call.

  2. Call the function.

  3. Retrieve the result and do any necessary final actions.

A function call involves the following:

  1. Load arguments into registers, beginning with %o0. Floating arguments must be stored in a temporary at [%sp+88] and then loaded into %o0.

  2. Execute a call instruction:

    
          call    sin    !  sin(%o0) -->  %f0
          nop
    
    The nop can be replaced by an instruction that is useful, e.g., loading the argument into %o0.

  3. Floating results are returned in %f0. Integer results are returned in %o0.

Contents    Page-10    Prev    Next    Page+10    Index