Basic System Problem Analysis - August 2003
47
Procedure Calling Convention: Registers
The previous page illustrates how parameters for a call to FREAD would be passed. The
convention says that R26 to R23 are used for the first 4 arguments.
R26 is referred to as “arg0” with R25 “arg1”, R24 “arg2” and R23 “arg3”.
The second parameter to FREAD is defined as a long pointer, which takes 64 bits (2
words). The procedure calling convention specifies that 64 bit quantities be passed with
the high order word in an ODD argument register. In this example the space ID portion of
the pointer is the high order word and it is loaded into R23 (arg3) so that the offset
portion of the address can be loaded adjacent to it in R24 (arg2). This leaves R25 (arg1)
unused and the value is whatever happened to be there the last time the register was used.
Since all four of the argument registers are used the “length” parameter must be saved
into the stack. Here also, the first four positions are skipped and reserved for later use as
the values in R26..R23 may eventually need to be spilled into the stack frame.