Compiler Conventions
the return link either in a register or on the stack. Also, it can determine the previous stack pointer by subtracting the current procedure's stack frame size.
The Assembler requires that you follow programming conventions to generate unwind descriptors. The beginning and end of each procedure must be noted with the .PROC and .PROCEND directives. The .CALLINFO directive supplies additional information about the procedure, including the stack frame size. The Assembler passes this information to the linker, which creates the unwind descriptor. It can also generate the standard entry and exit code to create and destroy the stack frame, save and restore the return link (if necessary), and save and restore any necessary registers. These code sequences are generated at the points indicated by the .ENTER and .LEAVE
Arguments to procedures are loaded into general registers 26, 25, 24, and 23; these registers are named, respectively, %arg0, %arg1, %arg2, and %arg3. If more than four words of arguments are required, the remaining arguments are stored in the caller's stack frame in the variable argument list. The return value should be returned in general register 28, called %ret0. General register 29, called %ret1, is used for the
Chapter 4, “Assembler Directives and
In order for an assembly language procedure to be callable from another language or another assembly language module, the name of the procedure must be exported. The .EXPORT directive does this. It also allows you to declare the symbol type. For procedure entry points, the symbol type should be ENTRY.
The Assembler and linker treat all symbols as
48 | Chapter 3 |