JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
SPARC Assembly Language Reference Manual     Oracle Solaris 11 Express 11/10
search filter icon
search icon

Document Information


1.  SPARC Assembler for SunOS 5.x

2.  Assembler Syntax

3.  Executable and Linking Format

4.  Converting Files to the New Format

5.  Instruction-Set Mapping

A.  Pseudo-Operations

B.  Examples of Pseudo-Operations

B.1 Example 1

B.2 Example 2

B.3 Example 3

B.4 Example 4

B.5 Example 5

C.  Using the Assembler Command Line

D.  An Example Language Program

E.  SPARC-V9 Instruction Set


B.3 Example 3

The pseudo-ops shown in this example are .align, .global, .type, and .size.

The following C subroutine:

int sum(a, b)
    int a, b;
    return(a + b);

can be translated into the following assembly code:

    .section            ".text"

    .global            sum

    .align            4


    add        %o0,%o1,%o0                ! (a + b) is done in the

                            ! delay slot of retl

    .type        sum,#function                ! sum is of type function
    .size        sum,.-sum                ! size of sum is the diff

                            ! of current location

                            ! counter and the initial

                            ! definition of sum